1 /**
2  * \file psa/crypto_adjust_config_dependencies.h
3  * \brief Adjust PSA configuration by resolving some dependencies.
4  *
5  * This is an internal header. Do not include it directly.
6  *
7  * See docs/proposed/psa-conditional-inclusion-c.md.
8  * If the Mbed TLS implementation of a cryptographic mechanism A depends on a
9  * cryptographic mechanism B then if the cryptographic mechanism A is enabled
10  * and not accelerated enable B. Note that if A is enabled and accelerated, it
11  * is not necessary to enable B for A support.
12  */
13 /*
14  *  Copyright The Mbed TLS Contributors
15  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
16  */
17 
18 #ifndef PSA_CRYPTO_ADJUST_CONFIG_DEPENDENCIES_H
19 #define PSA_CRYPTO_ADJUST_CONFIG_DEPENDENCIES_H
20 
21 #if !defined(MBEDTLS_CONFIG_FILES_READ)
22 #error "Do not include psa/crypto_adjust_*.h manually! This can lead to problems, " \
23     "up to and including runtime errors such as buffer overflows. " \
24     "If you're trying to fix a complaint from check_config.h, just remove " \
25     "it from your configuration file: since Mbed TLS 3.0, it is included " \
26     "automatically at the right point."
27 #endif /* */
28 
29 #if (defined(PSA_WANT_ALG_TLS12_PRF) && \
30     !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF)) || \
31     (defined(PSA_WANT_ALG_TLS12_PSK_TO_MS) && \
32     !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS)) || \
33     (defined(PSA_WANT_ALG_HKDF) && \
34     !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF)) || \
35     (defined(PSA_WANT_ALG_HKDF_EXTRACT) && \
36     !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF_EXTRACT)) || \
37     (defined(PSA_WANT_ALG_HKDF_EXPAND) && \
38     !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF_EXPAND)) || \
39     (defined(PSA_WANT_ALG_PBKDF2_HMAC) && \
40     !defined(MBEDTLS_PSA_ACCEL_ALG_PBKDF2_HMAC))
41 #define PSA_WANT_ALG_HMAC 1
42 #define PSA_WANT_KEY_TYPE_HMAC 1
43 #endif
44 
45 #if (defined(PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128) && \
46     !defined(MBEDTLS_PSA_ACCEL_ALG_PBKDF2_AES_CMAC_PRF_128))
47 #define PSA_WANT_KEY_TYPE_AES 1
48 #define PSA_WANT_ALG_CMAC 1
49 #endif
50 
51 #endif /* PSA_CRYPTO_ADJUST_CONFIG_DEPENDENCIES_H */
52