summaryrefslogtreecommitdiff
path: root/utils/nwztools/upgtools/fwp.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2017-01-04 16:55:53 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2017-01-04 17:05:15 +0100
commitdbeb6db1b55a50dedf17e7d78ddb6fe9eebc2a63 (patch)
tree29118847ebd2328095bb9f31fe7208c0a4bb6052 /utils/nwztools/upgtools/fwp.c
parent92ecbd5fb8a7c8e939b1b4dde82cc6c9ba9d41af (diff)
downloadrockbox-dbeb6db1b55a50dedf17e7d78ddb6fe9eebc2a63.zip
rockbox-dbeb6db1b55a50dedf17e7d78ddb6fe9eebc2a63.tar.gz
rockbox-dbeb6db1b55a50dedf17e7d78ddb6fe9eebc2a63.tar.bz2
rockbox-dbeb6db1b55a50dedf17e7d78ddb6fe9eebc2a63.tar.xz
nwztools: cleanup crypto, switch MD5 to Crypto++
We already use Crypto++ for DES anyway, and using OpenSSL is not great because of its incompatible licence. Change-Id: I78771b84c1708795a0c0c30afa5bdfe4885dea4e
Diffstat (limited to 'utils/nwztools/upgtools/fwp.c')
-rw-r--r--utils/nwztools/upgtools/fwp.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/utils/nwztools/upgtools/fwp.c b/utils/nwztools/upgtools/fwp.c
index 34c55f6..7d8f800 100644
--- a/utils/nwztools/upgtools/fwp.c
+++ b/utils/nwztools/upgtools/fwp.c
@@ -18,21 +18,20 @@
* KIND, either express or implied.
*
****************************************************************************/
-#include <stdio.h>
+#include <string.h>
#include <stdlib.h>
#include "fwp.h"
#include "misc.h"
#include "mg.h"
-#include <string.h>
-int fwp_read(void *in, int size, void *out, uint8_t *key)
+void fwp_read(void *in, int size, void *out, uint8_t *key)
{
- return mg_decrypt_fw(in, size, out, key);
+ mg_decrypt_fw(in, size, out, key);
}
-int fwp_write(void *in, int size, void *out, uint8_t *key)
+void fwp_write(void *in, int size, void *out, uint8_t *key)
{
- return mg_encrypt_fw(in, size, out, key);
+ mg_encrypt_fw(in, size, out, key);
}
static uint8_t g_key[NWZ_KEY_SIZE];
@@ -42,7 +41,7 @@ void fwp_setkey(char key[NWZ_KEY_SIZE])
memcpy(g_key, key, NWZ_KEY_SIZE);
}
-int fwp_crypt(void *buf, int size, int mode)
+void fwp_crypt(void *buf, int size, int mode)
{
while(size >= NWZ_KEY_SIZE)
{
@@ -54,6 +53,5 @@ int fwp_crypt(void *buf, int size, int mode)
size -= NWZ_KEY_SIZE;
}
if(size != 0)
- abort();
- return 0;
+ abort(); /* size is not a multiple of 8 */
}