blob: 0ba32bfe0dd2834f181a09f944e9f32eedea3d21 [file] [log] [blame]
John Durkopb6f7afc2020-11-12 11:36:06 -08001/**
2 * \file check_crypto_config.h
3 *
4 * \brief Consistency checks for PSA configuration options
5 */
6/*
7 * Copyright The Mbed TLS Contributors
Dave Rodgman7ff79652023-11-03 12:04:52 +00008 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
John Durkopb6f7afc2020-11-12 11:36:06 -08009 */
10
11/*
12 * It is recommended to include this file from your crypto_config.h
13 * in order to catch dependency issues early.
14 */
15
16#ifndef MBEDTLS_CHECK_CRYPTO_CONFIG_H
17#define MBEDTLS_CHECK_CRYPTO_CONFIG_H
18
Ronald Cron3d471812021-03-18 13:40:31 +010019#if defined(PSA_WANT_ALG_CCM) && \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010020 !(defined(PSA_WANT_KEY_TYPE_AES) || \
21 defined(PSA_WANT_KEY_TYPE_CAMELLIA))
Ronald Cron3d471812021-03-18 13:40:31 +010022#error "PSA_WANT_ALG_CCM defined, but not all prerequisites"
23#endif
24
25#if defined(PSA_WANT_ALG_CMAC) && \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010026 !(defined(PSA_WANT_KEY_TYPE_AES) || \
27 defined(PSA_WANT_KEY_TYPE_CAMELLIA) || \
28 defined(PSA_WANT_KEY_TYPE_DES))
Ronald Cron3d471812021-03-18 13:40:31 +010029#error "PSA_WANT_ALG_CMAC defined, but not all prerequisites"
30#endif
31
John Durkopb6f7afc2020-11-12 11:36:06 -080032#if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA) && \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010033 !(defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) || \
34 defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY))
John Durkopb6f7afc2020-11-12 11:36:06 -080035#error "PSA_WANT_ALG_DETERMINISTIC_ECDSA defined, but not all prerequisites"
36#endif
37
38#if defined(PSA_WANT_ALG_ECDSA) && \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010039 !(defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) || \
40 defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY))
John Durkopb6f7afc2020-11-12 11:36:06 -080041#error "PSA_WANT_ALG_ECDSA defined, but not all prerequisites"
42#endif
43
Ronald Cron3d471812021-03-18 13:40:31 +010044#if defined(PSA_WANT_ALG_GCM) && \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010045 !(defined(PSA_WANT_KEY_TYPE_AES) || \
46 defined(PSA_WANT_KEY_TYPE_CAMELLIA))
Ronald Cron3d471812021-03-18 13:40:31 +010047#error "PSA_WANT_ALG_GCM defined, but not all prerequisites"
48#endif
49
John Durkopb6f7afc2020-11-12 11:36:06 -080050#if defined(PSA_WANT_ALG_RSA_PKCS1V15_CRYPT) && \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010051 !(defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \
52 defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY))
John Durkopb6f7afc2020-11-12 11:36:06 -080053#error "PSA_WANT_ALG_RSA_PKCS1V15_CRYPT defined, but not all prerequisites"
54#endif
55
56#if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) && \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010057 !(defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \
58 defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY))
John Durkopb6f7afc2020-11-12 11:36:06 -080059#error "PSA_WANT_ALG_RSA_PKCS1V15_SIGN defined, but not all prerequisites"
60#endif
61
62#if defined(PSA_WANT_ALG_RSA_OAEP) && \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010063 !(defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \
64 defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY))
John Durkopb6f7afc2020-11-12 11:36:06 -080065#error "PSA_WANT_ALG_RSA_OAEP defined, but not all prerequisites"
66#endif
67
68#if defined(PSA_WANT_ALG_RSA_PSS) && \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010069 !(defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \
70 defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY))
John Durkopb6f7afc2020-11-12 11:36:06 -080071#error "PSA_WANT_ALG_RSA_PSS defined, but not all prerequisites"
72#endif
73
John Durkop07cc04a2020-11-16 22:08:34 -080074#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) && \
75 !defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
76#error "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR defined, but not all prerequisites"
77#endif
78
John Durkopb6f7afc2020-11-12 11:36:06 -080079#endif /* MBEDTLS_CHECK_CRYPTO_CONFIG_H */