@Marshmellow42 's cleanup isn device-side "hf mfu" code. Looks nice. Dump uses bigbuffer now, and can dump NTAG216 :)

Consistency on the client-side code "hf mfu".  looks nice.
This commit is contained in:
iceman1001 2015-05-18 20:58:33 +02:00
commit e7e9508883
7 changed files with 114 additions and 131 deletions

View file

@ -322,15 +322,14 @@ int mifare_ul_ev1_auth(uint8_t *keybytes, uint8_t *pack){
len = mifare_sendcmd_short_mfuev1auth(NULL, 0, 0x1B, key, resp, respPar, NULL);
if (len != 4) {
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Cmd Error: %02x %u", resp[0], len);
OnError(1);
return 1;
return 0;
}
if (MF_DBGLEVEL >= MF_DBG_EXTENDED)
Dbprintf("Auth Resp: %02x%02x%02x%02x", resp[0],resp[1],resp[2],resp[3]);
memcpy(pack, resp, 4);
return 0;
return 1;
}
int mifare_ultra_auth(uint8_t *keybytes){
@ -352,8 +351,7 @@ int mifare_ultra_auth(uint8_t *keybytes){
len = mifare_sendcmd_short(NULL, 1, 0x1A, 0x00, resp, respPar ,NULL);
if (len != 11) {
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Cmd Error: %02x", resp[0]);
OnError(1);
return 1;
return 0;
}
// tag nonce.
@ -385,8 +383,7 @@ int mifare_ultra_auth(uint8_t *keybytes){
len = mifare_sendcmd_short_mfucauth(NULL, 1, 0xAF, rnd_ab, resp, respPar, NULL);
if (len != 11) {
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Cmd Error: %02x", resp[0]);
OnError(1);
return 1;
return 0;
}
uint8_t enc_resp[8] = { 0,0,0,0,0,0,0,0 };
@ -397,7 +394,7 @@ int mifare_ultra_auth(uint8_t *keybytes){
tdes_2key_dec(resp_random_a, enc_resp, 8, key, enc_random_b);
if ( memcmp(resp_random_a, random_a, 8) != 0 ) {
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("failed authentication");
return 1;
return 0;
}
if (MF_DBGLEVEL >= MF_DBG_EXTENDED) {
@ -417,7 +414,7 @@ int mifare_ultra_auth(uint8_t *keybytes){
resp_random_a[0],resp_random_a[1],resp_random_a[2],resp_random_a[3],
resp_random_a[4],resp_random_a[5],resp_random_a[6],resp_random_a[7]);
}
return 0;
return 1;
}
int mifare_ultra_readblock(uint8_t blockNo, uint8_t *blockData)