Skip to content

Commit d2293de

Browse files
committed
compare only credId when comparing rk creds to allowList
1 parent 02c623b commit d2293de

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

fido2/ctap.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,11 @@ static int is_matching_rk(CTAP_residentKey * rk, CTAP_residentKey * rk2)
443443
(rk->user.id_size == rk2->user.id_size);
444444
}
445445

446+
static int is_cred_id_matching_rk(CredentialId * credId, CTAP_residentKey * rk)
447+
{
448+
return (memcmp(credId, &rk->id, sizeof(CredentialId)) == 0);
449+
}
450+
446451
static int ctap_make_extensions(CTAP_extensions * ext, uint8_t * ext_encoder_buf, unsigned int * ext_encoder_buf_size)
447452
{
448453
CborEncoder extensions;
@@ -1147,7 +1152,7 @@ static void add_existing_user_info(CTAP_credentialDescriptor * cred)
11471152
for (i = 0; i < index; i++)
11481153
{
11491154
load_nth_valid_rk(i, &rk);
1150-
if (is_matching_rk(&rk, (CTAP_residentKey *)&cred->credential))
1155+
if (is_cred_id_matching_rk(&cred->credential.id, &rk))
11511156
{
11521157
printf1(TAG_GREEN, "found rk match for allowList item (%d)\r\n", i);
11531158
memmove(&cred->credential.user, &rk.user, sizeof(CTAP_userEntity));

fido2/ctap_parse.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,7 @@ uint8_t parse_allow_list(CTAP_getAssertion * GA, CborValue * it)
997997
GA->credLen += 1;
998998
cred = &GA->creds[i];
999999

1000+
memset(cred, 0, sizeof(CTAP_credentialDescriptor));
10001001
ret = parse_credential_descriptor(&arr,cred);
10011002
check_retr(ret);
10021003

0 commit comments

Comments
 (0)