1
0
Fork 0
forked from len0rd/rockbox

sbtools: add support for the stmp36xx format

The STMP36xx series also uses .sb files but with a different
format. The main differences are the encryption and the lack of
sections, making it basically a list of commands: fill, load,
call, jump, switch mode, set sdram settings. Currently only the
sbtoelf has support for the sb1 and can only dump the list of
commands. Actual support for elf creation will come later.

Change-Id: I1f2e0230c91ac64efd0e8430e0c5212098c599fd
This commit is contained in:
Amaury Pouly 2012-11-26 23:54:44 +01:00
parent 33b7ade67f
commit 4e95b72ecb
6 changed files with 565 additions and 30 deletions

View file

@ -47,6 +47,7 @@ enum crypto_method_t
{
CRYPTO_NONE, /* disable */
CRYPTO_KEY, /* key */
CRYPTO_XOR_KEY, /* XOR key */
CRYPTO_USBOTP, /* use usbotp device */
};
@ -73,6 +74,12 @@ int crypto_apply(
byte (*out_cbc_mac)[16], /* CBC-MAC of the result (or NULL) */
int encrypt);
union xorcrypt_key_t
{
uint8_t key[64];
uint32_t k[16];
};
/* all-in-one function */
struct crypto_key_t
{
@ -80,6 +87,7 @@ struct crypto_key_t
union
{
byte key[16];
union xorcrypt_key_t xor_key[2];
uint32_t vid_pid;
byte param[0];
}u;
@ -112,4 +120,10 @@ void sha_1_update(struct sha_1_params_t *params, byte *buffer, int size);
void sha_1_finish(struct sha_1_params_t *params);
void sha_1_output(struct sha_1_params_t *params, byte *out);
/* xorcrypt.c */
// WARNING those functions modifies the keys !!
uint32_t xor_encrypt(union xorcrypt_key_t keys[2], void *data, int size);
uint32_t xor_decrypt(union xorcrypt_key_t keys[2], void *data, int size);
#endif /* __CRYPTO_H__ */