John Durkop | 6e33dbe | 2020-09-17 21:15:13 -0700 | [diff] [blame] | 1 | /** |
| 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 Durkop | 714e3a1 | 2020-09-29 22:07:04 -0700 | [diff] [blame] | 29 | #if defined(MBEDTLS_PSA_CRYPTO_CONFIG) |
John Durkop | 6e33dbe | 2020-09-17 21:15:13 -0700 | [diff] [blame] | 30 | #include "psa/crypto_config.h" |
John Durkop | 76228ac | 2020-09-29 22:33:49 -0700 | [diff] [blame^] | 31 | #endif /* defined(MBEDTLS_PSA_CRYPTO_CONFIG) */ |
John Durkop | 6e33dbe | 2020-09-17 21:15:13 -0700 | [diff] [blame] | 32 | |
| 33 | #ifdef __cplusplus |
| 34 | extern "C" { |
| 35 | #endif |
| 36 | |
John Durkop | 2dfaf9c | 2020-09-24 04:30:10 -0700 | [diff] [blame] | 37 | #if defined(MBEDTLS_PSA_CRYPTO_CONFIG) |
John Durkop | d895939 | 2020-09-20 23:09:17 -0700 | [diff] [blame] | 38 | |
John Durkop | 2dfaf9c | 2020-09-24 04:30:10 -0700 | [diff] [blame] | 39 | #if defined(PSA_WANT_ALG_ECDSA) |
| 40 | #if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) |
John Durkop | d895939 | 2020-09-20 23:09:17 -0700 | [diff] [blame] | 41 | #define MBEDTLS_PSA_BUILTIN_ALG_ECDSA |
John Durkop | 2dfaf9c | 2020-09-24 04:30:10 -0700 | [diff] [blame] | 42 | #else /* !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) */ |
John Durkop | d895939 | 2020-09-20 23:09:17 -0700 | [diff] [blame] | 43 | #define MBEDTLS_ECDSA_C |
John Durkop | 2dfaf9c | 2020-09-24 04:30:10 -0700 | [diff] [blame] | 44 | #endif /* !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) */ |
| 45 | #endif /* defined(PSA_WANT_ALG_ECDSA) */ |
John Durkop | d895939 | 2020-09-20 23:09:17 -0700 | [diff] [blame] | 46 | |
John Durkop | 714e3a1 | 2020-09-29 22:07:04 -0700 | [diff] [blame] | 47 | #if defined(PSA_WANT_ALG_ECDSA_DETERMINISTIC) |
John Durkop | 2dfaf9c | 2020-09-24 04:30:10 -0700 | [diff] [blame] | 48 | #if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA_DETERMINISTIC) |
John Durkop | d895939 | 2020-09-20 23:09:17 -0700 | [diff] [blame] | 49 | #define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA |
John Durkop | 2dfaf9c | 2020-09-24 04:30:10 -0700 | [diff] [blame] | 50 | #else /* && !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA_DETERMINISTIC) */ |
John Durkop | d895939 | 2020-09-20 23:09:17 -0700 | [diff] [blame] | 51 | #define MBEDTLS_ECDSA_DETERMINISTIC |
John Durkop | 2dfaf9c | 2020-09-24 04:30:10 -0700 | [diff] [blame] | 52 | #endif /* !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA_DETERMINISTIC) */ |
| 53 | #endif /* defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA) */ |
| 54 | |
John Durkop | 714e3a1 | 2020-09-29 22:07:04 -0700 | [diff] [blame] | 55 | #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 Durkop | 2dfaf9c | 2020-09-24 04:30:10 -0700 | [diff] [blame] | 69 | #endif /* MBEDTLS_PSA_CRYPTO_CONFIG */ |
John Durkop | d895939 | 2020-09-20 23:09:17 -0700 | [diff] [blame] | 70 | |
John Durkop | 6e33dbe | 2020-09-17 21:15:13 -0700 | [diff] [blame] | 71 | #ifdef __cplusplus |
| 72 | } |
| 73 | #endif |
| 74 | |
| 75 | #endif /* MBEDTLS_CONFIG_PSA_H */ |