blob: bf87d0aa2d0e36373afb7d6f3ef0783871599130 [file] [log] [blame]
John Durkop6e33dbe2020-09-17 21:15:13 -07001/**
2 * \file mbedtls/config_psa.h
3 * \brief PSA crypto configuration options (set of defines)
4 *
John Durkop34818822020-10-12 21:36:22 -07005 * This set of compile-time options takes settings defined in
Bence Szépkútibb0cfeb2021-05-28 09:42:25 +02006 * include/mbedtls/mbedtls_config.h and include/psa/crypto_config.h and uses
John Durkop34818822020-10-12 21:36:22 -07007 * those definitions to define symbols used in the library code.
8 *
9 * Users and integrators should not edit this file, please edit
Tom Cosgrove1797b052022-12-04 17:19:59 +000010 * include/mbedtls/mbedtls_config.h for MBEDTLS_XXX settings or
John Durkop34818822020-10-12 21:36:22 -070011 * include/psa/crypto_config.h for PSA_WANT_XXX settings.
John Durkop6e33dbe2020-09-17 21:15:13 -070012 */
13/*
14 * Copyright The Mbed TLS Contributors
15 * SPDX-License-Identifier: Apache-2.0
16 *
17 * Licensed under the Apache License, Version 2.0 (the "License"); you may
18 * not use this file except in compliance with the License.
19 * You may obtain a copy of the License at
20 *
21 * http://www.apache.org/licenses/LICENSE-2.0
22 *
23 * Unless required by applicable law or agreed to in writing, software
24 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
25 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 * See the License for the specific language governing permissions and
27 * limitations under the License.
28 */
29
30#ifndef MBEDTLS_CONFIG_PSA_H
31#define MBEDTLS_CONFIG_PSA_H
32
Valerio Settib7ef51a2023-06-06 14:32:58 +020033#include "psa/crypto_legacy.h"
34
Gilles Peskine7b7d9032023-09-04 16:55:14 +020035#include "psa/crypto_adjust_config_synonyms.h"
Gilles Peskine44c96aa2021-10-04 18:33:56 +020036
Gilles Peskineeca01782023-09-04 16:58:54 +020037#include "mbedtls/config_adjust_psa_superset_legacy.h"
Gilles Peskine1231eb52021-04-19 22:24:23 +020038
John Durkop2dfaf9c2020-09-24 04:30:10 -070039#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
John Durkopd8959392020-09-20 23:09:17 -070040
Gilles Peskine4fb15422023-09-04 17:41:36 +020041/* Require built-in implementations based on PSA requirements */
John Durkopd62b6782020-11-30 21:06:05 -080042
Gilles Peskine4fb15422023-09-04 17:41:36 +020043#include "mbedtls/config_adjust_legacy_from_psa.h"
Gilles Peskine1231eb52021-04-19 22:24:23 +020044
John Durkop714e3a12020-09-29 22:07:04 -070045#else /* MBEDTLS_PSA_CRYPTO_CONFIG */
46
Gilles Peskine10c6f072023-09-04 17:36:35 +020047/* Infer PSA requirements from Mbed TLS capabilities */
Gilles Peskine2cecfba2020-11-25 00:07:04 +010048
Gilles Peskine10c6f072023-09-04 17:36:35 +020049#include "mbedtls/config_adjust_psa_from_legacy.h"
David Brown8de143e2021-02-19 14:08:00 -070050
John Durkop2dfaf9c2020-09-24 04:30:10 -070051#endif /* MBEDTLS_PSA_CRYPTO_CONFIG */
John Durkopd8959392020-09-20 23:09:17 -070052
Tom Cosgrove6d62fac2023-05-10 14:40:05 +010053#if defined(PSA_WANT_ALG_JPAKE)
54#define PSA_WANT_ALG_SOME_PAKE 1
55#endif
56
Valerio Setti73fc0822023-06-21 10:06:19 +020057/* Even though KEY_PAIR symbols' feature several level of support (BASIC, IMPORT,
58 * EXPORT, GENERATE, DERIVE) we're not planning to have support only for BASIC
59 * without IMPORT/EXPORT since these last 2 features are strongly used in tests.
Valerio Setti27c501a2023-06-27 16:58:52 +020060 * In general it is allowed to include more feature than what is strictly
61 * requested.
62 * As a consequence IMPORT and EXPORT features will be automatically enabled
63 * as soon as the BASIC one is. */
Valerio Setti73fc0822023-06-21 10:06:19 +020064#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC)
Valerio Setti27c501a2023-06-27 16:58:52 +020065#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT 1
66#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT 1
Valerio Setti73fc0822023-06-21 10:06:19 +020067#endif
68
Valerio Setti27c501a2023-06-27 16:58:52 +020069/* See description above */
Valerio Setti73fc0822023-06-21 10:06:19 +020070#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_BASIC)
Valerio Setti27c501a2023-06-27 16:58:52 +020071#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_IMPORT 1
72#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_EXPORT 1
Valerio Setti8d6e98c2023-05-26 13:46:13 +020073#endif
74
Valerio Setti0d5c5e52023-07-10 16:21:00 +020075/* See description above */
76#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC)
77#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1
78#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1
79#endif
80
81/* See description above */
82#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_BASIC)
83#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1
84#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1
85#endif
86
Valerio Settia55f0422023-07-10 15:34:41 +020087/* See description above */
88#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC)
89#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT 1
90#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT 1
Valerio Setti8d6e98c2023-05-26 13:46:13 +020091#endif
92
Valerio Settia55f0422023-07-10 15:34:41 +020093/* See description above */
94#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_BASIC)
95#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_IMPORT 1
96#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_EXPORT 1
Valerio Setti8d6e98c2023-05-26 13:46:13 +020097#endif
98
Gilles Peskine58239772023-09-04 16:56:06 +020099#include "psa/crypto_adjust_auto_enabled.h"
Gilles Peskine60b29fe2021-02-16 14:06:50 +0100100
John Durkop6e33dbe2020-09-17 21:15:13 -0700101#endif /* MBEDTLS_CONFIG_PSA_H */