blob: 8b32378ef5645994eb7d2c5b19a8fe97094f343b [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 *
5 * This set of compile-time options may be used to enable
6 * or disable PSA crypto features selectively. This will aid
7 * in reducing the size of the library by removing unused code.
8 */
9/*
10 * Copyright The Mbed TLS Contributors
11 * SPDX-License-Identifier: Apache-2.0
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License"); you may
14 * not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
21 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 */
25
26#ifndef MBEDTLS_CONFIG_PSA_H
27#define MBEDTLS_CONFIG_PSA_H
28
John Durkop714e3a12020-09-29 22:07:04 -070029#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
John Durkop6e33dbe2020-09-17 21:15:13 -070030#include "psa/crypto_config.h"
John Durkop714e3a12020-09-29 22:07:04 -070031#endif /* defined(MBEDTLS_PSAY_CRYPTO_CONFIG) */
John Durkop6e33dbe2020-09-17 21:15:13 -070032
33#ifdef __cplusplus
34extern "C" {
35#endif
36
John Durkop2dfaf9c2020-09-24 04:30:10 -070037#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
John Durkopd8959392020-09-20 23:09:17 -070038
John Durkop2dfaf9c2020-09-24 04:30:10 -070039#if defined(PSA_WANT_ALG_ECDSA)
40#if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)
John Durkopd8959392020-09-20 23:09:17 -070041#define MBEDTLS_PSA_BUILTIN_ALG_ECDSA
John Durkop2dfaf9c2020-09-24 04:30:10 -070042#else /* !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) */
John Durkopd8959392020-09-20 23:09:17 -070043#define MBEDTLS_ECDSA_C
John Durkop2dfaf9c2020-09-24 04:30:10 -070044#endif /* !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) */
45#endif /* defined(PSA_WANT_ALG_ECDSA) */
John Durkopd8959392020-09-20 23:09:17 -070046
John Durkop714e3a12020-09-29 22:07:04 -070047#if defined(PSA_WANT_ALG_ECDSA_DETERMINISTIC)
John Durkop2dfaf9c2020-09-24 04:30:10 -070048#if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA_DETERMINISTIC)
John Durkopd8959392020-09-20 23:09:17 -070049#define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA
John Durkop2dfaf9c2020-09-24 04:30:10 -070050#else /* && !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA_DETERMINISTIC) */
John Durkopd8959392020-09-20 23:09:17 -070051#define MBEDTLS_ECDSA_DETERMINISTIC
John Durkop2dfaf9c2020-09-24 04:30:10 -070052#endif /* !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA_DETERMINISTIC) */
53#endif /* defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA) */
54
John Durkop714e3a12020-09-29 22:07:04 -070055#else /* MBEDTLS_PSA_CRYPTO_CONFIG */
56
57/*
58 * Ensure PSA_WANT_* defines are setup properly if MBEDTLS_PSA_CRYPTO_CONFIG
59 * is not defined
60 */
61#ifdef MBEDTLS_ECDSA_C
62#define PSA_WANT_ALG_ECDSA
63#endif /* MBEDTLS_ECDSA_C */
64
65#ifdef MBEDTLS_ECDSA_DETERMINISTIC
66#define PSA_WANT_ALG_ECDSA_DETERMINISTIC
67#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
68
John Durkop2dfaf9c2020-09-24 04:30:10 -070069#endif /* MBEDTLS_PSA_CRYPTO_CONFIG */
John Durkopd8959392020-09-20 23:09:17 -070070
John Durkop6e33dbe2020-09-17 21:15:13 -070071#ifdef __cplusplus
72}
73#endif
74
75#endif /* MBEDTLS_CONFIG_PSA_H */