From 46ada5a8b9bd1802025e7f274bb2dd74ced9c3f7 Mon Sep 17 00:00:00 2001 From: Conor Patrick Date: Tue, 26 Feb 2019 20:34:07 -0500 Subject: [PATCH] WRONG_DATA apdu error code fix --- fido2/extensions/extensions.c | 2 +- fido2/u2f.c | 3 ++- fido2/u2f.h | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fido2/extensions/extensions.c b/fido2/extensions/extensions.c index d14cab8..9dcaca2 100644 --- a/fido2/extensions/extensions.c +++ b/fido2/extensions/extensions.c @@ -118,7 +118,7 @@ int16_t extend_u2f(struct u2f_request_apdu* req, uint32_t len) { if ( ! is_extension_request((uint8_t *) &auth->kh, auth->khl)) // Pin requests { - rcode = U2F_SW_WRONG_PAYLOAD; + rcode = U2F_SW_WRONG_DATA; printf1(TAG_EXT, "Ignoring U2F auth request\n"); dump_hex1(TAG_EXT, (uint8_t *) &auth->kh, auth->khl); goto end; diff --git a/fido2/u2f.c b/fido2/u2f.c index 5b56479..1e94f56 100644 --- a/fido2/u2f.c +++ b/fido2/u2f.c @@ -196,6 +196,7 @@ static int16_t u2f_authenticate(struct u2f_authenticate_request * req, uint8_t c if (control == U2F_AUTHENTICATE_CHECK) { + printf1(TAG_U2F, "CHECK-ONLY\r\n"); if (u2f_appid_eq(&req->kh, req->app) == 0) { return U2F_SW_CONDITIONS_NOT_SATISFIED; @@ -213,7 +214,7 @@ static int16_t u2f_authenticate(struct u2f_authenticate_request * req, uint8_t c ) { - return U2F_SW_WRONG_PAYLOAD; + return U2F_SW_WRONG_DATA; } diff --git a/fido2/u2f.h b/fido2/u2f.h index 193588f..979ec2d 100644 --- a/fido2/u2f.h +++ b/fido2/u2f.h @@ -42,12 +42,11 @@ // Command status responses #define U2F_SW_NO_ERROR 0x9000 -#define U2F_SW_WRONG_DATA 0x6984 #define U2F_SW_CONDITIONS_NOT_SATISFIED 0x6985 #define U2F_SW_INS_NOT_SUPPORTED 0x6d00 #define U2F_SW_WRONG_LENGTH 0x6700 #define U2F_SW_CLASS_NOT_SUPPORTED 0x6E00 -#define U2F_SW_WRONG_PAYLOAD 0x6a80 +#define U2F_SW_WRONG_DATA 0x6a80 #define U2F_SW_INSUFFICIENT_MEMORY 0x9210 // Delay in milliseconds to wait for user input