Skip to content

Commit

Permalink
reorder keys in the extension map
Browse files Browse the repository at this point in the history
  • Loading branch information
z4yx committed Aug 9, 2023
1 parent 01e66ca commit 2b91795
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions applets/ctap/ctap.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,25 +432,13 @@ static uint8_t ctap_make_credential(CborEncoder *encoder, uint8_t *params, size_
(mc.ext_cred_protect > 0 ? 1 : 0) +
(mc.ext_has_cred_blob ? 1 : 0));
CHECK_CBOR_RET(ret);
if (mc.ext_hmac_secret) {
ret = cbor_encode_text_stringz(&map, "hmac-secret");
CHECK_CBOR_RET(ret);
ret = cbor_encode_boolean(&map, true);
CHECK_CBOR_RET(ret);
}
if (mc.ext_large_blob_key) {
if (mc.options.rk != OPTION_TRUE) {
DBG_MSG("largeBlobKey requires rk\n");
return CTAP2_ERR_INVALID_OPTION;
}
// Generate key in Step 17
}
if (mc.ext_cred_protect > 0) {
ret = cbor_encode_text_stringz(&map, "credProtect");
CHECK_CBOR_RET(ret);
ret = cbor_encode_int(&map, mc.ext_cred_protect);
CHECK_CBOR_RET(ret);
}
if (mc.ext_has_cred_blob) {
bool accepted = false;
if (mc.ext_cred_blob_len <= MAX_CRED_BLOB_LENGTH && mc.options.rk == OPTION_TRUE) {
Expand All @@ -461,6 +449,18 @@ static uint8_t ctap_make_credential(CborEncoder *encoder, uint8_t *params, size_
ret = cbor_encode_boolean(&map, accepted);
CHECK_CBOR_RET(ret);
}
if (mc.ext_cred_protect > 0) {
ret = cbor_encode_text_stringz(&map, "credProtect");
CHECK_CBOR_RET(ret);
ret = cbor_encode_int(&map, mc.ext_cred_protect);
CHECK_CBOR_RET(ret);
}
if (mc.ext_hmac_secret) {
ret = cbor_encode_text_stringz(&map, "hmac-secret");
CHECK_CBOR_RET(ret);
ret = cbor_encode_boolean(&map, true);
CHECK_CBOR_RET(ret);
}
ret = cbor_encoder_close_container(&extension_encoder, &map);
CHECK_CBOR_RET(ret);
size_t extension_size = cbor_encoder_get_buffer_size(&extension_encoder, extension_buffer);
Expand Down

0 comments on commit 2b91795

Please sign in to comment.