From 91e59848361229bbf3988e8f0e000ddf3341c9fc Mon Sep 17 00:00:00 2001 From: Lucas PASCAL Date: Wed, 10 Jul 2024 17:44:14 +0200 Subject: [PATCH] [clean] Removing erratic 'is_nfc' for a simpler (but never-working) one - code freeze choice --- src/app_main.c | 2 ++ src/ctap2_get_assertion.c | 1 - src/ctap2_make_credential.c | 1 - src/ctap2_processing.c | 1 - src/globals.c | 1 - src/u2f_processing.c | 5 ----- 6 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/app_main.c b/src/app_main.c index 65dc7c3d..259f3847 100644 --- a/src/app_main.c +++ b/src/app_main.c @@ -110,6 +110,8 @@ void app_main() { ui_idle(); for (;;) { + g.is_nfc = CMD_IS_OVER_U2F_NFC; + // Receive command bytes in G_io_apdu_buffer if ((input_len = io_recv_command()) < 0) { PRINTF("=> io_recv_command failure\n"); diff --git a/src/ctap2_get_assertion.c b/src/ctap2_get_assertion.c index 50b95c34..1c982b51 100644 --- a/src/ctap2_get_assertion.c +++ b/src/ctap2_get_assertion.c @@ -385,7 +385,6 @@ void ctap2_get_assertion_handle(u2f_service_t *service, uint8_t *buffer, uint16_ // the user // -> when credentials comes from rk, the spec ask to use authenticatorGetNextAssertion // features - g.is_nfc = true; ctap2_get_assertion_confirm(1); } else if (!ctap2AssertData->userPresenceRequired && !ctap2AssertData->pinRequired) { // No up nor uv required, skip UX and reply immediately diff --git a/src/ctap2_make_credential.c b/src/ctap2_make_credential.c index 98b607a6..47dca143 100644 --- a/src/ctap2_make_credential.c +++ b/src/ctap2_make_credential.c @@ -489,7 +489,6 @@ void ctap2_make_credential_handle(u2f_service_t *service, uint8_t *buffer, uint1 if (CMD_IS_OVER_U2F_NFC) { // No up nor uv requested, skip UX and reply immediately // TODO: is this what we want? - g.is_nfc = true; ctap2_make_credential_confirm(); } else { ctap2_make_credential_ux(); diff --git a/src/ctap2_processing.c b/src/ctap2_processing.c index 2dd208d3..1c4f9583 100644 --- a/src/ctap2_processing.c +++ b/src/ctap2_processing.c @@ -61,7 +61,6 @@ void send_cbor_error(u2f_service_t *service, uint8_t error) { void send_cbor_response(u2f_service_t *service, uint32_t length) { if (CMD_IS_OVER_U2F_NFC) { - g.is_nfc = true; const char *status = NULL; if (cmdType == CBOR_MAKE_CREDENTIAL) { status = "Registration details\nsent"; diff --git a/src/globals.c b/src/globals.c index b191c4da..a2aea04a 100644 --- a/src/globals.c +++ b/src/globals.c @@ -49,7 +49,6 @@ void prepare_display_status() { g.display_status[0] = '\0'; return; } - g.is_nfc = false; strncpy(g.display_status, g.rpID, strlen(g.rpID)); g.display_status[strlen(g.rpID)] = '\n'; strncpy(g.display_status + strlen(g.rpID) + 1, g.verifyHash, strlen(g.verifyHash)); diff --git a/src/u2f_processing.c b/src/u2f_processing.c index c64febac..329c9f9e 100644 --- a/src/u2f_processing.c +++ b/src/u2f_processing.c @@ -689,7 +689,6 @@ static int u2f_handle_apdu_enroll(const uint8_t *rx, uint32_t data_length, const sizeof(reg_req->application_param)); if (CMD_IS_OVER_U2F_NFC) { - g.is_nfc = true; uint16_t length = 0; uint16_t sw = u2f_prepare_enroll_response(responseBuffer, &length); @@ -765,7 +764,6 @@ static int u2f_handle_apdu_sign(const uint8_t *rx, uint32_t data_length, uint8_t // following macros + `else if` was messing with clang until the `return` #ifdef HAVE_NFC if (CMD_IS_OVER_U2F_NFC) { - g.is_nfc = true; // Android doesn't support answering SW_MORE_DATA here... // so compute the real answer as fast as possible uint16_t length = 0; @@ -826,7 +824,6 @@ static int u2f_handle_apdu_applet_select(uint8_t *rx, int data_length, const uin int u2f_handle_apdu(uint8_t *rx, int rx_length) { // PRINTF("=> RAW=%.*H\n", rx_length, rx); - g.is_nfc = false; uint8_t *data = NULL; uint32_t le = 0; @@ -843,7 +840,6 @@ int u2f_handle_apdu(uint8_t *rx, int rx_length) { } if (CMD_IS_OVER_U2F_NFC) { - g.is_nfc = true; nfc_io_set_le(le); } @@ -876,7 +872,6 @@ int u2f_handle_apdu(uint8_t *rx, int rx_length) { if (!CMD_IS_OVER_U2F_NFC) { return io_send_sw(SW_INS_NOT_SUPPORTED); } - g.is_nfc = true; return nfc_io_send_prepared_response(); default: