blob: f7d5230f4610e58990881b9648d444c4b14b0a51 [file] [log] [blame]
Chris Kayd259e342021-03-25 16:03:25 +00001/*
2 * Simple program to test that Mbed TLS builds correctly as a CMake package.
3 *
4 * Copyright The Mbed TLS Contributors
Dave Rodgman16799db2023-11-02 19:47:20 +00005 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Chris Kayd259e342021-03-25 16:03:25 +00006 */
7
Felix Conway998760a2025-03-24 11:37:33 +00008#define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
9
Bence Szépkútic662b362021-05-27 11:25:03 +020010#include "mbedtls/build_info.h"
Chris Kayd259e342021-03-25 16:03:25 +000011
Chris Kayd259e342021-03-25 16:03:25 +000012#include "mbedtls/platform.h"
Chris Kayd259e342021-03-25 16:03:25 +000013
14#include "mbedtls/version.h"
15
16/* The main reason to build this is for testing the CMake build, so the program
17 * doesn't need to do very much. It calls a single library function to ensure
18 * linkage works, but that is all. */
19int main()
20{
21 /* This version string is 18 bytes long, as advised by version.h. */
22 char version[18];
23
Gilles Peskine449bd832023-01-11 14:50:10 +010024 mbedtls_version_get_string_full(version);
Chris Kayd259e342021-03-25 16:03:25 +000025
Gilles Peskine449bd832023-01-11 14:50:10 +010026 mbedtls_printf("Built against %s\n", version);
Chris Kayd259e342021-03-25 16:03:25 +000027
Gilles Peskine449bd832023-01-11 14:50:10 +010028 return 0;
Chris Kayd259e342021-03-25 16:03:25 +000029}