added get parity

This commit is contained in:
Oleg Moiseenko 2018-02-10 19:19:56 +02:00
parent a31f7f899b
commit b957bcd382
3 changed files with 9 additions and 3 deletions

View file

@ -400,7 +400,7 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
EndOfTransmissionTimestamp = timestamp + duration;
if (protocol == PROTO_MIFARE)
annotateMifare(explanation, sizeof(explanation), frame, data_len, isResponse);
annotateMifare(explanation, sizeof(explanation), frame, data_len, parityBytes, parity_len, isResponse);
if(!isResponse)
{
@ -431,6 +431,9 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
}
}
// if (DecodeMifareData(frame, data_len, isResponse)) {
// };
if (is_last_record(tracepos, trace, traceLen)) return traceLen;
if (showWaitCycles && !isResponse && next_record_is_response(tracepos, trace)) {

View file

@ -186,7 +186,7 @@ void annotateIso14443a(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize)
return;
}
void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool isResponse) {
void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, uint8_t* parity, uint8_t paritysize, bool isResponse) {
// get UID
if (MifareAuthState == masNone) {
if (cmdsize == 7 && cmd[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT && cmd[1] == 0x70) {
@ -208,6 +208,7 @@ void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool
AuthData.nt = bytes_to_num(cmd, cmdsize);
else
AuthData.nt_enc = bytes_to_num(cmd, cmdsize);
AuthData.nt_enc_par = parity[0];
return;
} else {
MifareAuthState = masError;
@ -219,6 +220,7 @@ void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool
MifareAuthState = masAt;
AuthData.nr_enc = bytes_to_num(cmd, cmdsize);
AuthData.ar_enc = bytes_to_num(&cmd[3], cmdsize);
AuthData.ar_enc_par = parity[0] << 4;
return;
} else {
MifareAuthState = masError;
@ -229,6 +231,7 @@ void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool
snprintf(exp,size,"AUTH: at (enc)");
MifareAuthState = masFirstData;
AuthData.at_enc = bytes_to_num(cmd, cmdsize);
AuthData.at_enc_par = parity[0];
return;
} else {
MifareAuthState = masError;

View file

@ -31,7 +31,7 @@ extern void ClearAuthData();
extern uint8_t iso14443A_CRC_check(bool isResponse, uint8_t* data, uint8_t len);
extern uint8_t mifare_CRC_check(bool isResponse, uint8_t* data, uint8_t len);
extern void annotateIso14443a(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize);
extern void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool isResponse);
extern void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, uint8_t* parity, uint8_t paritysize, bool isResponse);
#endif // CMDHFLIST