1 From bc99366f9b960150aa2e369048bbc2218c1d414e Mon Sep 17 00:00:00 2001
2 From: Jouni Malinen <j@w1.fi>
3 Date: Sun, 22 May 2022 17:01:35 +0300
4 Subject: [PATCH] OpenSSL: Drop security level to 0 with OpenSSL 3.0 when using
7 Commit 9afb68b03976 ("OpenSSL: Allow systemwide secpolicy overrides for
8 TLS version") with commit 58bbcfa31b18 ("OpenSSL: Update security level
9 drop for TLS 1.0/1.1 with OpenSSL 3.0") allow this workaround to be
10 enabled with an explicit network configuration parameter. However, the
11 default settings are still allowing TLS 1.0 and 1.1 to be negotiated
12 just to see them fail immediately when using OpenSSL 3.0. This is not
13 exactly helpful especially when the OpenSSL error message for this
14 particular case is "internal error" which does not really say anything
15 about the reason for the error.
17 It is is a bit inconvenient to update the security policy for this
18 particular issue based on the negotiated TLS version since that happens
19 in the middle of processing for the first message from the server.
20 However, this can be done by using the debug callback for printing out
21 the received TLS messages during processing.
23 Drop the OpenSSL security level to 0 if that is the only option to
24 continue the TLS negotiation, i.e., when TLS 1.0/1.1 are still allowed
25 in wpa_supplicant default configuration and OpenSSL 3.0 with the
26 constraint on MD5-SHA1 use.
28 Signed-off-by: Jouni Malinen <j@w1.fi>
30 src/crypto/tls_openssl.c | 9 +++++++++
31 1 file changed, 9 insertions(+)
33 diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c
34 index 6602ac64f..78621d926 100644
35 --- a/src/crypto/tls_openssl.c
36 +++ b/src/crypto/tls_openssl.c
37 @@ -1557,6 +1557,15 @@ static void tls_msg_cb(int write_p, int version, int content_type,
38 struct tls_connection *conn = arg;
41 +#if OPENSSL_VERSION_NUMBER >= 0x30000000L
42 + if ((SSL_version(ssl) == TLS1_VERSION ||
43 + SSL_version(ssl) == TLS1_1_VERSION) &&
44 + SSL_get_security_level(ssl) > 0) {
45 + wpa_printf(MSG_DEBUG,
46 + "OpenSSL: Drop security level to 0 to allow TLS 1.0/1.1 use of MD5-SHA1 signature algorithm");
47 + SSL_set_security_level(ssl, 0);
49 +#endif /* OpenSSL version >= 3.0 */
52 "OpenSSL: session ver=0x%x content_type=%d",