@@ -231,21 +231,36 @@ int cbor_make_credential(const uint8_t *data, size_t len) {
231231 if (strcmp (pubKeyCredParams [i ].type .data , "public-key" ) != 0 ) {
232232 CBOR_ERROR (CTAP2_ERR_CBOR_UNEXPECTED_TYPE );
233233 }
234- if (pubKeyCredParams [i ].alg == FIDO2_ALG_ES256 ) {
234+ if (pubKeyCredParams [i ].alg == FIDO2_ALG_ES256 || pubKeyCredParams [ i ]. alg == FIDO2_ALG_ESP256 ) {
235235 if (curve <= 0 ) {
236236 curve = FIDO2_CURVE_P256 ;
237237 }
238238 }
239- else if (pubKeyCredParams [i ].alg == FIDO2_ALG_ES384 ) {
239+ else if (pubKeyCredParams [i ].alg == FIDO2_ALG_ES384 || pubKeyCredParams [ i ]. alg == FIDO2_ALG_ESP384 ) {
240240 if (curve <= 0 ) {
241241 curve = FIDO2_CURVE_P384 ;
242242 }
243243 }
244- else if (pubKeyCredParams [i ].alg == FIDO2_ALG_ES512 ) {
244+ else if (pubKeyCredParams [i ].alg == FIDO2_ALG_ES512 || pubKeyCredParams [ i ]. alg == FIDO2_ALG_ESP512 ) {
245245 if (curve <= 0 ) {
246246 curve = FIDO2_CURVE_P521 ;
247247 }
248248 }
249+ else if (pubKeyCredParams [i ].alg == FIDO2_ALG_ESB256 ) {
250+ if (curve <= 0 ) {
251+ curve = FIDO2_CURVE_BP256R1 ;
252+ }
253+ }
254+ else if (pubKeyCredParams [i ].alg == FIDO2_ALG_ESB384 ) {
255+ if (curve <= 0 ) {
256+ curve = FIDO2_CURVE_BP384R1 ;
257+ }
258+ }
259+ else if (pubKeyCredParams [i ].alg == FIDO2_ALG_ESB512 ) {
260+ if (curve <= 0 ) {
261+ curve = FIDO2_CURVE_BP512R1 ;
262+ }
263+ }
249264 else if (pubKeyCredParams [i ].alg == FIDO2_ALG_ES256K
250265#ifndef ENABLE_EMULATION
251266 && (phy_data .enabled_curves & PHY_CURVE_SECP256K1 )
@@ -256,11 +271,16 @@ int cbor_make_credential(const uint8_t *data, size_t len) {
256271 }
257272 }
258273#ifdef MBEDTLS_EDDSA_C
259- else if (pubKeyCredParams [i ].alg == FIDO2_ALG_EDDSA ) {
274+ else if (pubKeyCredParams [i ].alg == FIDO2_ALG_EDDSA || pubKeyCredParams [ i ]. alg == FIDO2_ALG_ED25519 ) {
260275 if (curve <= 0 ) {
261276 curve = FIDO2_CURVE_ED25519 ;
262277 }
263278 }
279+ else if (pubKeyCredParams [i ].alg == FIDO2_ALG_ED448 ) {
280+ if (curve <= 0 ) {
281+ curve = FIDO2_CURVE_ED448 ;
282+ }
283+ }
264284#endif
265285 else if (pubKeyCredParams [i ].alg <= FIDO2_ALG_RS256 && pubKeyCredParams [i ].alg >= FIDO2_ALG_RS512 ) {
266286 // pass
@@ -327,9 +347,7 @@ int cbor_make_credential(const uint8_t *data, size_t len) {
327347 continue ;
328348 }
329349 Credential ecred = {0 };
330- if (credential_load (excludeList [e ].id .data , excludeList [e ].id .len , rp_id_hash ,
331- & ecred ) == 0 &&
332- (ecred .extensions .credProtect != CRED_PROT_UV_REQUIRED ||
350+ if (credential_load (excludeList [e ].id .data , excludeList [e ].id .len , rp_id_hash , & ecred ) == 0 && (ecred .extensions .credProtect != CRED_PROT_UV_REQUIRED ||
333351 (flags & FIDO2_AUT_FLAG_UV ))) {
334352 credential_free (& ecred );
335353 CBOR_ERROR (CTAP2_ERR_CREDENTIAL_EXCLUDED );
@@ -367,9 +385,7 @@ int cbor_make_credential(const uint8_t *data, size_t len) {
367385 uint8_t cred_id [MAX_CRED_ID_LENGTH ] = {0 };
368386 size_t cred_id_len = 0 ;
369387
370- CBOR_CHECK (credential_create (& rp .id , & user .id , & user .parent .name , & user .displayName , & options ,
371- & extensions , (!ka || ka -> use_sign_count == ptrue ), alg , curve ,
372- cred_id , & cred_id_len ));
388+ CBOR_CHECK (credential_create (& rp .id , & user .id , & user .parent .name , & user .displayName , & options , & extensions , (!ka || ka -> use_sign_count == ptrue ), alg , curve , cred_id , & cred_id_len ));
373389
374390 if (getUserVerifiedFlagValue ()) {
375391 flags |= FIDO2_AUT_FLAG_UV ;
@@ -523,14 +539,14 @@ int cbor_make_credential(const uint8_t *data, size_t len) {
523539 memcpy (pa , clientDataHash .data , clientDataHash .len );
524540 uint8_t hash [64 ] = {0 }, sig [MBEDTLS_ECDSA_MAX_LEN ] = {0 };
525541 const mbedtls_md_info_t * md = mbedtls_md_info_from_type (MBEDTLS_MD_SHA256 );
526- if (ekey .grp .id == MBEDTLS_ECP_DP_SECP384R1 ) {
542+ if (ekey .grp .id == MBEDTLS_ECP_DP_SECP384R1 || ekey . grp . id == MBEDTLS_ECP_DP_BP384R1 ) {
527543 md = mbedtls_md_info_from_type (MBEDTLS_MD_SHA384 );
528544 }
529- else if (ekey .grp .id == MBEDTLS_ECP_DP_SECP521R1 ) {
545+ else if (ekey .grp .id == MBEDTLS_ECP_DP_SECP521R1 || ekey . grp . id == MBEDTLS_ECP_DP_BP512R1 ) {
530546 md = mbedtls_md_info_from_type (MBEDTLS_MD_SHA512 );
531547 }
532548#ifdef MBEDTLS_EDDSA_C
533- else if (ekey .grp .id == MBEDTLS_ECP_DP_ED25519 ) {
549+ else if (ekey .grp .id == MBEDTLS_ECP_DP_ED25519 || ekey . grp . id == MBEDTLS_ECP_DP_ED448 ) {
534550 md = NULL ;
535551 }
536552#endif
0 commit comments