]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OpenSSL: Add TLS 1.3 signature algorithms for Suite B
authorJouni Malinen <quic_jouni@quicinc.com>
Wed, 22 Mar 2023 21:58:47 +0000 (23:58 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 22 Mar 2023 21:58:47 +0000 (23:58 +0200)
These are needed to allow the Suite B 192-bit negotiation to succeed
when using TLS 1.3 (which is still disabled by default).

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/crypto/tls_openssl.c

index 7b90e7681baafa1395d05cc2416af42436ecb694..fe38fa754c1fa9590b4857129711bebbc131dfe6 100644 (file)
@@ -3238,17 +3238,31 @@ static int tls_set_conn_flags(struct tls_connection *conn, unsigned int flags,
        }
        if (flags & (TLS_CONN_SUITEB | TLS_CONN_SUITEB_NO_ECDH)) {
 #ifdef OPENSSL_IS_BORINGSSL
-               uint16_t sigalgs[1] = { SSL_SIGN_RSA_PKCS1_SHA384 };
+               uint16_t sigalgs[3] = { SSL_SIGN_RSA_PKCS1_SHA384 };
+               int num = 1;
+
+               if (!(flags & TLS_CONN_DISABLE_TLSv1_3)) {
+#ifdef SSL_SIGN_ECDSA_SECP384R1_SHA384
+                       sigalgs[num++] = SSL_SIGN_ECDSA_SECP384R1_SHA384;
+#endif
+#ifdef SSL_SIGN_RSA_PSS_RSAE_SHA384
+                       sigalgs[num++] = SSL_SIGN_RSA_PSS_RSAE_SHA384;
+#endif
+               }
 
                if (SSL_CTX_set_verify_algorithm_prefs(conn->ssl_ctx, sigalgs,
-                                                      1) != 1) {
+                                                      num) != 1) {
                        wpa_printf(MSG_INFO,
                                   "OpenSSL: Failed to set Suite B sigalgs");
                        return -1;
                }
 #else /* OPENSSL_IS_BORINGSSL */
                /* ECDSA+SHA384 if need to add EC support here */
-               if (SSL_set1_sigalgs_list(ssl, "RSA+SHA384") != 1) {
+               const char *algs = "RSA+SHA384";
+
+               if (!(flags & TLS_CONN_DISABLE_TLSv1_3))
+                       algs = "RSA+SHA384:ecdsa_secp384r1_sha384:rsa_pss_rsae_sha384";
+               if (SSL_set1_sigalgs_list(ssl, algs) != 1) {
                        wpa_printf(MSG_INFO,
                                   "OpenSSL: Failed to set Suite B sigalgs");
                        return -1;