mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-02 21:54:10 +08:00
textual
This commit is contained in:
parent
a739d33398
commit
ddb432ec8f
1 changed files with 2 additions and 4 deletions
|
@ -247,7 +247,6 @@ static void MAC(uint8_t *k, BitstreamIn input, BitstreamOut out) {
|
||||||
void doMAC(uint8_t *cc_nr_p, uint8_t *div_key_p, uint8_t mac[4]) {
|
void doMAC(uint8_t *cc_nr_p, uint8_t *div_key_p, uint8_t mac[4]) {
|
||||||
uint8_t cc_nr[13] = { 0 };
|
uint8_t cc_nr[13] = { 0 };
|
||||||
uint8_t div_key[8];
|
uint8_t div_key[8];
|
||||||
//cc_nr=(uint8_t*) calloc(length+1, sizeof(uint8_t));
|
|
||||||
|
|
||||||
memcpy(cc_nr, cc_nr_p, 12);
|
memcpy(cc_nr, cc_nr_p, 12);
|
||||||
memcpy(div_key, div_key_p, 8);
|
memcpy(div_key, div_key_p, 8);
|
||||||
|
@ -260,7 +259,6 @@ void doMAC(uint8_t *cc_nr_p, uint8_t *div_key_p, uint8_t mac[4]) {
|
||||||
//The output MAC must also be reversed
|
//The output MAC must also be reversed
|
||||||
reverse_arraybytes(dest, sizeof(dest));
|
reverse_arraybytes(dest, sizeof(dest));
|
||||||
memcpy(mac, dest, 4);
|
memcpy(mac, dest, 4);
|
||||||
//free(cc_nr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void doMAC_N(uint8_t *address_data_p, uint8_t address_data_size, uint8_t *div_key_p, uint8_t mac[4]) {
|
void doMAC_N(uint8_t *address_data_p, uint8_t address_data_size, uint8_t *div_key_p, uint8_t mac[4]) {
|
||||||
|
@ -296,9 +294,9 @@ int testMAC(void) {
|
||||||
doMAC(cc_nr, div_key, calculated_mac);
|
doMAC(cc_nr, div_key, calculated_mac);
|
||||||
|
|
||||||
if (memcmp(calculated_mac, correct_MAC, 4) == 0) {
|
if (memcmp(calculated_mac, correct_MAC, 4) == 0) {
|
||||||
PrintAndLogEx(SUCCESS, "MAC calculation OK!");
|
PrintAndLogEx(SUCCESS, " MAC calculation (%s)", _GREEN_("ok"));
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(FAILED, "FAILED: MAC calculation failed:");
|
PrintAndLogEx(FAILED, " MAC calculation (%s)", _RED_("failed"));
|
||||||
printarr(" Calculated_MAC", calculated_mac, 4);
|
printarr(" Calculated_MAC", calculated_mac, 4);
|
||||||
printarr(" Correct_MAC ", correct_MAC, 4);
|
printarr(" Correct_MAC ", correct_MAC, 4);
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
|
Loading…
Reference in a new issue