Gilles Peskine | a3ed34f | 2021-01-05 21:11:16 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Common code for SSL test programs |
| 3 | * |
| 4 | * Copyright The Mbed TLS Contributors |
| 5 | * SPDX-License-Identifier: Apache-2.0 |
| 6 | * |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 8 | * not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
| 10 | * |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | * |
| 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 15 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
| 18 | */ |
| 19 | |
| 20 | #ifndef MBEDTLS_PROGRAMS_SSL_SSL_TEST_LIB_H |
| 21 | #define MBEDTLS_PROGRAMS_SSL_SSL_TEST_LIB_H |
| 22 | |
Gilles Peskine | ab7ce96 | 2021-01-05 21:27:53 +0100 | [diff] [blame^] | 23 | #if !defined(MBEDTLS_CONFIG_FILE) |
| 24 | #include "mbedtls/config.h" |
| 25 | #else |
| 26 | #include MBEDTLS_CONFIG_FILE |
| 27 | #endif |
| 28 | |
| 29 | #if defined(MBEDTLS_PLATFORM_C) |
| 30 | #include "mbedtls/platform.h" |
| 31 | #else |
| 32 | #include <stdio.h> |
| 33 | #include <stdlib.h> |
| 34 | #define mbedtls_calloc calloc |
| 35 | #define mbedtls_free free |
| 36 | #define mbedtls_time time |
| 37 | #define mbedtls_time_t time_t |
| 38 | #define mbedtls_printf printf |
| 39 | #define mbedtls_fprintf fprintf |
| 40 | #define mbedtls_snprintf snprintf |
| 41 | #define mbedtls_exit exit |
| 42 | #define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS |
| 43 | #define MBEDTLS_EXIT_FAILURE EXIT_FAILURE |
| 44 | #endif |
| 45 | |
| 46 | #if !defined(MBEDTLS_CTR_DRBG_C) || \ |
| 47 | !defined(MBEDTLS_ENTROPY_C) || \ |
| 48 | !defined(MBEDTLS_NET_C) || \ |
| 49 | !defined(MBEDTLS_SSL_TLS_C) || \ |
| 50 | defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER) |
| 51 | #define MBEDTLS_SSL_TEST_IMPOSSIBLE \ |
| 52 | "MBEDTLS_CTR_DRBG_C and/or " \ |
| 53 | "MBEDTLS_ENTROPY_C and/or " \ |
| 54 | "MBEDTLS_NET_C and/or " \ |
| 55 | "MBEDTLS_SSL_TLS_C not defined, " \ |
| 56 | "and/or MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER defined.\n" |
| 57 | #else |
| 58 | #undef MBEDTLS_SSL_TEST_IMPOSSIBLE |
| 59 | #endif |
| 60 | |
Gilles Peskine | a3ed34f | 2021-01-05 21:11:16 +0100 | [diff] [blame] | 61 | #endif /* MBEDTLS_PROGRAMS_SSL_SSL_TEST_LIB_H */ |