remove desfire_crypto

This commit is contained in:
merlokk 2021-08-08 19:31:08 +03:00
parent 9e3cc6826c
commit 797d878eb4
2 changed files with 1 additions and 18 deletions

View file

@ -959,8 +959,6 @@ static int DesfireAuthenticateEV1(DesfireContext *dctx, DesfireSecureChannel sec
if (secureChannel == DACNone)
return PM3_SUCCESS;
mbedtls_aes_context ctx;
uint8_t keybytes[24] = {0};
// Crypt constants
uint8_t IV[16] = {0};
@ -973,20 +971,6 @@ static int DesfireAuthenticateEV1(DesfireContext *dctx, DesfireSecureChannel sec
// Part 1
memcpy(keybytes, dctx->key, desfire_get_key_length(dctx->keyType));
struct desfire_key dkey = {0};
desfirekey_t key = &dkey;
if (dctx->keyType == T_AES) {
mbedtls_aes_init(&ctx);
Desfire_aes_key_new(keybytes, key);
} else if (dctx->keyType == T_3DES) {
Desfire_3des_key_new_with_version(keybytes, key);
} else if (dctx->keyType == T_DES) {
Desfire_des_key_new(keybytes, key);
} else if (dctx->keyType == T_3K3DES) {
Desfire_3k3des_key_new_with_version(keybytes, key);
}
if (dctx->kdfAlgo == MFDES_KDF_ALGO_AN10922) {
MifareKdfAn10922(dctx, DCOMasterKey, dctx->kdfInput, dctx->kdfInputLen);
PrintAndLogEx(DEBUG, " Derrived key: " _GREEN_("%s"), sprint_hex(dctx->key, desfire_get_key_block_length(dctx->keyType)));
@ -1130,7 +1114,7 @@ static int DesfireAuthenticateEV1(DesfireContext *dctx, DesfireSecureChannel sec
// If the 3Des key first 8 bytes = 2nd 8 Bytes then we are really using Singe Des
// As such we need to set the session key such that the 2nd 8 bytes = 1st 8 Bytes
if (dctx->keyType == T_3DES) {
if (memcmp(key->data, &key->data[8], 8) == 0)
if (memcmp(dctx->key, &dctx->key[8], 8) == 0)
memcpy(&dctx->sessionKeyEnc[8], dctx->sessionKeyEnc, 8);
}

View file

@ -16,7 +16,6 @@
#include "common.h"
#include "cliparser.h"
#include "mifare/desfirecrypto.h"
#include "mifare/desfire_crypto.h"
#define DESFIRE_TX_FRAME_MAX_LEN 54