blob: cf8085bd0aac9cf96a540c064294f3f1341fccde [file] [log] [blame]
Jaeden Ameroab83fdf2019-06-20 17:38:22 +01001/*
2 * Simple program to test that CMake builds with Mbed TLS as a subdirectory
3 * work correctly.
4 *
Bence Szépkúti1e148272020-08-07 13:07:28 +02005 * Copyright The Mbed TLS Contributors
Dave Rodgman7ff79652023-11-03 12:04:52 +00006 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Jaeden Ameroab83fdf2019-06-20 17:38:22 +01007 */
8
9#if !defined(MBEDTLS_CONFIG_FILE)
10#include "mbedtls/config.h"
11#else
12#include MBEDTLS_CONFIG_FILE
13#endif
14
Jaeden Ameroab83fdf2019-06-20 17:38:22 +010015#include "mbedtls/platform.h"
Jaeden Ameroab83fdf2019-06-20 17:38:22 +010016
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. */
22int main()
23{
24 /* This version string is 18 bytes long, as advised by version.h. */
25 char version[18];
26
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010027 mbedtls_version_get_string_full(version);
Jaeden Ameroab83fdf2019-06-20 17:38:22 +010028
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010029 mbedtls_printf("Built against %s\n", version);
Jaeden Ameroab83fdf2019-06-20 17:38:22 +010030
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010031 return 0;
Jaeden Ameroab83fdf2019-06-20 17:38:22 +010032}