From a65cfc5f4b45c603336057da66b54bed071eb86f Mon Sep 17 00:00:00 2001 From: Thomas Sutter Date: Tue, 17 Dec 2019 08:19:42 +0100 Subject: [PATCH] Fix auth1 response. --- client/cmdhffelica.c | 10 ++++++++-- include/mifare.h | 6 ++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/client/cmdhffelica.c b/client/cmdhffelica.c index 19bc807df..1986cb9b8 100644 --- a/client/cmdhffelica.c +++ b/client/cmdhffelica.c @@ -631,8 +631,14 @@ static int CmdHFFelicaAuthentication1(const char *Cmd) { PrintAndLogEx(ERR, "\nGot no Response from card"); return PM3_ERFTRANS; } else { - PrintAndLogEx(NORMAL, "AUTH1 SUCCESS!"); - PrintAndLogEx(NORMAL, "%s", sprint_hex(resp.data.asBytes, 256)); + felica_auth1_response_t auth1_response; + memcpy(&auth1_response, (felica_auth1_response_t *)resp.data.asBytes, sizeof(felica_auth1_response_t)); + if (auth1_response.frame_response.IDm[0] != 0) { + PrintAndLogEx(SUCCESS, "\nGot auth1 response:"); + PrintAndLogEx(SUCCESS, "IDm: %s", sprint_hex(auth1_response.frame_response.IDm, sizeof(auth1_response.frame_response.IDm))); + PrintAndLogEx(SUCCESS, "M2C: %s", sprint_hex(auth1_response.m2c, sizeof(auth1_response.m2c))); + PrintAndLogEx(SUCCESS, "M3C: %s", sprint_hex(auth1_response.m3c, sizeof(auth1_response.m3c))); + } } return PM3_SUCCESS; } diff --git a/include/mifare.h b/include/mifare.h index e278b3794..0f2758f56 100644 --- a/include/mifare.h +++ b/include/mifare.h @@ -220,6 +220,12 @@ typedef struct { uint8_t option_version_list[4]; } PACKED felica_request_spec_response_t; +typedef struct { + felica_frame_response_t frame_response; + uint8_t m2c[8]; + uint8_t m3c[8]; +} PACKED felica_auth1_response_t; + typedef enum FELICA_COMMAND { FELICA_CONNECT = (1 << 0), FELICA_NO_DISCONNECT = (1 << 1),