mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-01 10:06:53 +03:00
Rename ECC Family Macros According to PSA Spec
Rename PSA_ECC_CURVE_xxx to PSA_ECC_FAMILY_xxx, also rename PSA_KEY_TYPE_GET_CURVE to PSA_KEY_TYPE_ECC_GET_FAMILY and rename psa_ecc_curve_t to psa_ecc_family_t. Old defines are provided in include/crypto_compat.h for backward compatibility. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
@ -426,15 +426,15 @@
|
||||
#define PSA_KEY_TYPE_ECC_CURVE_MASK ((psa_key_type_t)0x00ff)
|
||||
/** Elliptic curve key pair.
|
||||
*
|
||||
* \param curve A value of type ::psa_ecc_curve_t that identifies the
|
||||
* ECC curve to be used.
|
||||
* \param curve A value of type ::psa_ecc_family_t that
|
||||
* identifies the ECC curve to be used.
|
||||
*/
|
||||
#define PSA_KEY_TYPE_ECC_KEY_PAIR(curve) \
|
||||
(PSA_KEY_TYPE_ECC_KEY_PAIR_BASE | (curve))
|
||||
/** Elliptic curve public key.
|
||||
*
|
||||
* \param curve A value of type ::psa_ecc_curve_t that identifies the
|
||||
* ECC curve to be used.
|
||||
* \param curve A value of type ::psa_ecc_family_t that
|
||||
* identifies the ECC curve to be used.
|
||||
*/
|
||||
#define PSA_KEY_TYPE_ECC_PUBLIC_KEY(curve) \
|
||||
(PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE | (curve))
|
||||
@ -453,8 +453,8 @@
|
||||
PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE)
|
||||
|
||||
/** Extract the curve from an elliptic curve key type. */
|
||||
#define PSA_KEY_TYPE_GET_CURVE(type) \
|
||||
((psa_ecc_curve_t) (PSA_KEY_TYPE_IS_ECC(type) ? \
|
||||
#define PSA_KEY_TYPE_ECC_GET_FAMILY(type) \
|
||||
((psa_ecc_family_t) (PSA_KEY_TYPE_IS_ECC(type) ? \
|
||||
((type) & PSA_KEY_TYPE_ECC_CURVE_MASK) : \
|
||||
0))
|
||||
|
||||
@ -466,7 +466,7 @@
|
||||
* _SEC 2: Recommended Elliptic Curve Domain Parameters_.
|
||||
* https://www.secg.org/sec2-v2.pdf
|
||||
*/
|
||||
#define PSA_ECC_CURVE_SECP_K1 ((psa_ecc_curve_t) 0x17)
|
||||
#define PSA_ECC_FAMILY_SECP_K1 ((psa_ecc_family_t) 0x17)
|
||||
|
||||
/** SEC random curves over prime fields.
|
||||
*
|
||||
@ -476,9 +476,9 @@
|
||||
* _SEC 2: Recommended Elliptic Curve Domain Parameters_.
|
||||
* https://www.secg.org/sec2-v2.pdf
|
||||
*/
|
||||
#define PSA_ECC_CURVE_SECP_R1 ((psa_ecc_curve_t) 0x12)
|
||||
#define PSA_ECC_FAMILY_SECP_R1 ((psa_ecc_family_t) 0x12)
|
||||
/* SECP160R2 (SEC2 v1, obsolete) */
|
||||
#define PSA_ECC_CURVE_SECP_R2 ((psa_ecc_curve_t) 0x1b)
|
||||
#define PSA_ECC_FAMILY_SECP_R2 ((psa_ecc_family_t) 0x1b)
|
||||
|
||||
/** SEC Koblitz curves over binary fields.
|
||||
*
|
||||
@ -488,7 +488,7 @@
|
||||
* _SEC 2: Recommended Elliptic Curve Domain Parameters_.
|
||||
* https://www.secg.org/sec2-v2.pdf
|
||||
*/
|
||||
#define PSA_ECC_CURVE_SECT_K1 ((psa_ecc_curve_t) 0x27)
|
||||
#define PSA_ECC_FAMILY_SECT_K1 ((psa_ecc_family_t) 0x27)
|
||||
|
||||
/** SEC random curves over binary fields.
|
||||
*
|
||||
@ -498,7 +498,7 @@
|
||||
* _SEC 2: Recommended Elliptic Curve Domain Parameters_.
|
||||
* https://www.secg.org/sec2-v2.pdf
|
||||
*/
|
||||
#define PSA_ECC_CURVE_SECT_R1 ((psa_ecc_curve_t) 0x22)
|
||||
#define PSA_ECC_FAMILY_SECT_R1 ((psa_ecc_family_t) 0x22)
|
||||
|
||||
/** SEC additional random curves over binary fields.
|
||||
*
|
||||
@ -508,7 +508,7 @@
|
||||
* _SEC 2: Recommended Elliptic Curve Domain Parameters_.
|
||||
* https://www.secg.org/sec2-v2.pdf
|
||||
*/
|
||||
#define PSA_ECC_CURVE_SECT_R2 ((psa_ecc_curve_t) 0x2b)
|
||||
#define PSA_ECC_FAMILY_SECT_R2 ((psa_ecc_family_t) 0x2b)
|
||||
|
||||
/** Brainpool P random curves.
|
||||
*
|
||||
@ -517,7 +517,7 @@
|
||||
* brainpoolP320r1, brainpoolP384r1, brainpoolP512r1.
|
||||
* It is defined in RFC 5639.
|
||||
*/
|
||||
#define PSA_ECC_CURVE_BRAINPOOL_P_R1 ((psa_ecc_curve_t) 0x30)
|
||||
#define PSA_ECC_FAMILY_BRAINPOOL_P_R1 ((psa_ecc_family_t) 0x30)
|
||||
|
||||
/** Curve25519 and Curve448.
|
||||
*
|
||||
@ -529,7 +529,7 @@
|
||||
* _Ed448-Goldilocks, a new elliptic curve_, NIST ECC Workshop, 2015.
|
||||
* The algorithm #PSA_ALG_ECDH performs X448 when used with this curve.
|
||||
*/
|
||||
#define PSA_ECC_CURVE_MONTGOMERY ((psa_ecc_curve_t) 0x41)
|
||||
#define PSA_ECC_FAMILY_MONTGOMERY ((psa_ecc_family_t) 0x41)
|
||||
|
||||
#define PSA_KEY_TYPE_DH_PUBLIC_KEY_BASE ((psa_key_type_t)0x4200)
|
||||
#define PSA_KEY_TYPE_DH_KEY_PAIR_BASE ((psa_key_type_t)0x7200)
|
||||
@ -1483,17 +1483,17 @@
|
||||
* is padded with zero bits. The byte order is either little-endian
|
||||
* or big-endian depending on the curve type.
|
||||
*
|
||||
* - For Montgomery curves (curve types `PSA_ECC_CURVE_CURVEXXX`),
|
||||
* - For Montgomery curves (curve types `PSA_ECC_FAMILY_CURVEXXX`),
|
||||
* the shared secret is the x-coordinate of `d_A Q_B = d_B Q_A`
|
||||
* in little-endian byte order.
|
||||
* The bit size is 448 for Curve448 and 255 for Curve25519.
|
||||
* - For Weierstrass curves over prime fields (curve types
|
||||
* `PSA_ECC_CURVE_SECPXXX` and `PSA_ECC_CURVE_BRAINPOOL_PXXX`),
|
||||
* `PSA_ECC_FAMILY_SECPXXX` and `PSA_ECC_FAMILY_BRAINPOOL_PXXX`),
|
||||
* the shared secret is the x-coordinate of `d_A Q_B = d_B Q_A`
|
||||
* in big-endian byte order.
|
||||
* The bit size is `m = ceiling(log_2(p))` for the field `F_p`.
|
||||
* - For Weierstrass curves over binary fields (curve types
|
||||
* `PSA_ECC_CURVE_SECTXXX`),
|
||||
* `PSA_ECC_FAMILY_SECTXXX`),
|
||||
* the shared secret is the x-coordinate of `d_A Q_B = d_B Q_A`
|
||||
* in big-endian byte order.
|
||||
* The bit size is `m` for the field `F_{2^m}`.
|
||||
|
Reference in New Issue
Block a user