diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-08-08 21:25:50 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-10-18 19:08:32 +0200 |
commit | 815b289cb3438ed566b3e9dc5074fe12e4b98f46 (patch) | |
tree | f4a92ac428098eda3a82da4549652b2ea079a599 /utils/imxtools/sbtools/crypto.cpp | |
parent | 387a45923c2ea6b223584815c7cd796ae064e22e (diff) | |
download | rockbox-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.cpp')
-rw-r--r-- | utils/imxtools/sbtools/crypto.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/utils/imxtools/sbtools/crypto.cpp b/utils/imxtools/sbtools/crypto.cpp index d7ef04f098..5563fcfd3b 100644 --- a/utils/imxtools/sbtools/crypto.cpp +++ b/utils/imxtools/sbtools/crypto.cpp @@ -30,19 +30,19 @@ namespace { enum crypto_method_t g_cur_method = CRYPTO_NONE; -byte g_key[16]; +uint8_t g_key[16]; CBC_Mode<AES>::Encryption g_aes_enc; CBC_Mode<AES>::Decryption g_aes_dec; bool g_aes_enc_key_dirty; /* true of g_aes_enc key needs to be updated */ bool g_aes_dec_key_dirty; /* same for g_aes_dec */ int cbc_mac2( - const byte *in_data, /* Input data */ - byte *out_data, /* Output data (or NULL) */ + const uint8_t *in_data, /* Input data */ + uint8_t *out_data, /* Output data (or NULL) */ int nr_blocks, /* Number of blocks to encrypt/decrypt (one block=16 bytes) */ - byte key[16], /* Key */ - byte iv[16], /* Initialisation Vector */ - byte (*out_cbc_mac)[16], /* CBC-MAC of the result (or NULL) */ + uint8_t key[16], /* Key */ + uint8_t iv[16], /* Initialisation Vector */ + uint8_t (*out_cbc_mac)[16], /* CBC-MAC of the result (or NULL) */ bool encrypt /* 1 to encrypt, 0 to decrypt */ ) { @@ -58,10 +58,10 @@ int cbc_mac2( g_aes_enc_key_dirty = false; } g_aes_enc.Resynchronize(iv, 16); - byte tmp[16]; + uint8_t tmp[16]; /* we need some output buffer, either a temporary one if we are CBC-MACing * only, or use output buffer if available */ - byte *out_ptr = (out_data == NULL) ? tmp : out_data; + uint8_t *out_ptr = (out_data == NULL) ? tmp : out_data; while(nr_blocks-- > 0) { g_aes_enc.ProcessData(out_ptr, in_data, 16); @@ -113,11 +113,11 @@ int crypto_setup(struct crypto_key_t *key) } int crypto_apply( - byte *in_data, /* Input data */ - byte *out_data, /* Output data (or NULL) */ + uint8_t *in_data, /* Input data */ + uint8_t *out_data, /* Output data (or NULL) */ int nr_blocks, /* Number of blocks (one block=16 bytes) */ - byte iv[16], /* Key */ - byte (*out_cbc_mac)[16], /* CBC-MAC of the result (or NULL) */ + uint8_t iv[16], /* Key */ + uint8_t (*out_cbc_mac)[16], /* CBC-MAC of the result (or NULL) */ bool encrypt) { if(g_cur_method == CRYPTO_KEY) @@ -131,7 +131,7 @@ void sha_1_init(struct sha_1_params_t *params) params->object = new SHA1; } -void sha_1_update(struct sha_1_params_t *params, byte *buffer, int size) +void sha_1_update(struct sha_1_params_t *params, uint8_t *buffer, int size) { reinterpret_cast<SHA1 *>(params->object)->Update(buffer, size); } @@ -143,7 +143,7 @@ void sha_1_finish(struct sha_1_params_t *params) delete obj; } -void sha_1_output(struct sha_1_params_t *params, byte *out) +void sha_1_output(struct sha_1_params_t *params, uint8_t *out) { memcpy(out, params->hash, 20); } |