John Durkop | b6f7afc | 2020-11-12 11:36:06 -0800 | [diff] [blame] | 1 | /** |
| 2 | * \file check_crypto_config.h |
| 3 | * |
| 4 | * \brief Consistency checks for PSA configuration options |
| 5 | */ |
| 6 | /* |
| 7 | * Copyright The Mbed TLS Contributors |
| 8 | * SPDX-License-Identifier: Apache-2.0 |
| 9 | * |
| 10 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 11 | * not use this file except in compliance with the License. |
| 12 | * You may obtain a copy of the License at |
| 13 | * |
| 14 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | * |
| 16 | * Unless required by applicable law or agreed to in writing, software |
| 17 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 18 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 | * See the License for the specific language governing permissions and |
| 20 | * limitations under the License. |
| 21 | */ |
| 22 | |
| 23 | /* |
| 24 | * It is recommended to include this file from your crypto_config.h |
| 25 | * in order to catch dependency issues early. |
| 26 | */ |
| 27 | |
| 28 | #ifndef MBEDTLS_CHECK_CRYPTO_CONFIG_H |
| 29 | #define MBEDTLS_CHECK_CRYPTO_CONFIG_H |
| 30 | |
Ronald Cron | 3d47181 | 2021-03-18 13:40:31 +0100 | [diff] [blame] | 31 | #if defined(PSA_WANT_ALG_CCM) && \ |
Mateusz Starzyk | c0eabdc | 2021-08-03 14:09:02 +0200 | [diff] [blame^] | 32 | !(defined(PSA_WANT_KEY_TYPE_AES) || defined(PSA_WANT_KEY_TYPE_CAMELLIA)) |
| 33 | # error "PSA_WANT_ALG_CCM defined, but not all prerequisites" |
Ronald Cron | 3d47181 | 2021-03-18 13:40:31 +0100 | [diff] [blame] | 34 | #endif |
| 35 | |
Mateusz Starzyk | c0eabdc | 2021-08-03 14:09:02 +0200 | [diff] [blame^] | 36 | #if defined(PSA_WANT_ALG_CMAC) && \ |
| 37 | !(defined(PSA_WANT_KEY_TYPE_AES) || defined(PSA_WANT_KEY_TYPE_CAMELLIA) || \ |
| 38 | defined(PSA_WANT_KEY_TYPE_DES)) |
| 39 | # error "PSA_WANT_ALG_CMAC defined, but not all prerequisites" |
Ronald Cron | 3d47181 | 2021-03-18 13:40:31 +0100 | [diff] [blame] | 40 | #endif |
| 41 | |
John Durkop | b6f7afc | 2020-11-12 11:36:06 -0800 | [diff] [blame] | 42 | #if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA) && \ |
Mateusz Starzyk | c0eabdc | 2021-08-03 14:09:02 +0200 | [diff] [blame^] | 43 | !(defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) || \ |
| 44 | defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)) |
| 45 | # error "PSA_WANT_ALG_DETERMINISTIC_ECDSA defined, but not all prerequisites" |
John Durkop | b6f7afc | 2020-11-12 11:36:06 -0800 | [diff] [blame] | 46 | #endif |
| 47 | |
Mateusz Starzyk | c0eabdc | 2021-08-03 14:09:02 +0200 | [diff] [blame^] | 48 | #if defined(PSA_WANT_ALG_ECDSA) && \ |
| 49 | !(defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) || \ |
| 50 | defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)) |
| 51 | # error "PSA_WANT_ALG_ECDSA defined, but not all prerequisites" |
John Durkop | b6f7afc | 2020-11-12 11:36:06 -0800 | [diff] [blame] | 52 | #endif |
| 53 | |
Ronald Cron | 3d47181 | 2021-03-18 13:40:31 +0100 | [diff] [blame] | 54 | #if defined(PSA_WANT_ALG_GCM) && \ |
Mateusz Starzyk | c0eabdc | 2021-08-03 14:09:02 +0200 | [diff] [blame^] | 55 | !(defined(PSA_WANT_KEY_TYPE_AES) || defined(PSA_WANT_KEY_TYPE_CAMELLIA)) |
| 56 | # error "PSA_WANT_ALG_GCM defined, but not all prerequisites" |
Ronald Cron | 3d47181 | 2021-03-18 13:40:31 +0100 | [diff] [blame] | 57 | #endif |
| 58 | |
Mateusz Starzyk | c0eabdc | 2021-08-03 14:09:02 +0200 | [diff] [blame^] | 59 | #if defined(PSA_WANT_ALG_RSA_PKCS1V15_CRYPT) && \ |
| 60 | !(defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \ |
| 61 | defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY)) |
| 62 | # error "PSA_WANT_ALG_RSA_PKCS1V15_CRYPT defined, but not all prerequisites" |
John Durkop | b6f7afc | 2020-11-12 11:36:06 -0800 | [diff] [blame] | 63 | #endif |
| 64 | |
Mateusz Starzyk | c0eabdc | 2021-08-03 14:09:02 +0200 | [diff] [blame^] | 65 | #if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) && \ |
| 66 | !(defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \ |
| 67 | defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY)) |
| 68 | # error "PSA_WANT_ALG_RSA_PKCS1V15_SIGN defined, but not all prerequisites" |
John Durkop | b6f7afc | 2020-11-12 11:36:06 -0800 | [diff] [blame] | 69 | #endif |
| 70 | |
Mateusz Starzyk | c0eabdc | 2021-08-03 14:09:02 +0200 | [diff] [blame^] | 71 | #if defined(PSA_WANT_ALG_RSA_OAEP) && \ |
| 72 | !(defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \ |
| 73 | defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY)) |
| 74 | # error "PSA_WANT_ALG_RSA_OAEP defined, but not all prerequisites" |
John Durkop | b6f7afc | 2020-11-12 11:36:06 -0800 | [diff] [blame] | 75 | #endif |
| 76 | |
Mateusz Starzyk | c0eabdc | 2021-08-03 14:09:02 +0200 | [diff] [blame^] | 77 | #if defined(PSA_WANT_ALG_RSA_PSS) && \ |
| 78 | !(defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \ |
| 79 | defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY)) |
| 80 | # error "PSA_WANT_ALG_RSA_PSS defined, but not all prerequisites" |
John Durkop | b6f7afc | 2020-11-12 11:36:06 -0800 | [diff] [blame] | 81 | #endif |
| 82 | |
John Durkop | 07cc04a | 2020-11-16 22:08:34 -0800 | [diff] [blame] | 83 | #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) && \ |
| 84 | !defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) |
Mateusz Starzyk | c0eabdc | 2021-08-03 14:09:02 +0200 | [diff] [blame^] | 85 | # error "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR defined, but not all prerequisites" |
John Durkop | 07cc04a | 2020-11-16 22:08:34 -0800 | [diff] [blame] | 86 | #endif |
| 87 | |
John Durkop | b6f7afc | 2020-11-12 11:36:06 -0800 | [diff] [blame] | 88 | #endif /* MBEDTLS_CHECK_CRYPTO_CONFIG_H */ |