mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
nwztools: add support for new UPG format on post-WM1/A30 devices
The new code supports reading and writing UPG files. I kept the old keysig search code but it only supports the old format (the new format has too long keys anyway). Since we now have to support two types of encryption(DES and AES), I reorganized the crypto routines and clean-up some code. Change-Id: Ie9be220ec2431ec6d0bd11699fa0493b62e1cec2
This commit is contained in:
parent
cda16f9439
commit
53d2742a48
10 changed files with 451 additions and 263 deletions
|
|
@ -26,11 +26,27 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* size must be a multiple of 8 */
|
||||
void mg_decrypt_fw(void *in, int size, void *out, uint8_t *key);
|
||||
void mg_encrypt_fw(void *in, int size, void *out, uint8_t *key);
|
||||
void mg_decrypt_pass(void *in, int size, void *out, uint8_t *key);
|
||||
void mg_encrypt_pass(void *in, int size, void *out, uint8_t *key);
|
||||
/* size must be a multiple of 8, this function is thread-safe */
|
||||
void mg_decrypt_fw(void *in, int size, void *out, uint8_t key[8]);
|
||||
|
||||
/* for simplicity, these function use some global variables, this could be
|
||||
* change if necessary in the future */
|
||||
|
||||
/* DES: sizes must be a multiple of 8 */
|
||||
void des_ecb_dec_set_key(const uint8_t key[8]);
|
||||
void des_ecb_dec(void *in, int size, void *out);
|
||||
void des_ecb_enc_set_key(const uint8_t key[8]);
|
||||
void des_ecb_enc(void *in, int size, void *out);
|
||||
|
||||
/* AES: size must be a multiple of 16 */
|
||||
void aes_ecb_dec_set_key(const uint8_t key[16]);
|
||||
void aes_ecb_dec(void *in, int size, void *out);
|
||||
void aes_ecb_enc_set_key(const uint8_t key[16]);
|
||||
void aes_ecb_enc(void *in, int size, void *out);
|
||||
void aes_cbc_dec_set_key_iv(const uint8_t key[16], const uint8_t iv[16]);
|
||||
void aes_cbc_dec(void *in, int size, void *out);
|
||||
void aes_cbc_enc_set_key_iv(const uint8_t key[16], const uint8_t iv[16]);
|
||||
void aes_cbc_enc(void *in, int size, void *out);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue