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.
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 79db686..1120c83 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -427,7 +427,8 @@
 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: