blob: d9cc4018b261ed9c8d4df545bc26469210a0e1c1 [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
6 * include/mbedtls/config.h and include/psa/crypto_config.h and uses
7 * those definitions to define symbols used in the library code.
8 *
9 * Users and integrators should not edit this file, please edit
10 * include/mbedtls/config.h for MBETLS_XXX settings or
11 * 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
John Durkop714e3a12020-09-29 22:07:04 -070033#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
John Durkop6e33dbe2020-09-17 21:15:13 -070034#include "psa/crypto_config.h"
John Durkop76228ac2020-09-29 22:33:49 -070035#endif /* defined(MBEDTLS_PSA_CRYPTO_CONFIG) */
John Durkop6e33dbe2020-09-17 21:15:13 -070036
37#ifdef __cplusplus
38extern "C" {
39#endif
40
John Durkop2dfaf9c2020-09-24 04:30:10 -070041#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
John Durkopd8959392020-09-20 23:09:17 -070042
John Durkop2dfaf9c2020-09-24 04:30:10 -070043#if defined(PSA_WANT_ALG_ECDSA)
44#if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)
John Durkop34818822020-10-12 21:36:22 -070045#define MBEDTLS_PSA_BUILTIN_ALG_ECDSA 1
John Durkopd8959392020-09-20 23:09:17 -070046#define MBEDTLS_ECDSA_C
John Durkop34818822020-10-12 21:36:22 -070047#endif /* !MBEDTLS_PSA_ACCEL_ALG_ECDSA */
48#endif /* PSA_WANT_ALG_ECDSA */
John Durkopd8959392020-09-20 23:09:17 -070049
John Durkop0ea39e02020-10-13 19:58:20 -070050#if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA)
51#if !defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
52#define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA 1
John Durkopd8959392020-09-20 23:09:17 -070053#define MBEDTLS_ECDSA_DETERMINISTIC
John Durkop6dff93f2020-10-23 01:22:58 -070054#define MBEDTLS_HMAC_DRBG_C
55#define MBEDTLS_MD_C
John Durkop0ea39e02020-10-13 19:58:20 -070056#endif /* MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA */
John Durkop34818822020-10-12 21:36:22 -070057#endif /* PSA_WANT_ALG_DETERMINISTIC_ECDSA */
John Durkop2dfaf9c2020-09-24 04:30:10 -070058
John Durkop714e3a12020-09-29 22:07:04 -070059#else /* MBEDTLS_PSA_CRYPTO_CONFIG */
60
61/*
62 * Ensure PSA_WANT_* defines are setup properly if MBEDTLS_PSA_CRYPTO_CONFIG
63 * is not defined
64 */
John Durkop34818822020-10-12 21:36:22 -070065#if defined(MBEDTLS_ECDSA_C)
John Durkop0ea39e02020-10-13 19:58:20 -070066#define MBEDTLS_PSA_BUILTIN_ALG_ECDSA
John Durkop714e3a12020-09-29 22:07:04 -070067#endif /* MBEDTLS_ECDSA_C */
68
John Durkop34818822020-10-12 21:36:22 -070069#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
John Durkop0ea39e02020-10-13 19:58:20 -070070#define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA
John Durkop714e3a12020-09-29 22:07:04 -070071#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
72
John Durkop2dfaf9c2020-09-24 04:30:10 -070073#endif /* MBEDTLS_PSA_CRYPTO_CONFIG */
John Durkopd8959392020-09-20 23:09:17 -070074
John Durkop6e33dbe2020-09-17 21:15:13 -070075#ifdef __cplusplus
76}
77#endif
78
79#endif /* MBEDTLS_CONFIG_PSA_H */