1 # Copyright the NTPsec project contributors
3 # SPDX-License-Identifier: BSD-2-Clause
5 """Report on OpenSSL version and features for OpenSSL."""
7 SNIP_LIBSSL_TLS13_CHECK
= """
8 #include <openssl/tls1.h>
10 #ifndef TLS1_3_VERSION
11 #error OpenSSL must have support for TLSv1.3
20 def check_libssl_tls13(ctx
):
21 """Report if OpenSSL supports TLS 1.3 for ./waf configure."""
23 fragment
=SNIP_LIBSSL_TLS13_CHECK
,
25 msg
="Checking for OpenSSL with TLSv1.3 support",
29 SNIP_OPENSSL_BAD_VERSION_CHECK
= """
30 #include <openssl/opensslv.h>
32 #if OPENSSL_VERSION_NUMBER == 0x1010101fL
33 #error OpenSSL version must not be 1.1.1a
42 def check_openssl_bad_version(ctx
):
43 """Report if OpenSSL has a good version to ./waf configure."""
45 fragment
=SNIP_OPENSSL_BAD_VERSION_CHECK
,
47 msg
="Checking for OpenSSL != 1.1.1a",
51 SNIP_OPENSSL_DUMP_VERSION
= """
53 #ifdef HAVE_OPENSSL_OPENSSLV_H
54 #include <openssl/opensslv.h>
56 #define OPENSSL_VERSION_TEXT "something not_OpenSSL_or_LibreSSL something"
57 #endif // HAVE_OPENSSL_OPENSSLV_H
60 printf("%s\\n", OPENSSL_VERSION_TEXT);
66 def dump_openssl_version(ctx
):
67 """Report OpenSSL version to ./waf configure."""
68 _
= "XXX_LIBSSL_VERSION"
69 ctx
.start_msg("LibSSL version")
71 fragment
=SNIP_OPENSSL_DUMP_VERSION
,
78 ctx
.end_msg(' '.join(ctx
.get_define(_
).split()[0:2])[1:])