From aa7362f88fe00973addec0859f2fdf5f73252203 Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Mon, 14 Aug 2023 20:49:29 +0200 Subject: [PATCH] Fix enabled capabilities detection. Signed-off-by: Pol Henarejos --- src/fido/management.c | 2 +- src/fido/otp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fido/management.c b/src/fido/management.c index bd0be9a..483937f 100644 --- a/src/fido/management.c +++ b/src/fido/management.c @@ -63,7 +63,7 @@ bool cap_supported(uint16_t cap) { if (tag == TAG_USB_ENABLED) { uint16_t ecaps = tag_data[0]; if (tag_len == 2) { - ecaps = (tag_data[1] << 8) | tag_data[0]; + ecaps = (tag_data[0] << 8) | tag_data[1]; } return (ecaps & cap); } diff --git a/src/fido/otp.c b/src/fido/otp.c index 30faf19..cedcb71 100644 --- a/src/fido/otp.c +++ b/src/fido/otp.c @@ -176,10 +176,10 @@ extern int calculate_oath(uint8_t truncate, static uint8_t session_counter[2] = {0}; #endif int otp_button_pressed(uint8_t slot) { + init_otp(); if (!cap_supported(CAP_OTP)) { return 3; } - init_otp(); #ifndef ENABLE_EMULATION file_t *ef = search_dynamic_file(slot == 1 ? EF_OTP_SLOT1 : EF_OTP_SLOT2); const uint8_t *data = file_get_data(ef);