blob: 6af4d19995374855250d6bbd93205854a1bace85 [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 Durkop36a82e52020-10-26 09:39:05 -070054#define MBEDTLS_ECDSA_C
John Durkop6dff93f2020-10-23 01:22:58 -070055#define MBEDTLS_HMAC_DRBG_C
56#define MBEDTLS_MD_C
John Durkop0ea39e02020-10-13 19:58:20 -070057#endif /* MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA */
John Durkop34818822020-10-12 21:36:22 -070058#endif /* PSA_WANT_ALG_DETERMINISTIC_ECDSA */
John Durkop2dfaf9c2020-09-24 04:30:10 -070059
John Durkop714e3a12020-09-29 22:07:04 -070060#else /* MBEDTLS_PSA_CRYPTO_CONFIG */
61
62/*
63 * Ensure PSA_WANT_* defines are setup properly if MBEDTLS_PSA_CRYPTO_CONFIG
64 * is not defined
65 */
John Durkop34818822020-10-12 21:36:22 -070066#if defined(MBEDTLS_ECDSA_C)
John Durkop0ea39e02020-10-13 19:58:20 -070067#define MBEDTLS_PSA_BUILTIN_ALG_ECDSA
John Durkop714e3a12020-09-29 22:07:04 -070068
John Durkopf87e3ae2020-10-26 15:25:23 -070069// Only add in DETERMINISTIC support if ECDSA is also enabled
John Durkop34818822020-10-12 21:36:22 -070070#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
John Durkop0ea39e02020-10-13 19:58:20 -070071#define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA
John Durkop714e3a12020-09-29 22:07:04 -070072#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
73
John Durkopf87e3ae2020-10-26 15:25:23 -070074#endif /* MBEDTLS_ECDSA_C */
75
John Durkop2dfaf9c2020-09-24 04:30:10 -070076#endif /* MBEDTLS_PSA_CRYPTO_CONFIG */
John Durkopd8959392020-09-20 23:09:17 -070077
John Durkop6e33dbe2020-09-17 21:15:13 -070078#ifdef __cplusplus
79}
80#endif
81
82#endif /* MBEDTLS_CONFIG_PSA_H */