X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/6c38d4c96fa96c871c739718081caa5e56ce968a..76a608af8e342b50718cfd0e53c0fa932304dbd9:/armsrc/desfire_crypto.c diff --git a/armsrc/desfire_crypto.c b/armsrc/desfire_crypto.c index acce980f..fdb06771 100644 --- a/armsrc/desfire_crypto.c +++ b/armsrc/desfire_crypto.c @@ -89,7 +89,6 @@ void cmac (const desfirekey_t key, uint8_t *ivect, const uint8_t *data, size_t l size_t key_block_size (const desfirekey_t key) { size_t block_size = 8; - switch (key->type) { case T_DES: case T_3DES: @@ -100,7 +99,6 @@ size_t key_block_size (const desfirekey_t key) { block_size = 16; break; } - return block_size; } @@ -109,7 +107,6 @@ size_t key_block_size (const desfirekey_t key) { */ static size_t key_macing_length (const desfirekey_t key) { size_t mac_length = MAC_LENGTH; - switch (key->type) { case T_DES: case T_3DES: @@ -120,7 +117,6 @@ static size_t key_macing_length (const desfirekey_t key) { mac_length = CMAC_LENGTH; break; } - return mac_length; } @@ -161,7 +157,7 @@ size_t enciphered_data_length (const desfiretag_t tag, const size_t nbytes, int return padded_data_length (nbytes + crc_length, block_size); } -void* mifare_cryto_preprocess_data (desfiretag_t tag, void *data, size_t *nbytes, off_t offset, int communication_settings) { +void* mifare_cryto_preprocess_data (desfiretag_t tag, void *data, size_t *nbytes, size_t offset, int communication_settings) { uint8_t *res = data; uint8_t mac[4]; size_t edl; @@ -289,7 +285,7 @@ void* mifare_cryto_preprocess_data (desfiretag_t tag, void *data, size_t *nbytes } -void* mifare_cryto_postprocess_data (desfiretag_t tag, void *data, ssize_t *nbytes, int communication_settings) +void* mifare_cryto_postprocess_data (desfiretag_t tag, void *data, size_t *nbytes, int communication_settings) { void *res = data; size_t edl; @@ -459,7 +455,7 @@ void* mifare_cryto_postprocess_data (desfiretag_t tag, void *data, ssize_t *nbyt break; case AS_NEW: end_crc_pos = crc_pos + 4; - crc32 (res, end_crc_pos, (uint8_t *)&crc); + crc32_ex (res, end_crc_pos, (uint8_t *)&crc); break; } if (!crc) { @@ -580,7 +576,7 @@ void mifare_cypher_single_block (desfirekey_t key, uint8_t *data, uint8_t *ivect { AesCtx ctx; AesCtxIni(&ctx, ivect, key->data, KEY128,CBC); - AesEncrypt(&ctx, data, edata, sizeof(data) ); + AesEncrypt(&ctx, data, edata, sizeof(edata) ); break; } case MCO_DECYPHER: