diff --git a/fido2/u2f.c b/fido2/u2f.c index 0361b25..67945cb 100644 --- a/fido2/u2f.c +++ b/fido2/u2f.c @@ -7,6 +7,7 @@ #include #include "u2f.h" #include "ctap.h" +#include "ctaphid.h" #include "crypto.h" #include "log.h" #include "device.h" @@ -95,6 +96,8 @@ void u2f_request_ex(APDU_HEADER *req, uint8_t *payload, uint32_t len, CTAP_RESPO #endif } + device_set_status(CTAPHID_STATUS_IDLE); + end: if (rcode != U2F_SW_NO_ERROR) { @@ -240,12 +243,13 @@ static int16_t u2f_authenticate(struct u2f_authenticate_request * req, uint8_t c if(up) { + device_set_status(CTAPHID_STATUS_UPNEEDED); if (ctap_user_presence_test() == 0) { return U2F_SW_CONDITIONS_NOT_SATISFIED; } } - + count = ctap_atomic_count(0); hash[0] = (count >> 24) & 0xff; hash[1] = (count >> 16) & 0xff; @@ -286,13 +290,12 @@ static int16_t u2f_register(struct u2f_register_request * req) const uint16_t attest_size = attestation_cert_der_size; - + device_set_status(CTAPHID_STATUS_UPNEEDED); if ( ! ctap_user_presence_test()) { return U2F_SW_CONDITIONS_NOT_SATISFIED; } - if ( u2f_new_keypair(&key_handle, req->app, pubkey) == -1) { return U2F_SW_INSUFFICIENT_MEMORY; @@ -325,8 +328,6 @@ static int16_t u2f_register(struct u2f_register_request * req) dump_signature_der(sig); - /*printf1(TAG_U2F, "dersig: "); dump_hex1(TAG_U2F,sig,74);*/ - return U2F_SW_NO_ERROR; } diff --git a/targets/stm32l432/src/device.c b/targets/stm32l432/src/device.c index d3d4410..978dd3c 100644 --- a/targets/stm32l432/src/device.c +++ b/targets/stm32l432/src/device.c @@ -72,7 +72,7 @@ void TIM6_DAC_IRQHandler() } #ifndef IS_BOOTLOADER // NFC sending WTX if needs - if (device_is_nfc()) + if (device_is_nfc() == NFC_IS_ACTIVE) { WTX_timer_exec(); }