1 /*
2  * Copyright (c) 2022, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 #ifndef __CRYPTO_CHECK_CONFIG_H__
8 #define __CRYPTO_CHECK_CONFIG_H__
9 
10 #include "config_tfm.h"
11 
12 #if CRYPTO_RNG_MODULE_ENABLED  && \
13     (!defined(MBEDTLS_CTR_DRBG_C) &&            \
14      !defined(MBEDTLS_HMAC_DRBG_C) &&           \
15      !defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG))
16 #error "CRYPTO_RNG_MODULE_ENABLED enables, but not all prerequisites (missing RNG)!"
17 #endif
18 
19 #if CRYPTO_AEAD_MODULE_ENABLED &&                 \
20     (!defined(PSA_WANT_ALG_CCM) && !defined(PSA_WANT_ALG_GCM) && \
21      !defined(PSA_WANT_ALG_CHACHA20_POLY1305))
22 #error "CRYPTO_AEAD_MODULE_ENABLED enables, but not all prerequisites (missing AEAD algorithms)!"
23 #endif
24 
25 #if CRYPTO_MAC_MODULE_ENABLED && \
26     (!defined(PSA_WANT_ALG_CMAC) && !defined(PSA_WANT_ALG_HMAC))
27 #error "CRYPTO_MAC_MODULE_ENABLED enables, but not all prerequisites (missing MAC algorithms)!"
28 #endif
29 
30 #if CRYPTO_CIPHER_MODULE_ENABLED && \
31     (!defined(PSA_WANT_KEY_TYPE_AES) &&            \
32      !defined(PSA_WANT_KEY_TYPE_CHACHA20) &&       \
33      !defined(PSA_WANT_ALG_CBC_NO_PADDING) &&      \
34      !defined(PSA_WANT_ALG_CBC_PKCS7) &&           \
35      !defined(PSA_WANT_ALG_CCM) &&                 \
36      !defined(PSA_WANT_ALG_GCM))
37 #error "CRYPTO_CIPHER_MODULE_ENABLED enables, but not all prerequisites (missing CIPHER algorithms)!"
38 #endif
39 
40 #if CRYPTO_HASH_MODULE_ENABLED && \
41     (!defined(PSA_WANT_ALG_RIPEMD160) &&         \
42      !defined(PSA_WANT_ALG_SHA_224) &&           \
43      !defined(PSA_WANT_ALG_SHA_256) &&           \
44      !defined(PSA_WANT_ALG_SHA_384) &&           \
45      !defined(PSA_WANT_ALG_SHA_512))
46 #error "CRYPTO_HASH_MODULE_ENABLED enables, but not all prerequisites (missing HASH algorithms)!"
47 #endif
48 
49 #if CRYPTO_ASYM_SIGN_MODULE_ENABLED && \
50     (!defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) && \
51      !defined(PSA_WANT_ALG_RSA_PSS) && \
52      !defined(PSA_WANT_ALG_ECDSA) && \
53      !defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA))
54 #error "CRYPTO_ASYM_SIGN_MODULE_ENABLED enables, but not all prerequisites (missing asymmetric sign algorithms)!"
55 #endif
56 
57 #if CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED && \
58     (!defined(PSA_WANT_ALG_RSA_PKCS1V15_CRYPT) && \
59      !defined(PSA_WANT_ALG_RSA_OAEP))
60 #error "CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED enables, but not all prerequisites (missing asymmetric encryption algorithms)!"
61 #endif
62 
63 #if CRYPTO_KEY_DERIVATION_MODULE_ENABLED && \
64     (!defined(PSA_WANT_ALG_HKDF) && \
65      !defined(PSA_WANT_ALG_TLS12_PRF) && \
66      !defined(PSA_WANT_ALG_TLS12_PSK_TO_MS))
67 #error "CRYPTO_KEY_DERIVATION_MODULE_ENABLED enables, but not all prerequisites (missing key derivation algorithms)!"
68 #endif
69 
70 #endif /* __CRYPTO_CHECK_CONFIG_H__ */
71