Skip to content

Commit

Permalink
make style
Browse files Browse the repository at this point in the history
  • Loading branch information
merlokk committed Aug 4, 2021
1 parent a6d8b2e commit 09bb3f6
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 36 deletions.
50 changes: 25 additions & 25 deletions armsrc/lfops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions client/src/cmdlfem410x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion client/src/mifare/desfirecore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 7 additions & 7 deletions client/src/mifare/desfiresecurechan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion doc/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit 09bb3f6

Please sign in to comment.