summaryrefslogtreecommitdiff
path: root/utils/imxtools/sbtools/crypto.h
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-11-26 23:54:44 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2012-11-26 23:58:30 +0100
commit4e95b72ecbd972b9e1eb162c40a559b94eebac69 (patch)
tree2c71c5b9c07ba5758d6faadb93a7b2c7a252aa7d /utils/imxtools/sbtools/crypto.h
parent33b7ade67f67e1358a60e68d5e2c6d8959acd45b (diff)
downloadrockbox-4e95b72ecbd972b9e1eb162c40a559b94eebac69.zip
rockbox-4e95b72ecbd972b9e1eb162c40a559b94eebac69.tar.gz
rockbox-4e95b72ecbd972b9e1eb162c40a559b94eebac69.tar.bz2
rockbox-4e95b72ecbd972b9e1eb162c40a559b94eebac69.tar.xz
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
Diffstat (limited to 'utils/imxtools/sbtools/crypto.h')
-rw-r--r--utils/imxtools/sbtools/crypto.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/utils/imxtools/sbtools/crypto.h b/utils/imxtools/sbtools/crypto.h
index 452db6a..599ebf4 100644
--- a/utils/imxtools/sbtools/crypto.h
+++ b/utils/imxtools/sbtools/crypto.h
@@ -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__ */