From 64e0184a39625f91a0c7090eb5e647a159d84e34 Mon Sep 17 00:00:00 2001 From: valerio Date: Wed, 31 May 2023 12:02:43 +0200 Subject: [PATCH] psa_util: add support for rfc8410's OIDs Signed-off-by: valerio --- include/mbedtls/psa_util.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/mbedtls/psa_util.h b/include/mbedtls/psa_util.h index f7ed2ebfe..64c24358e 100644 --- a/include/mbedtls/psa_util.h +++ b/include/mbedtls/psa_util.h @@ -248,6 +248,22 @@ static inline int mbedtls_psa_get_ecc_oid_from_id( #endif /* MBEDTLS_ECP_DP_BP512R1_ENABLED */ } break; + case PSA_ECC_FAMILY_MONTGOMERY: + switch (bits) { +#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) + case 255: + *oid = MBEDTLS_OID_X25519; + *oid_len = MBEDTLS_OID_SIZE(MBEDTLS_OID_X25519); + return 0; +#endif /* MBEDTLS_ECP_DP_CURVE25519_ENABLED */ +#if defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) + case 448: + *oid = MBEDTLS_OID_X448; + *oid_len = MBEDTLS_OID_SIZE(MBEDTLS_OID_X448); + return 0; +#endif /* MBEDTLS_ECP_DP_CURVE448_ENABLED */ + } + break; } (void) oid; (void) oid_len;