X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/dd83c4572b8a32af50beaf1e90a92b563a4781ab..5ed5e418c96e5a22edd19185ca86560f5b8318a4:/armsrc/mifareutil.c?ds=sidebyside diff --git a/armsrc/mifareutil.c b/armsrc/mifareutil.c index a9e48781..4100ef54 100644 --- a/armsrc/mifareutil.c +++ b/armsrc/mifareutil.c @@ -8,18 +8,7 @@ //----------------------------------------------------------------------------- // Work with mifare cards. //----------------------------------------------------------------------------- - -#include "proxmark3.h" -#include "apps.h" -#include "util.h" -#include "string.h" - -#include "iso14443crc.h" -#include "iso14443a.h" -#include "crapto1.h" #include "mifareutil.h" -#include "parity.h" -#include "des.h" int MF_DBGLEVEL = MF_DBG_ALL; @@ -132,7 +121,10 @@ int mifare_classic_authex(struct Crypto1State *pcs, uint32_t uid, uint8_t blockN // "random" reader nonce: //byte_t nr[4] = {0x55, 0x41, 0x49, 0x92}; - byte_t nr[4] = {0x01, 0x01, 0x01, 0x01}; + fast_prand(); + byte_t nr[4]; + num_to_bytes(prand(), 4, nr); + //byte_t nr[4] = {0x01, 0x01, 0x01, 0x01}; uint32_t nt, ntpp; // Supplied tag nonce @@ -287,7 +279,7 @@ int mifare_ultra_auth(uint8_t *keybytes){ memcpy(enc_random_b,resp+1,8); // decrypt nonce. - tdes_2key_dec(random_b, enc_random_b, sizeof(random_b), key, IV ); + tdes_2key_dec((void*)random_b, (void*)enc_random_b, sizeof(random_b), (const void*)key, IV ); rol(random_b,8); memcpy(rnd_ab ,random_a,8); memcpy(rnd_ab+8,random_b,8);