Jaeden Amero | ab83fdf | 2019-06-20 17:38:22 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Simple program to test that CMake builds with Mbed TLS as a subdirectory |
| 3 | * work correctly. |
| 4 | * |
Bence Szépkúti | 1e14827 | 2020-08-07 13:07:28 +0200 | [diff] [blame] | 5 | * Copyright The Mbed TLS Contributors |
Dave Rodgman | 7ff7965 | 2023-11-03 12:04:52 +0000 | [diff] [blame] | 6 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
Jaeden Amero | ab83fdf | 2019-06-20 17:38:22 +0100 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #if !defined(MBEDTLS_CONFIG_FILE) |
| 10 | #include "mbedtls/config.h" |
| 11 | #else |
| 12 | #include MBEDTLS_CONFIG_FILE |
| 13 | #endif |
| 14 | |
Jaeden Amero | ab83fdf | 2019-06-20 17:38:22 +0100 | [diff] [blame] | 15 | #include "mbedtls/platform.h" |
Jaeden Amero | ab83fdf | 2019-06-20 17:38:22 +0100 | [diff] [blame] | 16 | |
| 17 | #include "mbedtls/version.h" |
| 18 | |
| 19 | /* The main reason to build this is for testing the CMake build, so the program |
| 20 | * doesn't need to do very much. It calls a single library function to ensure |
| 21 | * linkage works, but that is all. */ |
| 22 | int main() |
| 23 | { |
| 24 | /* This version string is 18 bytes long, as advised by version.h. */ |
| 25 | char version[18]; |
| 26 | |
Gilles Peskine | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame] | 27 | mbedtls_version_get_string_full(version); |
Jaeden Amero | ab83fdf | 2019-06-20 17:38:22 +0100 | [diff] [blame] | 28 | |
Gilles Peskine | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame] | 29 | mbedtls_printf("Built against %s\n", version); |
Jaeden Amero | ab83fdf | 2019-06-20 17:38:22 +0100 | [diff] [blame] | 30 | |
Gilles Peskine | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame] | 31 | return 0; |
Jaeden Amero | ab83fdf | 2019-06-20 17:38:22 +0100 | [diff] [blame] | 32 | } |