diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index 23bd3127a..0d1e14d0b 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -689,22 +689,22 @@ static int CmdHF14ADesInfo(const char *Cmd) { iso14a_card_select_t card; res = SelectCard14443A_4(true, false, &card); if (res == PM3_SUCCESS) { - static const uint8_t STANDALONE_DESFIRE[] = { 0x75, 0x77, 0x81, 0x02 }; - static const uint8_t JCOP_DESFIRE[] = { 0x75, 0xf7, 0xb1, 0x02 }; - static const uint8_t JCOP3_DESFIRE[] = { 0x78, 0x77, 0x71, 0x02 }; + static const char STANDALONE_DESFIRE[] = { 0x75, 0x77, 0x81, 0x02 }; + static const char JCOP_DESFIRE[] = { 0x75, 0xf7, 0xb1, 0x02 }; + static const char JCOP3_DESFIRE[] = { 0x78, 0x77, 0x71, 0x02 }; if (card.sak == 0x20) { if (card.ats_len >= 5) { - if (bytes_compare((const uint8_t *)card.ats + 1, STANDALONE_DESFIRE, 4)) { + if (!memcmp(card.ats + 1, STANDALONE_DESFIRE, 4)) { PrintAndLogEx(INFO, "Standalone DESFire"); } - if (bytes_compare((const uint8_t *)card.ats + 1, JCOP_DESFIRE, 4)) { + if (!memcmp(card.ats + 1, JCOP_DESFIRE, 4)) { PrintAndLogEx(INFO, "JCOP DESFire"); } } if (card.ats_len == 4) { - if (bytes_compare((const uint8_t *)card.ats + 1, JCOP3_DESFIRE, 4)) { + if (!memcmp(card.ats + 1, JCOP3_DESFIRE, 4)) { PrintAndLogEx(INFO, "JCOP3 DESFire"); } } diff --git a/client/src/util.c b/client/src/util.c index ff99baaf7..65694db18 100644 --- a/client/src/util.c +++ b/client/src/util.c @@ -505,15 +505,6 @@ void bytes_to_bytebits(const void *src, const size_t srclen, void *dest) { } } -// Compare two arrays -bool bytes_compare(const uint8_t *b1, const uint8_t *b2, const size_t n) { - for (size_t i = 0; i < n; i++) { - if (b1[i] != b2[i]) - return false; - } - return true; -} - // aa,bb,cc,dd,ee,ff,gg,hh, ii,jj,kk,ll,mm,nn,oo,pp // to // hh,gg,ff,ee,dd,cc,bb,aa, pp,oo,nn,mm,ll,kk,jj,ii diff --git a/client/src/util.h b/client/src/util.h index a0b7237c2..532f47313 100644 --- a/client/src/util.h +++ b/client/src/util.h @@ -61,7 +61,6 @@ int hex_to_bytes(const char *hexValue, uint8_t *bytesValue, size_t maxBytesValue void num_to_bytebits(uint64_t n, size_t len, uint8_t *dest); void num_to_bytebitsLSBF(uint64_t n, size_t len, uint8_t *dest); void bytes_to_bytebits(const void *src, const size_t srclen, void *dest); -bool bytes_compare(const uint8_t *b1, const uint8_t *b2, const size_t n); // Swap endian on arrays up to 64bytes. uint8_t *SwapEndian64(const uint8_t *src, const size_t len, const uint8_t blockSize);