diff options
| author | Amaury Pouly <amaury.pouly@gmail.com> | 2017-01-04 16:55:53 +0100 |
|---|---|---|
| committer | Amaury Pouly <amaury.pouly@gmail.com> | 2017-01-04 17:05:15 +0100 |
| commit | dbeb6db1b55a50dedf17e7d78ddb6fe9eebc2a63 (patch) | |
| tree | 29118847ebd2328095bb9f31fe7208c0a4bb6052 /utils/nwztools/upgtools/mg.cpp | |
| parent | 92ecbd5fb8a7c8e939b1b4dde82cc6c9ba9d41af (diff) | |
| download | rockbox-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/mg.cpp')
| -rw-r--r-- | utils/nwztools/upgtools/mg.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/utils/nwztools/upgtools/mg.cpp b/utils/nwztools/upgtools/mg.cpp index f02b673..7903970 100644 --- a/utils/nwztools/upgtools/mg.cpp +++ b/utils/nwztools/upgtools/mg.cpp @@ -28,43 +28,41 @@ using namespace CryptoPP; namespace { - inline int dec_des_ecb(void *in, int size, void *out, uint8_t *key) + inline void dec_des_ecb(void *in, int size, void *out, uint8_t *key) { ECB_Mode< DES >::Decryption dec; if(size % 8) - return 42; + abort(); /* size must be a multiple of 8 */ dec.SetKey(key, 8); dec.ProcessData((byte*)out, (byte*)in, size); - return 0; } - inline int enc_des_ecb(void *in, int size, void *out, uint8_t *key) + inline void enc_des_ecb(void *in, int size, void *out, uint8_t *key) { ECB_Mode< DES >::Encryption enc; if(size % 8) - return 42; + abort(); /* size must be a multiple of 8 */ enc.SetKey(key, 8); enc.ProcessData((byte*)out, (byte*)in, size); - return 0; } } -int mg_decrypt_fw(void *in, int size, void *out, uint8_t *key) +void mg_decrypt_fw(void *in, int size, void *out, uint8_t *key) { - return dec_des_ecb(in, size, out, key); + dec_des_ecb(in, size, out, key); } -int mg_encrypt_fw(void *in, int size, void *out, uint8_t *key) +void mg_encrypt_fw(void *in, int size, void *out, uint8_t *key) { - return enc_des_ecb(in, size, out, key); + enc_des_ecb(in, size, out, key); } -int mg_decrypt_pass(void *in, int size, void *out, uint8_t *key) +void mg_decrypt_pass(void *in, int size, void *out, uint8_t *key) { - return dec_des_ecb(in, size, out, key); + dec_des_ecb(in, size, out, key); } -int mg_encrypt_pass(void *in, int size, void *out, uint8_t *key) +void mg_encrypt_pass(void *in, int size, void *out, uint8_t *key) { - return enc_des_ecb(in, size, out, key); + enc_des_ecb(in, size, out, key); } |