blob: 86e10776c0d261928401d45d7ab384dc9088b00a [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
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
Bence Szépkútic662b362021-05-27 11:25:03 +020020#include "mbedtls/build_info.h"
Chris Kayd259e342021-03-25 16:03:25 +000021
Chris Kayd259e342021-03-25 16:03:25 +000022#include "mbedtls/platform.h"
Chris Kayd259e342021-03-25 16:03:25 +000023
24#include "mbedtls/version.h"
25
26/* The main reason to build this is for testing the CMake build, so the program
27 * doesn't need to do very much. It calls a single library function to ensure
28 * linkage works, but that is all. */
29int main()
30{
31 /* This version string is 18 bytes long, as advised by version.h. */
32 char version[18];
33
Gilles Peskine449bd832023-01-11 14:50:10 +010034 mbedtls_version_get_string_full(version);
Chris Kayd259e342021-03-25 16:03:25 +000035
Gilles Peskine449bd832023-01-11 14:50:10 +010036 mbedtls_printf("Built against %s\n", version);
Chris Kayd259e342021-03-25 16:03:25 +000037
Gilles Peskine449bd832023-01-11 14:50:10 +010038 return 0;
Chris Kayd259e342021-03-25 16:03:25 +000039}