mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
use memcmp
This commit is contained in:
parent
7b59029cdb
commit
cc3e2cc3a9
3 changed files with 6 additions and 16 deletions
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue