From 586cbd2137e48b764f42483c31c5273d2315fdea Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Wed, 14 Nov 2018 11:33:45 +0200 Subject: [PATCH] hiclass --- client/cmdhficlass.c | 12 ++++++------ client/cmdhficlass.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/cmdhficlass.c b/client/cmdhficlass.c index 1f0204ba0..0c9d67d6e 100644 --- a/client/cmdhficlass.c +++ b/client/cmdhficlass.c @@ -766,8 +766,8 @@ int CmdHFiClassDecrypt(const char *Cmd) { hdr->csn[4],hdr->csn[5],hdr->csn[6],hdr->csn[7]); // tripledes - des3_context ctx = { DES_DECRYPT ,{ 0 } }; - des3_set2key_dec( &ctx, key); + mbedtls_des3_context ctx = { 0 }; + mbedtls_des3_set2key_dec( &ctx, key); uint8_t enc_dump[8] = {0}; uint8_t empty[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; @@ -778,7 +778,7 @@ int CmdHFiClassDecrypt(const char *Cmd) { // block 7 or higher, and not empty 0xFF if(blocknum > 6 && memcmp(enc_dump, empty, 8) != 0 ) { - des3_crypt_ecb(&ctx, enc_dump, decrypted + idx ); + mbedtls_des3_crypt_ecb(&ctx, enc_dump, decrypted + idx ); } } @@ -797,10 +797,10 @@ static int iClassEncryptBlkData(uint8_t *blkData) { PrintAndLogEx(SUCCESS, "decryption file found"); uint8_t encryptedData[16]; uint8_t *encrypted = encryptedData; - des3_context ctx = { DES_DECRYPT ,{ 0 } }; - des3_set2key_enc( &ctx, key); + mbedtls_des3_context ctx = { 0 }; + mbedtls_des3_set2key_enc( &ctx, key); - des3_crypt_ecb(&ctx, blkData,encrypted); + mbedtls_des3_crypt_ecb(&ctx, blkData,encrypted); memcpy(blkData,encrypted,8); return 1; } diff --git a/client/cmdhficlass.h b/client/cmdhficlass.h index c53e88f49..f9353ed1f 100644 --- a/client/cmdhficlass.h +++ b/client/cmdhficlass.h @@ -22,7 +22,7 @@ #include "common.h" #include "util.h" #include "comms.h" -#include "des.h" +#include "mbedtls/des.h" #include "loclass/cipherutils.h" #include "loclass/cipher.h" #include "loclass/ikeys.h"