cppchecker shadow

This commit is contained in:
iceman1001 2021-02-24 00:02:59 +01:00
commit f5aa78e668
2 changed files with 6 additions and 7 deletions

View file

@ -241,7 +241,6 @@ void Desfire_session_key_new(const uint8_t rnda[], const uint8_t rndb[], desfire
} }
} }
static void xor(const uint8_t *ivect, uint8_t *data, const size_t len);
static size_t key_macing_length(desfirekey_t key); static size_t key_macing_length(desfirekey_t key);
// iceman, see memxor inside string.c, dest/src swapped.. // iceman, see memxor inside string.c, dest/src swapped..
@ -263,20 +262,20 @@ void cmac_generate_subkeys(desfirekey_t key, MifareCryptoDirection direction) {
mifare_cypher_blocks_chained(NULL, key, ivect, l, kbs, direction, MCO_ENCYPHER); mifare_cypher_blocks_chained(NULL, key, ivect, l, kbs, direction, MCO_ENCYPHER);
bool xor = false; bool txor = false;
// Used to compute CMAC on complete blocks // Used to compute CMAC on complete blocks
memcpy(key->cmac_sk1, l, kbs); memcpy(key->cmac_sk1, l, kbs);
xor = l[0] & 0x80; txor = l[0] & 0x80;
lsl(key->cmac_sk1, kbs); lsl(key->cmac_sk1, kbs);
if (xor) if (txor)
key->cmac_sk1[kbs - 1] ^= R; key->cmac_sk1[kbs - 1] ^= R;
// Used to compute CMAC on the last block if non-complete // Used to compute CMAC on the last block if non-complete
memcpy(key->cmac_sk2, key->cmac_sk1, kbs); memcpy(key->cmac_sk2, key->cmac_sk1, kbs);
xor = key->cmac_sk1[0] & 0x80; txor = key->cmac_sk1[0] & 0x80;
lsl(key->cmac_sk2, kbs); lsl(key->cmac_sk2, kbs);
if (xor) if (txor)
key->cmac_sk2[kbs - 1] ^= R; key->cmac_sk2[kbs - 1] ^= R;
} }

View file

@ -130,7 +130,7 @@ size_t enciphered_data_length(const desfiretag_t tag, const size_t nbytes, int c
void cmac_generate_subkeys(desfirekey_t key, MifareCryptoDirection direction); void cmac_generate_subkeys(desfirekey_t key, MifareCryptoDirection direction);
void cmac(const desfirekey_t key, uint8_t *ivect, const uint8_t *data, size_t len, uint8_t *cmac); void cmac(const desfirekey_t key, uint8_t *ivect, const uint8_t *data, size_t len, uint8_t *cmac);
void mifare_kdf_an10922(const desfirekey_t key, const uint8_t *data, size_t dataLen); void mifare_kdf_an10922(const desfirekey_t key, const uint8_t *data, size_t len);
void desfire_crc32(const uint8_t *data, const size_t len, uint8_t *crc); void desfire_crc32(const uint8_t *data, const size_t len, uint8_t *crc);
void desfire_crc32_append(uint8_t *data, const size_t len); void desfire_crc32_append(uint8_t *data, const size_t len);