From eab8b81c95a939f76a420c737b03ef5c2349d1ab Mon Sep 17 00:00:00 2001 From: Conor Patrick Date: Tue, 23 Apr 2019 14:05:18 -0400 Subject: [PATCH] include nfc in user presence test --- fido2/ctap.c | 15 +++++++-------- targets/stm32l432/src/device.c | 4 ++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/fido2/ctap.c b/fido2/ctap.c index 6d18464..5d01721 100644 --- a/fido2/ctap.c +++ b/fido2/ctap.c @@ -466,12 +466,11 @@ static int ctap_make_auth_data(struct rpId * rp, CborEncoder * map, uint8_t * au count = auth_data_update_count(&authData->head); device_set_status(CTAPHID_STATUS_UPNEEDED); - // if NFC - not need to click a button - int but = 1; - if(!device_is_nfc()) - { - but = ctap_user_presence_test(); - } + + int but; + + but = ctap_user_presence_test(); + if (!but) { @@ -704,7 +703,7 @@ uint8_t ctap_make_credential(CborEncoder * encoder, uint8_t * request, int lengt } if (MC.pinAuthEmpty) { - if (!device_is_nfc() && !ctap_user_presence_test()) + if (!ctap_user_presence_test()) { return CTAP2_ERR_OPERATION_DENIED; } @@ -1143,7 +1142,7 @@ uint8_t ctap_get_assertion(CborEncoder * encoder, uint8_t * request, int length) if (GA.pinAuthEmpty) { - if (!device_is_nfc() && !ctap_user_presence_test()) + if (!ctap_user_presence_test()) { return CTAP2_ERR_OPERATION_DENIED; } diff --git a/targets/stm32l432/src/device.c b/targets/stm32l432/src/device.c index b3ebddd..2d99774 100644 --- a/targets/stm32l432/src/device.c +++ b/targets/stm32l432/src/device.c @@ -460,6 +460,10 @@ static int handle_packets() int ctap_user_presence_test() { int ret; + if (device_is_nfc()) + { + return 1; + } #if SKIP_BUTTON_CHECK_WITH_DELAY int i=500; while(i--)