1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Change the encoding of EC curves and DH groups to include the size

Change the representation of psa_ecc_curve_t and psa_dh_group_t from
the IETF 16-bit encoding to a custom 24-bit encoding where the upper 8
bits represent a curve family and the lower 16 bits are the key size
in bits. Families are based on naming and mathematical similarity,
with sufficiently precise families that no two curves in a family have
the same bit size (for example SECP-R1 and SECP-R2 are two different
families).

As a consequence, the lower 16 bits of a key type value are always
either the key size or 0.
This commit is contained in:
Gilles Peskine
2019-12-02 19:12:00 +01:00
parent d8197cb902
commit 025fccdc32
5 changed files with 45 additions and 171 deletions

View File

@ -427,7 +427,8 @@ psa_ecc_curve_t mbedtls_ecc_group_to_psa( mbedtls_ecp_group_id grpid,
mbedtls_ecp_group_id mbedtls_ecc_group_of_psa( psa_ecc_curve_t curve,
size_t byte_length )
{
(void) byte_length;
if( PSA_BITS_TO_BYTES( curve & 0xffff ) != byte_length )
return( MBEDTLS_ECP_DP_NONE );
switch( curve )
{
case PSA_ECC_CURVE_SECP192R1: