Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-27 09:37:30

0001 /**
0002  * \file mbedtls/config_adjust_psa_superset_legacy.h
0003  * \brief Adjust PSA configuration: automatic enablement from legacy
0004  *
0005  * This is an internal header. Do not include it directly.
0006  *
0007  * To simplify some edge cases, we automatically enable certain cryptographic
0008  * mechanisms in the PSA API if they are enabled in the legacy API. The general
0009  * idea is that if legacy module M uses mechanism A internally, and A has
0010  * both a legacy and a PSA implementation, we enable A through PSA whenever
0011  * it's enabled through legacy. This facilitates the transition to PSA
0012  * implementations of A for users of M.
0013  */
0014 /*
0015  *  Copyright The Mbed TLS Contributors
0016  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
0017  */
0018 
0019 #ifndef MBEDTLS_CONFIG_ADJUST_PSA_SUPERSET_LEGACY_H
0020 #define MBEDTLS_CONFIG_ADJUST_PSA_SUPERSET_LEGACY_H
0021 
0022 #if !defined(MBEDTLS_CONFIG_FILES_READ)
0023 #error "Do not include mbedtls/config_adjust_*.h manually! This can lead to problems, " \
0024     "up to and including runtime errors such as buffer overflows. " \
0025     "If you're trying to fix a complaint from check_config.h, just remove " \
0026     "it from your configuration file: since Mbed TLS 3.0, it is included " \
0027     "automatically at the right point."
0028 #endif /* */
0029 
0030 /****************************************************************/
0031 /* Hashes that are built in are also enabled in PSA.
0032  * This simplifies dependency declarations especially
0033  * for modules that obey MBEDTLS_USE_PSA_CRYPTO. */
0034 /****************************************************************/
0035 
0036 #if defined(MBEDTLS_MD5_C)
0037 #define PSA_WANT_ALG_MD5 1
0038 #endif
0039 
0040 #if defined(MBEDTLS_RIPEMD160_C)
0041 #define PSA_WANT_ALG_RIPEMD160 1
0042 #endif
0043 
0044 #if defined(MBEDTLS_SHA1_C)
0045 #define PSA_WANT_ALG_SHA_1 1
0046 #endif
0047 
0048 #if defined(MBEDTLS_SHA224_C)
0049 #define PSA_WANT_ALG_SHA_224 1
0050 #endif
0051 
0052 #if defined(MBEDTLS_SHA256_C)
0053 #define PSA_WANT_ALG_SHA_256 1
0054 #endif
0055 
0056 #if defined(MBEDTLS_SHA384_C)
0057 #define PSA_WANT_ALG_SHA_384 1
0058 #endif
0059 
0060 #if defined(MBEDTLS_SHA512_C)
0061 #define PSA_WANT_ALG_SHA_512 1
0062 #endif
0063 
0064 #if defined(MBEDTLS_SHA3_C)
0065 #define PSA_WANT_ALG_SHA3_224 1
0066 #define PSA_WANT_ALG_SHA3_256 1
0067 #define PSA_WANT_ALG_SHA3_384 1
0068 #define PSA_WANT_ALG_SHA3_512 1
0069 #endif
0070 
0071 /* Ensure that the PSA's supported curves (PSA_WANT_ECC_xxx) are always a
0072  * superset of the builtin ones (MBEDTLS_ECP_DP_xxx). */
0073 #if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
0074 #if !defined(PSA_WANT_ECC_BRAINPOOL_P_R1_256)
0075 #define PSA_WANT_ECC_BRAINPOOL_P_R1_256 1
0076 #endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_256 */
0077 #endif /* MBEDTLS_ECP_DP_BP256R1_ENABLED */
0078 
0079 #if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)
0080 #if !defined(PSA_WANT_ECC_BRAINPOOL_P_R1_384)
0081 #define PSA_WANT_ECC_BRAINPOOL_P_R1_384 1
0082 #endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_384 */
0083 #endif /*MBEDTLS_ECP_DP_BP384R1_ENABLED  */
0084 
0085 #if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)
0086 #if !defined(PSA_WANT_ECC_BRAINPOOL_P_R1_512)
0087 #define PSA_WANT_ECC_BRAINPOOL_P_R1_512 1
0088 #endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_512 */
0089 #endif /* MBEDTLS_ECP_DP_BP512R1_ENABLED */
0090 
0091 #if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
0092 #if !defined(PSA_WANT_ECC_MONTGOMERY_255)
0093 #define PSA_WANT_ECC_MONTGOMERY_255 1
0094 #endif /* PSA_WANT_ECC_MONTGOMERY_255 */
0095 #endif /* MBEDTLS_ECP_DP_CURVE25519_ENABLED */
0096 
0097 #if defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
0098 #if !defined(PSA_WANT_ECC_MONTGOMERY_448)
0099 #define PSA_WANT_ECC_MONTGOMERY_448 1
0100 #endif /* PSA_WANT_ECC_MONTGOMERY_448 */
0101 #endif /* MBEDTLS_ECP_DP_CURVE448_ENABLED */
0102 
0103 #if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
0104 #if !defined(PSA_WANT_ECC_SECP_R1_192)
0105 #define PSA_WANT_ECC_SECP_R1_192 1
0106 #endif /* PSA_WANT_ECC_SECP_R1_192 */
0107 #endif /* MBEDTLS_ECP_DP_SECP192R1_ENABLED */
0108 
0109 #if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
0110 #if !defined(PSA_WANT_ECC_SECP_R1_224)
0111 #define PSA_WANT_ECC_SECP_R1_224 1
0112 #endif /* PSA_WANT_ECC_SECP_R1_224 */
0113 #endif /* MBEDTLS_ECP_DP_SECP224R1_ENABLED */
0114 
0115 #if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
0116 #if !defined(PSA_WANT_ECC_SECP_R1_256)
0117 #define PSA_WANT_ECC_SECP_R1_256 1
0118 #endif /* PSA_WANT_ECC_SECP_R1_256 */
0119 #endif /* MBEDTLS_ECP_DP_SECP256R1_ENABLED */
0120 
0121 #if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
0122 #if !defined(PSA_WANT_ECC_SECP_R1_384)
0123 #define PSA_WANT_ECC_SECP_R1_384 1
0124 #endif /* PSA_WANT_ECC_SECP_R1_384 */
0125 #endif /* MBEDTLS_ECP_DP_SECP384R1_ENABLED */
0126 
0127 #if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
0128 #if !defined(PSA_WANT_ECC_SECP_R1_521)
0129 #define PSA_WANT_ECC_SECP_R1_521 1
0130 #endif /* PSA_WANT_ECC_SECP_R1_521 */
0131 #endif /* MBEDTLS_ECP_DP_SECP521R1_ENABLED */
0132 
0133 #if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED)
0134 #if !defined(PSA_WANT_ECC_SECP_K1_192)
0135 #define PSA_WANT_ECC_SECP_K1_192 1
0136 #endif /* PSA_WANT_ECC_SECP_K1_192 */
0137 #endif /* MBEDTLS_ECP_DP_SECP192K1_ENABLED */
0138 
0139 /* SECP224K1 is buggy via the PSA API (https://github.com/Mbed-TLS/mbedtls/issues/3541) */
0140 #if 0 && defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
0141 #if !defined(PSA_WANT_ECC_SECP_K1_224)
0142 #define PSA_WANT_ECC_SECP_K1_224 1
0143 #endif /* PSA_WANT_ECC_SECP_K1_224 */
0144 #endif /* MBEDTLS_ECP_DP_SECP224K1_ENABLED */
0145 
0146 #if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
0147 #if !defined(PSA_WANT_ECC_SECP_K1_256)
0148 #define PSA_WANT_ECC_SECP_K1_256 1
0149 #endif /* PSA_WANT_ECC_SECP_K1_256 */
0150 #endif /* MBEDTLS_ECP_DP_SECP256K1_ENABLED */
0151 
0152 #endif /* MBEDTLS_CONFIG_ADJUST_PSA_SUPERSET_LEGACY_H */