Update defines for ECC PSA configs

Use the names as described in
`docs/proposed/psa-conditional-inclusion-c.md which use a transform
like: SECP256R1 -> SECP_R1_256.  The CURVE25519 and CURVE448 become
MONTGOMERY_255 and MONTGOMERY_448.

Signed-off-by: David Brown <david.brown@linaro.org>
This commit is contained in:
David Brown 2021-02-19 21:05:52 -07:00
parent 20a8c4305a
commit c7b9b2b6d6

View file

@ -355,89 +355,96 @@ extern "C" {
#endif /* PSA_WANT_KEY_TYPE_CHACHA20 */
#endif /* PSA_WANT_ALG_CHACHA20_POLY1305 */
#if defined(PSA_WANT_ECC_SECP192R1)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP192R1)
#if defined(PSA_WANT_ECC_SECP_R1_192)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192)
#define MBEDTLS_ECP_DP_SECP192R1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_192 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192 */
#endif /* PSA_WANT_ECC_SECP_R1_192 */
#if defined(PSA_WANT_ECC_SECP_R1_224)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224)
#define MBEDTLS_ECP_DP_SECP224R1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_224 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224 */
#endif /* PSA_WANT_ECC_SECP_R1_224 */
#if defined(PSA_WANT_ECC_SECP_R1_256)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256)
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_256 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256 */
#endif /* PSA_WANT_ECC_SECP_R1_256 */
#if defined(PSA_WANT_ECC_SECP_R1_384)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384)
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_384 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384 */
#endif /* PSA_WANT_ECC_SECP_R1_384 */
#if defined(PSA_WANT_ECC_SECP_R1_521)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521)
#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_521 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521 */
#endif /* PSA_WANT_ECC_SECP_R1_521 */
#if defined(PSA_WANT_ECC_SECP_K1_192)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192)
#define MBEDTLS_ECP_DP_SECP192K1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_SECP192R1 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP192R1 */
#endif /* PSA_WANT_ECC_SECP192R1 */
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_192 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192 */
#endif /* PSA_WANT_ECC_SECP_K1_192 */
#if defined(PSA_WANT_ECC_SECP224R1)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP224R1)
#if defined(PSA_WANT_ECC_SECP_K1_224)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224)
#define MBEDTLS_ECP_DP_SECP224K1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_SECP224R1 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP224R1 */
#endif /* PSA_WANT_ECC_SECP224R1 */
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_224 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224 */
#endif /* PSA_WANT_ECC_SECP_K1_224 */
#if defined(PSA_WANT_ECC_SECP256R1)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP256R1)
#define MBEDTLS_ECP_DP_SECP256K1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_SECP256R1 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP256R1 */
#endif /* PSA_WANT_ECC_SECP256R1 */
#if defined(PSA_WANT_ECC_SECP_K1_256)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256)
#define MBEDTLS_ECP_DP_SEC256K1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_256 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256 */
#endif /* PSA_WANT_ECC_SECP_K1_256 */
#if defined(PSA_WANT_ECC_SECP384R1)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP384R1)
#define MBEDTLS_ECP_DP_SECP384K1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_SECP384R1 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP384R1 */
#endif /* PSA_WANT_ECC_SECP384R1 */
#if defined(PSA_WANT_ECC_BP_R1_256)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BP_R1_256)
#define MBEDTLS_ECP_DP_BP256R1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_BP_R1_256 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_BP_R1_256 */
#endif /* PSA_WANT_ECC_BP_R1_256 */
#if defined(PSA_WANT_ECC_SECP521R1)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP521R1)
#define MBEDTLS_ECP_DP_SECP521K1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_SECP521R1 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP521R1 */
#endif /* PSA_WANT_ECC_SECP521R1 */
#if defined(PSA_WANT_ECC_BP_R1_384)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BP_R1_384)
#define MBEDTLS_ECP_DP_BP384R1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_BP_R1_384 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_BP_R1_384 */
#endif /* PSA_WANT_ECC_BP_R1_384 */
#if defined(PSA_WANT_ECC_SECP192K1)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP192K1)
#define MBEDTLS_ECP_DP_SECP521K1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_SECP192K1 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP192K1 */
#endif /* PSA_WANT_ECC_SECP192K1 */
#if defined(PSA_WANT_ECC_BP_R1_512)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BP_R1_512)
#define MBEDTLS_ECP_DP_BP512R1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_BP_R1_512 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_BP_R1_512 */
#endif /* PSA_WANT_ECC_BP_R1_512 */
#if defined(PSA_WANT_ECC_SECP224K1)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP224K1)
#define MBEDTLS_ECP_DP_SECP521K1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_SECP224K1 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP224K1 */
#endif /* PSA_WANT_ECC_SECP224K1 */
#if defined(PSA_WANT_ECC_MONTGOMERY_255)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255)
#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_255 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255 */
#endif /* PSA_WANT_ECC_MONTGOMERY_255 */
#if defined(PSA_WANT_ECC_BP256R1)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BP256R1)
#define MBEDTLS_ECP_DP_SECP521K1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_BP256R1 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_BP256R1 */
#endif /* PSA_WANT_ECC_BP256R1 */
#if defined(PSA_WANT_ECC_BP384R1)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BP384R1)
#define MBEDTLS_ECP_DP_SECP521K1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_BP384R1 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_BP384R1 */
#endif /* PSA_WANT_ECC_BP384R1 */
#if defined(PSA_WANT_ECC_BP512R1)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BP512R1)
#define MBEDTLS_ECP_DP_SECP521K1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_BP512R1 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_BP512R1 */
#endif /* PSA_WANT_ECC_BP512R1 */
#if defined(PSA_WANT_ECC_CURVE25519)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_CURVE25519)
#define MBEDTLS_ECP_DP_SECP521K1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_CURVE25519 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_CURVE25519 */
#endif /* PSA_WANT_ECC_CURVE25519 */
#if defined(PSA_WANT_ECC_CURVE448)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_CURVE448)
#define MBEDTLS_ECP_DP_SECP521K1_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_CURVE448 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_CURVE448 */
#endif /* PSA_WANT_ECC_CURVE448 */
#if defined(PSA_WANT_ECC_MONTGOMERY_448)
#if !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448)
#define MBEDTLS_ECP_DP_CURVE448_ENABLED
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_448 1
#endif /* !MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448 */
#endif /* PSA_WANT_ECC_MONTGOMERY_448 */
#else /* MBEDTLS_PSA_CRYPTO_CONFIG */
@ -616,68 +623,68 @@ extern "C" {
#endif
#if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP192R1 1
#define PSA_WANT_ECC_SECP192R1
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_192 1
#define PSA_WANT_ECC_SECP_R1_192
#endif
#if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP224R1 1
#define PSA_WANT_ECC_SECP224R1
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_224 1
#define PSA_WANT_ECC_SECP_R1_224
#endif
#if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP256R1 1
#define PSA_WANT_ECC_SECP256R1
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_256 1
#define PSA_WANT_ECC_SECP_R1_256
#endif
#if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP384R1 1
#define PSA_WANT_ECC_SECP384R1
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_384 1
#define PSA_WANT_ECC_SECP_R1_384
#endif
#if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP521R1 1
#define PSA_WANT_ECC_SECP521R1
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_521 1
#define PSA_WANT_ECC_SECP_R1_521
#endif
#if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP192K1 1
#define PSA_WANT_ECC_SECP192K1
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_192 1
#define PSA_WANT_ECC_SECP_K1_192
#endif
#if defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP224K1 1
#define PSA_WANT_ECC_SECP224K1
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_224 1
#define PSA_WANT_ECC_SECP_K1_224
#endif
#if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP256K1 1
#define PSA_WANT_ECC_SECP256K1
#if defined(MBEDTLS_ECP_DP_SEC256K1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_256 1
#define PSA_WANT_ECC_SECP_K1_256
#endif
#if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_BP256R1 1
#define PSA_WANT_ECC_BP256R1
#define MBEDTLS_PSA_BUILTIN_ECC_BP_R1_256 1
#define PSA_WANT_ECC_BP_R1_256
#endif
#if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_BP384R1 1
#define PSA_WANT_ECC_BP384R1
#define MBEDTLS_PSA_BUILTIN_ECC_BP_R1_384 1
#define PSA_WANT_ECC_BP_R1_384
#endif
#if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_BP512R1 1
#define PSA_WANT_ECC_BP512R1
#define MBEDTLS_PSA_BUILTIN_ECC_BP_R1_512 1
#define PSA_WANT_ECC_BP_R1_512
#endif
#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_CURVE25519 1
#define PSA_WANT_ECC_CURVE25519
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_255 1
#define PSA_WANT_ECC_MONTGOMERY_255
#endif
#if defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_CURVE448 1
#define PSA_WANT_ECC_CURVE448
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_448 1
#define PSA_WANT_ECC_MONTGOMERY_448
#endif
#endif /* MBEDTLS_PSA_CRYPTO_CONFIG */