From f5aa78e668913218a98131577bd2f658ca9efc76 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 24 Feb 2021 00:02:59 +0100 Subject: [PATCH] cppchecker shadow --- client/src/mifare/desfire_crypto.c | 11 +++++------ client/src/mifare/desfire_crypto.h | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/client/src/mifare/desfire_crypto.c b/client/src/mifare/desfire_crypto.c index 3e87236ea..d8fb62aaa 100644 --- a/client/src/mifare/desfire_crypto.c +++ b/client/src/mifare/desfire_crypto.c @@ -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); // 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); - bool xor = false; + bool txor = false; // Used to compute CMAC on complete blocks memcpy(key->cmac_sk1, l, kbs); - xor = l[0] & 0x80; + txor = l[0] & 0x80; lsl(key->cmac_sk1, kbs); - if (xor) + if (txor) key->cmac_sk1[kbs - 1] ^= R; // Used to compute CMAC on the last block if non-complete 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); - if (xor) + if (txor) key->cmac_sk2[kbs - 1] ^= R; } diff --git a/client/src/mifare/desfire_crypto.h b/client/src/mifare/desfire_crypto.h index e7219eaf0..ecc6fc4a5 100644 --- a/client/src/mifare/desfire_crypto.h +++ b/client/src/mifare/desfire_crypto.h @@ -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(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_append(uint8_t *data, const size_t len);