From 94806f9bf05cfd1e99061159c7ed05917464077d Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Sat, 24 Dec 2022 00:49:50 +0100 Subject: [PATCH] Digits shall be returned in all cases. Signed-off-by: Pol Henarejos --- src/fido/oath.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fido/oath.c b/src/fido/oath.c index dea4fdc..dc11c20 100644 --- a/src/fido/oath.c +++ b/src/fido/oath.c @@ -336,17 +336,20 @@ int cmd_calculate_all() { memcpy(res_APDU+res_APDU_size, name, name_len); res_APDU_size += name_len; if ((key[0] & OATH_TYPE_MASK) == OATH_TYPE_HOTP) { res_APDU[res_APDU_size++] = TAG_NO_RESPONSE; - res_APDU[res_APDU_size++] = 0; + res_APDU[res_APDU_size++] = 1; + res_APDU[res_APDU_size++] = key[1]; } else if (asn1_find_tag(ef_data, ef_len, TAG_PROPERTY, &prop_len, &prop) == true && (prop[0] & PROP_TOUCH)) { res_APDU[res_APDU_size++] = TAG_TOUCH_RESPONSE; - res_APDU[res_APDU_size++] = 0; + res_APDU[res_APDU_size++] = 1; + res_APDU[res_APDU_size++] = key[1]; } else { res_APDU[res_APDU_size++] = TAG_RESPONSE + P2(apdu); int ret = calculate_oath(P2(apdu), key, key_len, chal, chal_len); if (ret != CCID_OK) { - res_APDU[res_APDU_size++] = 0; + res_APDU[res_APDU_size++] = 1; + res_APDU[res_APDU_size++] = key[1]; } } }