make style

This commit is contained in:
merlokk
2021-08-06 23:45:53 +03:00
parent 86d8c5ff42
commit e822cf5b1e
4 changed files with 54 additions and 27 deletions
+6 -6
View File
@@ -4928,7 +4928,7 @@ static int DesfileReadISOFileAndPrint(DesfireContext *dctx, bool select_current_
PrintAndLogEx(ERR, "ISO mode needs to specify file type");
return PM3_EINVARG;
}
if (filetype == RFTValue) {
PrintAndLogEx(ERR, "ISO mode can't read Value file type");
return PM3_EINVARG;
@@ -4938,7 +4938,7 @@ static int DesfileReadISOFileAndPrint(DesfireContext *dctx, bool select_current_
PrintAndLogEx(ERR, "ISO mode can't read Transaction MAC file type");
return PM3_EINVARG;
}
if (select_current_file)
PrintAndLogEx(INFO, "------------------------------- " _CYAN_("File ISO %04x data") " -------------------------------", fisoid);
else
@@ -4947,7 +4947,7 @@ static int DesfileReadISOFileAndPrint(DesfireContext *dctx, bool select_current_
uint8_t resp[2048] = {0};
size_t resplen = 0;
int res = 0;
if (filetype == RFTData) {
res = DesfireISOReadBinary(dctx, !select_current_file, (select_current_file) ? 0x00 : fnum, offset, length, resp, &resplen);
if (res != PM3_SUCCESS) {
@@ -5312,7 +5312,7 @@ static int DesfileWriteISOFile(DesfireContext *dctx, bool select_current_file, u
PrintAndLogEx(ERR, "ISO mode needs to specify file type");
return PM3_EINVARG;
}
if (filetype == RFTValue) {
PrintAndLogEx(ERR, "ISO mode can't write Value file type");
return PM3_EINVARG;
@@ -5322,12 +5322,12 @@ static int DesfileWriteISOFile(DesfireContext *dctx, bool select_current_file, u
PrintAndLogEx(ERR, "ISO mode can't write Transaction MAC file type");
return PM3_EINVARG;
}
if (dctx->commMode != DCMPlain) {
PrintAndLogEx(ERR, "ISO mode can write only in plain mode");
return PM3_EINVARG;
}
int res = 0;
if (filetype == RFTData) {
res = DesfireISOUpdateBinary(dctx, !select_current_file, (select_current_file) ? 0x00 : fnum, offset, data, datalen);
+6 -6
View File
@@ -1590,7 +1590,7 @@ int DesfireFillAppList(DesfireContext *dctx, PICCInfoS *PICCInfo, AppListS appLi
}
}
}
// field on-off zone
DesfireFillPICCInfo(dctx, PICCInfo, deepmode);
@@ -2586,7 +2586,7 @@ int DesfireChangeKey(DesfireContext *dctx, bool change_master_key, uint8_t newke
cdatalen += 4;
}
}
// send command
uint8_t resp[257] = {0};
size_t resplen = 0;
@@ -2698,7 +2698,7 @@ int DesfireISOReadBinary(DesfireContext *dctx, bool use_file_id, uint8_t fileid,
else
p1 = (offset >> 8) & 0x7f;
uint8_t p2 = offset & 0xff;
uint16_t sw = 0;
int res = DesfireExchangeISO(false, dctx, (sAPDU) {0x00, ISO7816_READ_BINARY, p1, p2, 0, NULL}, (length == 0) ? APDU_INCLUDE_LE_00 : length, resp, resplen, &sw);
if (res == PM3_SUCCESS && sw != 0x9000)
@@ -2717,7 +2717,7 @@ int DesfireISOUpdateBinary(DesfireContext *dctx, bool use_file_id, uint8_t filei
uint8_t resp[250] = {0};
size_t resplen = 0;
uint16_t sw = 0;
int res = DesfireExchangeISO(false, dctx, (sAPDU) {0x00, ISO7816_UPDATE_BINARY, p1, p2, datalen, data}, 0, resp, &resplen, &sw);
if (res == PM3_SUCCESS && sw != 0x9000)
@@ -2728,7 +2728,7 @@ int DesfireISOUpdateBinary(DesfireContext *dctx, bool use_file_id, uint8_t filei
int DesfireISOReadRecords(DesfireContext *dctx, uint8_t recordnum, bool read_all_records, uint8_t fileid, uint8_t length, uint8_t *resp, size_t *resplen) {
uint8_t p2 = ((fileid & 0x1f) << 3) | ((read_all_records) ? 0x05 : 0x04);
uint16_t sw = 0;
int res = DesfireExchangeISO(false, dctx, (sAPDU) {0x00, ISO7816_READ_RECORDS, recordnum, p2, 0, NULL}, (length == 0) ? APDU_INCLUDE_LE_00 : length, resp, resplen, &sw);
if (res == PM3_SUCCESS && sw != 0x9000)
@@ -2737,7 +2737,7 @@ int DesfireISOReadRecords(DesfireContext *dctx, uint8_t recordnum, bool read_all
return res;
}
int DesfireISOAppendRecord(DesfireContext *dctx, uint8_t fileid, uint8_t *data, size_t datalen) {
int DesfireISOAppendRecord(DesfireContext *dctx, uint8_t fileid, uint8_t *data, size_t datalen) {
uint8_t p2 = ((fileid & 0x1f) << 3);
uint8_t resp[250] = {0};
+5 -5
View File
@@ -563,10 +563,10 @@ static void DesfireISODecode(DesfireContext *ctx, uint8_t *srcdata, size_t srcda
memcpy(dstdata, srcdata, srcdatalen);
*dstdatalen = srcdatalen;
uint8_t data[1050] = {0};
if (srcdatalen < DesfireGetMACLength(ctx))
return;
uint8_t maclen = DesfireGetMACLength(ctx);
if (DesfireIsAuthenticated(ctx)) {
memcpy(data, srcdata, srcdatalen - maclen);
@@ -591,7 +591,7 @@ void DesfireSecureChannelDecode(DesfireContext *ctx, uint8_t *srcdata, size_t sr
DesfireISODecode(ctx, srcdata, srcdatalen, dstdata, dstdatalen);
return;
}
switch (ctx->secureChannel) {
case DACd40:
DesfireSecureChannelDecodeD40(ctx, srcdata, srcdatalen, respcode, dstdata, dstdatalen);
@@ -614,7 +614,7 @@ bool PrintChannelModeWarning(uint8_t cmd, DesfireSecureChannel secureChannel, De
PrintAndLogEx(WARNING, "Communication mode can't be NONE. command: %02x", cmd);
return false;
}
// no security set
if (secureChannel == DACNone)
return true;
@@ -626,7 +626,7 @@ bool PrintChannelModeWarning(uint8_t cmd, DesfireSecureChannel secureChannel, De
if (cmdSet == DCCISO) {
bool res = DesfireISOChannelValidCmd(cmd);
if (!res)
return false;
return false;
}
bool found = false;