summaryrefslogtreecommitdiff
path: root/utils/imxtools/sbtools/crypto.h
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2020-08-08 21:25:50 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2020-10-18 19:08:32 +0200
commit815b289cb3438ed566b3e9dc5074fe12e4b98f46 (patch)
treef4a92ac428098eda3a82da4549652b2ea079a599 /utils/imxtools/sbtools/crypto.h
parent387a45923c2ea6b223584815c7cd796ae064e22e (diff)
downloadrockbox-815b289cb3438ed566b3e9dc5074fe12e4b98f46.tar.gz
rockbox-815b289cb3438ed566b3e9dc5074fe12e4b98f46.zip
imxtools: Replace use of "byte" with its underlying uint8_t.
libtomcrypt uses a macro "byte" which conflicts with this type. Since the underlying type is uint8_t and there's no real benefit from using a custom type use the actual underlying type. Change-Id: I982c9b8bdcb657b99fa645a5235303af7afda25b
Diffstat (limited to 'utils/imxtools/sbtools/crypto.h')
-rw-r--r--utils/imxtools/sbtools/crypto.h22
1 files changed, 10 insertions, 12 deletions
diff --git a/utils/imxtools/sbtools/crypto.h b/utils/imxtools/sbtools/crypto.h
index 169197790b..bdb94bb881 100644
--- a/utils/imxtools/sbtools/crypto.h
+++ b/utils/imxtools/sbtools/crypto.h
@@ -30,8 +30,6 @@
30extern "C" { 30extern "C" {
31#endif 31#endif
32 32
33typedef uint8_t byte;
34
35/* crypto.cpp */ 33/* crypto.cpp */
36enum crypto_method_t 34enum crypto_method_t
37{ 35{
@@ -52,7 +50,7 @@ struct crypto_key_t
52 enum crypto_method_t method; 50 enum crypto_method_t method;
53 union 51 union
54 { 52 {
55 byte key[16]; 53 uint8_t key[16];
56 union xorcrypt_key_t xor_key[2]; 54 union xorcrypt_key_t xor_key[2];
57 }u; 55 }u;
58}; 56};
@@ -68,28 +66,28 @@ int crypto_setup(struct crypto_key_t *key);
68 66
69/* return 0 on success, <0 on error */ 67/* return 0 on success, <0 on error */
70int crypto_apply( 68int crypto_apply(
71 byte *in_data, /* Input data */ 69 uint8_t *in_data, /* Input data */
72 byte *out_data, /* Output data (or NULL) */ 70 uint8_t *out_data, /* Output data (or NULL) */
73 int nr_blocks, /* Number of blocks (one block=16 bytes) */ 71 int nr_blocks, /* Number of blocks (one block=16 bytes) */
74 byte iv[16], /* IV */ 72 uint8_t iv[16], /* IV */
75 byte (*out_cbc_mac)[16], /* CBC-MAC of the result (or NULL) */ 73 uint8_t (*out_cbc_mac)[16], /* CBC-MAC of the result (or NULL) */
76 bool encrypt); 74 bool encrypt);
77 75
78/* crc.c */ 76/* crc.c */
79uint32_t crc(byte *data, int size); 77uint32_t crc(uint8_t *data, int size);
80uint32_t crc_continue(uint32_t previous_crc, byte *data, int size); 78uint32_t crc_continue(uint32_t previous_crc, uint8_t *data, int size);
81 79
82/* sha1.c */ 80/* sha1.c */
83struct sha_1_params_t 81struct sha_1_params_t
84{ 82{
85 byte hash[20]; /* final hash */ 83 uint8_t hash[20]; /* final hash */
86 void *object; /* pointer to CryptoPP::SHA1 object */ 84 void *object; /* pointer to CryptoPP::SHA1 object */
87}; 85};
88 86
89void sha_1_init(struct sha_1_params_t *params); 87void sha_1_init(struct sha_1_params_t *params);
90void sha_1_update(struct sha_1_params_t *params, byte *buffer, int size); 88void sha_1_update(struct sha_1_params_t *params, uint8_t *buffer, int size);
91void sha_1_finish(struct sha_1_params_t *params); 89void sha_1_finish(struct sha_1_params_t *params);
92void sha_1_output(struct sha_1_params_t *params, byte *out); 90void sha_1_output(struct sha_1_params_t *params, uint8_t *out);
93 91
94/* xorcrypt.c */ 92/* xorcrypt.c */
95 93