Gilles Peskine | 3587dfd | 2021-09-20 19:20:04 +0200 | [diff] [blame] | 1 | /* MBEDTLS_USER_CONFIG_FILE for testing. |
| 2 | * Only used for a few test configurations. |
| 3 | * |
| 4 | * Typical usage (note multiple levels of quoting): |
| 5 | * make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/user-config-for-test.h\"'" |
| 6 | */ |
| 7 | |
| 8 | /* |
| 9 | * Copyright The Mbed TLS Contributors |
| 10 | * SPDX-License-Identifier: Apache-2.0 |
| 11 | * |
| 12 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 13 | * not use this file except in compliance with the License. |
| 14 | * You may obtain a copy of the License at |
| 15 | * |
| 16 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 17 | * |
| 18 | * Unless required by applicable law or agreed to in writing, software |
| 19 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 21 | * See the License for the specific language governing permissions and |
| 22 | * limitations under the License. |
| 23 | */ |
| 24 | |
| 25 | #if defined(PSA_CRYPTO_DRIVER_TEST_ALL) |
| 26 | |
| 27 | /* Enable the use of the test driver in the library, and build the generic |
| 28 | * part of the test driver. */ |
| 29 | #define PSA_CRYPTO_DRIVER_TEST |
| 30 | |
| 31 | /* Use the accelerator driver for all cryptographic mechanisms for which |
| 32 | * the test driver implemented. */ |
| 33 | #define MBEDTLS_PSA_ACCEL_KEY_TYPE_AES |
| 34 | #define MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA |
| 35 | #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR |
| 36 | #define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR |
| 37 | #define MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING |
| 38 | #define MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7 |
| 39 | #define MBEDTLS_PSA_ACCEL_ALG_CTR |
| 40 | #define MBEDTLS_PSA_ACCEL_ALG_CFB |
| 41 | #define MBEDTLS_PSA_ACCEL_ALG_ECDSA |
| 42 | #define MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA |
| 43 | #define MBEDTLS_PSA_ACCEL_ALG_MD5 |
| 44 | #define MBEDTLS_PSA_ACCEL_ALG_OFB |
| 45 | #define MBEDTLS_PSA_ACCEL_ALG_RIPEMD160 |
| 46 | #define MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN |
| 47 | #define MBEDTLS_PSA_ACCEL_ALG_RSA_PSS |
| 48 | #define MBEDTLS_PSA_ACCEL_ALG_SHA_1 |
| 49 | #define MBEDTLS_PSA_ACCEL_ALG_SHA_224 |
| 50 | #define MBEDTLS_PSA_ACCEL_ALG_SHA_256 |
| 51 | #define MBEDTLS_PSA_ACCEL_ALG_SHA_384 |
| 52 | #define MBEDTLS_PSA_ACCEL_ALG_SHA_512 |
| 53 | #define MBEDTLS_PSA_ACCEL_ALG_XTS |
| 54 | #define MBEDTLS_PSA_ACCEL_ALG_CMAC |
| 55 | #define MBEDTLS_PSA_ACCEL_ALG_HMAC |
| 56 | |
| 57 | #endif /* PSA_CRYPTO_DRIVER_TEST_ALL */ |
Gilles Peskine | a08def9 | 2023-04-28 21:01:49 +0200 | [diff] [blame^] | 58 | |
| 59 | |
| 60 | |
| 61 | #if defined(MBEDTLS_PSA_INJECT_ENTROPY) |
| 62 | /* The #MBEDTLS_PSA_INJECT_ENTROPY feature requires two extra platform |
| 63 | * functions, which must be configured as #MBEDTLS_PLATFORM_NV_SEED_READ_MACRO |
| 64 | * and #MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO. The job of these functions |
| 65 | * is to read and write from the entropy seed file, which is located |
| 66 | * in the PSA ITS file whose uid is #PSA_CRYPTO_ITS_RANDOM_SEED_UID. |
| 67 | * (These could have been provided as library functions, but for historical |
| 68 | * reasons, they weren't, and so each integrator has to provide a copy |
| 69 | * of these functions.) |
| 70 | * |
| 71 | * Provide implementations of these functions for testing. */ |
| 72 | #include <stddef.h> |
| 73 | int mbedtls_test_inject_entropy_seed_read(unsigned char *buf, size_t len); |
| 74 | int mbedtls_test_inject_entropy_seed_write(unsigned char *buf, size_t len); |
| 75 | #define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbedtls_test_inject_entropy_seed_read |
| 76 | #define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbedtls_test_inject_entropy_seed_write |
| 77 | #endif /* MBEDTLS_PSA_INJECT_ENTROPY */ |