diff options
Diffstat (limited to 'utils/nwztools/upgtools/fwp.c')
-rw-r--r-- | utils/nwztools/upgtools/fwp.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/utils/nwztools/upgtools/fwp.c b/utils/nwztools/upgtools/fwp.c index 34c55f6e5a..7d8f8002a8 100644 --- a/utils/nwztools/upgtools/fwp.c +++ b/utils/nwztools/upgtools/fwp.c | |||
@@ -18,21 +18,20 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <stdio.h> | 21 | #include <string.h> |
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include "fwp.h" | 23 | #include "fwp.h" |
24 | #include "misc.h" | 24 | #include "misc.h" |
25 | #include "mg.h" | 25 | #include "mg.h" |
26 | #include <string.h> | ||
27 | 26 | ||
28 | int fwp_read(void *in, int size, void *out, uint8_t *key) | 27 | void fwp_read(void *in, int size, void *out, uint8_t *key) |
29 | { | 28 | { |
30 | return mg_decrypt_fw(in, size, out, key); | 29 | mg_decrypt_fw(in, size, out, key); |
31 | } | 30 | } |
32 | 31 | ||
33 | int fwp_write(void *in, int size, void *out, uint8_t *key) | 32 | void fwp_write(void *in, int size, void *out, uint8_t *key) |
34 | { | 33 | { |
35 | return mg_encrypt_fw(in, size, out, key); | 34 | mg_encrypt_fw(in, size, out, key); |
36 | } | 35 | } |
37 | 36 | ||
38 | static uint8_t g_key[NWZ_KEY_SIZE]; | 37 | static uint8_t g_key[NWZ_KEY_SIZE]; |
@@ -42,7 +41,7 @@ void fwp_setkey(char key[NWZ_KEY_SIZE]) | |||
42 | memcpy(g_key, key, NWZ_KEY_SIZE); | 41 | memcpy(g_key, key, NWZ_KEY_SIZE); |
43 | } | 42 | } |
44 | 43 | ||
45 | int fwp_crypt(void *buf, int size, int mode) | 44 | void fwp_crypt(void *buf, int size, int mode) |
46 | { | 45 | { |
47 | while(size >= NWZ_KEY_SIZE) | 46 | while(size >= NWZ_KEY_SIZE) |
48 | { | 47 | { |
@@ -54,6 +53,5 @@ int fwp_crypt(void *buf, int size, int mode) | |||
54 | size -= NWZ_KEY_SIZE; | 53 | size -= NWZ_KEY_SIZE; |
55 | } | 54 | } |
56 | if(size != 0) | 55 | if(size != 0) |
57 | abort(); | 56 | abort(); /* size is not a multiple of 8 */ |
58 | return 0; | ||
59 | } | 57 | } |