diff --git a/armsrc/lfops.c b/armsrc/lfops.c index 5c42ab564b..2f5fb47e47 100644 --- a/armsrc/lfops.c +++ b/armsrc/lfops.c @@ -1479,42 +1479,42 @@ int lf_em410x_watch(int findone, uint32_t *high, uint64_t *low) { int type = Em410xDecode(dest, &size, &idx, &hi, &lo); if (type & 0x1) { Dbprintf("EM TAG ID: " _GREEN_("%02x%08x") " - ( %05d_%03d_%08d )", - (uint32_t)(lo >> 32), - (uint32_t)lo, - (uint32_t)(lo & 0xFFFF), - (uint32_t)((lo >> 16LL) & 0xFF), - (uint32_t)(lo & 0xFFFFFF)); + (uint32_t)(lo >> 32), + (uint32_t)lo, + (uint32_t)(lo & 0xFFFF), + (uint32_t)((lo >> 16LL) & 0xFF), + (uint32_t)(lo & 0xFFFFFF)); } if (type & 0x2) { Dbprintf("EM XL TAG ID: " _GREEN_("%06x%08x%08x") " - ( %05d_%03d_%08d )", - hi, - (uint32_t)(lo >> 32), - (uint32_t)lo, - (uint32_t)(lo & 0xFFFF), - (uint32_t)((lo >> 16LL) & 0xFF), - (uint32_t)(lo & 0xFFFFFF)); + hi, + (uint32_t)(lo >> 32), + (uint32_t)lo, + (uint32_t)(lo & 0xFFFF), + (uint32_t)((lo >> 16LL) & 0xFF), + (uint32_t)(lo & 0xFFFFFF)); } if (type & 0x4) { uint64_t data = (lo << 20) >> 20; // Convert back to Short ID - uint64_t id = ((uint64_t)hi << 16 ) | (lo >> 48); + uint64_t id = ((uint64_t)hi << 16) | (lo >> 48); if ((data & 0xFFFFFFFF) == 0) { Dbprintf("EM TAG ID: " _GREEN_("%02x%08x") " - ( %05d_%03d_%08d ) Electra "_GREEN_("%i"), - (uint32_t)(id >> 32), - (uint32_t)id, - (uint32_t)(id & 0xFFFF), - (uint32_t)((id >> 16LL) & 0xFF), - (uint32_t)(id & 0xFFFFFF), - (uint32_t)(data >> 32)); + (uint32_t)(id >> 32), + (uint32_t)id, + (uint32_t)(id & 0xFFFF), + (uint32_t)((id >> 16LL) & 0xFF), + (uint32_t)(id & 0xFFFFFF), + (uint32_t)(data >> 32)); } else { Dbprintf("EM TAG ID: " _GREEN_("%02x%08x") " - ( %05d_%03d_%08d ) on 128b frame with data "_GREEN_("%03x%08x"), - (uint32_t)(id >> 32), - (uint32_t)id, - (uint32_t)(id & 0xFFFF), - (uint32_t)((id >> 16LL) & 0xFF), - (uint32_t)(id & 0xFFFFFF), - (uint32_t)(data >> 32), - (uint32_t)data); + (uint32_t)(id >> 32), + (uint32_t)id, + (uint32_t)(id & 0xFFFF), + (uint32_t)((id >> 16LL) & 0xFF), + (uint32_t)(id & 0xFFFFFF), + (uint32_t)(data >> 32), + (uint32_t)data); } } if ((type > 0) && findone) { diff --git a/client/src/cmdlfem410x.c b/client/src/cmdlfem410x.c index 2b52955930..0b45f9d0b3 100644 --- a/client/src/cmdlfem410x.c +++ b/client/src/cmdlfem410x.c @@ -114,7 +114,7 @@ void printEM410x(uint32_t hi, uint64_t id, bool verbose, int type) { if (type & 0x4) { // Short Extended ID uint64_t data = (id << 20) >> 20; // Convert back to Short ID - id = ((uint64_t)hi << 16 ) | (id >> 48); + id = ((uint64_t)hi << 16) | (id >> 48); if ((data & 0xFFFFFFFF) == 0) { PrintAndLogEx(SUCCESS, "EM 410x ID "_GREEN_("%010" PRIX64)" Electra "_GREEN_("%03" PRIu64), id, data >> 32); } else { @@ -137,7 +137,7 @@ void printEM410x(uint32_t hi, uint64_t id, bool verbose, int type) { } PrintAndLogEx(SUCCESS, " Short ID details:"); // Convert back to Short ID - id = ((uint64_t)hi << 16 ) | (id >> 48); + id = ((uint64_t)hi << 16) | (id >> 48); } if (type & (0x4 | 0x1)) { // Short Extended or Short ID //output 40 bit em id diff --git a/client/src/mifare/desfirecore.c b/client/src/mifare/desfirecore.c index abce6e7e94..0c146e4a04 100644 --- a/client/src/mifare/desfirecore.c +++ b/client/src/mifare/desfirecore.c @@ -1822,7 +1822,7 @@ int DesfireFillFileList(DesfireContext *dctx, FileListS FileList, size_t *filesc isoindx++; } } - + if (isoindx * 2 != buflen) PrintAndLogEx(WARNING, "Wrong ISO ID list length. must be %zu but %zu", buflen, isoindx * 2); } else { diff --git a/client/src/mifare/desfiresecurechan.c b/client/src/mifare/desfiresecurechan.c index 992006c9bb..2d91b0eccc 100644 --- a/client/src/mifare/desfiresecurechan.c +++ b/client/src/mifare/desfiresecurechan.c @@ -42,7 +42,7 @@ static bool CommandCanUseAnyChannel(uint8_t cmd) { static const AllowedChannelModesS AllowedChannelModes[] = { {MFDES_SELECT_APPLICATION, DACd40, DCCNative, DCMPlain}, - + {MFDES_CREATE_APPLICATION, DACd40, DCCNative, DCMMACed}, {MFDES_DELETE_APPLICATION, DACd40, DCCNative, DCMMACed}, {MFDES_GET_APPLICATION_IDS, DACd40, DCCNative, DCMMACed}, @@ -159,7 +159,7 @@ static const uint8_t EV1D40TransmitMAC[] = { static bool DesfireEV1D40TransmitMAC(DesfireContext *ctx, uint8_t cmd) { if (ctx->secureChannel != DACd40 && ctx->secureChannel != DACEV1) return true; - + for (int i = 0; i < ARRAY_LENGTH(EV1D40TransmitMAC); i++) if (EV1D40TransmitMAC[i] == cmd) return true; @@ -178,7 +178,7 @@ static const uint8_t D40ReceiveMAC[] = { static bool DesfireEV1D40ReceiveMAC(DesfireContext *ctx, uint8_t cmd) { if (ctx->secureChannel != DACd40) return true; - + for (int i = 0; i < ARRAY_LENGTH(D40ReceiveMAC); i++) if (D40ReceiveMAC[i] == cmd) return true; @@ -214,12 +214,12 @@ static void DesfireSecureChannelEncodeD40(DesfireContext *ctx, uint8_t cmd, uint } else if (ctx->commMode == DCMEncrypted || ctx->commMode == DCMEncryptedWithPadding) { if (srcdatalen <= hdrlen) return; - + uint8_t paddinglen = (ctx->commMode == DCMEncryptedWithPadding) ? 1 : 0; rlen = padded_data_length(srcdatalen + 2 + paddinglen - hdrlen, desfire_get_key_block_length(ctx->keyType)) + hdrlen; // 2 - crc16 memcpy(data, &srcdata[hdrlen], srcdatalen - hdrlen); iso14443a_crc_append(data, srcdatalen - hdrlen); - + // add padding if (paddinglen > 0) data[srcdatalen - hdrlen + 2] = 0x80; @@ -269,11 +269,11 @@ static void DesfireSecureChannelEncodeEV1(DesfireContext *ctx, uint8_t cmd, uint uint8_t paddinglen = (ctx->commMode == DCMEncryptedWithPadding) ? 1 : 0; rlen = padded_data_length(srcdatalen + 4 + paddinglen - hdrlen, desfire_get_key_block_length(ctx->keyType)); data[0] = cmd; - + // crc memcpy(&data[1], srcdata, srcdatalen); desfire_crc32_append(data, srcdatalen + 1); - + // add padding if (paddinglen > 0) data[srcdatalen + 1 + 4] = 0x80; diff --git a/doc/commands.json b/doc/commands.json index dc7c4e06d7..434296a124 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -9864,6 +9864,6 @@ "metadata": { "commands_extracted": 587, "extracted_by": "PM3Help2JSON v1.00", - "extracted_on": "2021-08-04T12:46:55" + "extracted_on": "2021-08-04T21:00:22" } } \ No newline at end of file