From ec612a451da5e8cbee61de866dd273f214e6cd5c Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Fri, 13 Sep 2024 21:03:34 +0200 Subject: [PATCH] Fix ssh-keygen creation. Fixes #59 Signed-off-by: Pol Henarejos --- src/fido/cbor.c | 9 +++++++-- src/fido/cbor_make_credential.c | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/fido/cbor.c b/src/fido/cbor.c index cddde7e..68842b7 100644 --- a/src/fido/cbor.c +++ b/src/fido/cbor.c @@ -120,8 +120,13 @@ void cbor_thread(void) { DEBUG_DATA(res_APDU + 1, res_APDU_size); } else { - res_APDU[0] = apdu.sw; - //apdu.sw = 0; + if (apdu.sw >= CTAP1_ERR_INVALID_CHANNEL) { + res_APDU[-1] = apdu.sw; + apdu.sw = 0; + } + else { + res_APDU[0] = apdu.sw; + } } finished_data_size = res_APDU_size + 1; diff --git a/src/fido/cbor_make_credential.c b/src/fido/cbor_make_credential.c index 1c3f6e5..e522d3f 100644 --- a/src/fido/cbor_make_credential.c +++ b/src/fido/cbor_make_credential.c @@ -45,7 +45,7 @@ int cbor_make_credential(const uint8_t *data, size_t len) { CredExtensions extensions = { 0 }; //options.present = true; //options.up = ptrue; - //options.uv = pfalse; + options.uv = pfalse; //options.rk = pfalse; CBOR_CHECK(cbor_parser_init(data, len, 0, &parser, &map)); @@ -246,7 +246,7 @@ int cbor_make_credential(const uint8_t *data, size_t len) { //else if (options.up == NULL) //5.7 //rup = ptrue; } - if (pinUvAuthParam.present == false && options.uv != ptrue && file_has_data(ef_pin)) { //8.1 + if (pinUvAuthParam.present == false && options.uv == pfalse && file_has_data(ef_pin)) { //8.1 CBOR_ERROR(CTAP2_ERR_PUAT_REQUIRED); } if (enterpriseAttestation > 0) {