]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OpenSSL: Add option to disable ECDHE with Suite B RSA
authorJouni Malinen <jouni@qca.qualcomm.com>
Sun, 17 Sep 2017 18:31:01 +0000 (21:31 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 18 Sep 2017 09:12:48 +0000 (12:12 +0300)
The hostapd.conf tls_flags=[SUITEB-NO-ECDH] and wpa_supplicant network
profile phase1="tls_suiteb_no_ecdh=1" can now be used to configure Suite
B RSA constraints with ECDHE disabled. This is mainly to allow
the DHE TLS cipher suite to be tested.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
hostapd/config_file.c
src/crypto/tls.h
src/crypto/tls_openssl.c
src/eap_peer/eap_tls_common.c

index 41612cb9a3954000f0e53b72d00f8b03ab44bcf7..880998bed9c39a9384a24c65a896358582ae5373 100644 (file)
@@ -2077,6 +2077,8 @@ static unsigned int parse_tls_flags(const char *val)
                flags |= TLS_CONN_DISABLE_TLSv1_2;
        if (os_strstr(val, "[SUITEB]"))
                flags |= TLS_CONN_SUITEB;
+       if (os_strstr(val, "[SUITEB-NO-ECDH]"))
+               flags |= TLS_CONN_SUITEB_NO_ECDH | TLS_CONN_SUITEB;
 
        return flags;
 }
index e60efc8cdb73be2cf5241be22d9823f811176b30..dc4117c38e9b48ee73d6212bde16992c038a45ec 100644 (file)
@@ -100,6 +100,7 @@ struct tls_config {
 #define TLS_CONN_EXT_CERT_CHECK BIT(9)
 #define TLS_CONN_REQUIRE_OCSP_ALL BIT(10)
 #define TLS_CONN_SUITEB BIT(11)
+#define TLS_CONN_SUITEB_NO_ECDH BIT(12)
 
 /**
  * struct tls_connection_params - Parameters for TLS connection
index 84321eedb6797b157fc4e9c7d6cb723cd296ecbc..685e863ee9b7eda280c44c3ced50372fb8a69d09 100644 (file)
@@ -2325,7 +2325,15 @@ static int tls_set_conn_flags(SSL *ssl, unsigned int flags)
                SSL_clear_options(ssl, SSL_OP_NO_TLSv1_2);
 #endif /* SSL_OP_NO_TLSv1_2 */
 #ifdef CONFIG_SUITEB
-       if (flags & TLS_CONN_SUITEB) {
+       if (flags & TLS_CONN_SUITEB_NO_ECDH) {
+               const char *ciphers = "DHE-RSA-AES256-GCM-SHA384";
+
+               if (SSL_set_cipher_list(ssl, ciphers) != 1) {
+                       wpa_printf(MSG_INFO,
+                                  "OpenSSL: Failed to set Suite B ciphers");
+                       return -1;
+               }
+       } else if (flags & TLS_CONN_SUITEB) {
                EC_KEY *ecdh;
                const char *ciphers =
                        "ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384";
@@ -2341,12 +2349,6 @@ static int tls_set_conn_flags(SSL *ssl, unsigned int flags)
                                   "OpenSSL: Failed to set Suite B curves");
                        return -1;
                }
-               /* ECDSA+SHA384 if need to add EC support here */
-               if (SSL_set1_sigalgs_list(ssl, "RSA+SHA384") != 1) {
-                       wpa_printf(MSG_INFO,
-                                  "OpenSSL: Failed to set Suite B sigalgs");
-                       return -1;
-               }
 
                ecdh = EC_KEY_new_by_curve_name(NID_secp384r1);
                if (!ecdh || SSL_set_tmp_ecdh(ssl, ecdh) != 1) {
@@ -2356,6 +2358,14 @@ static int tls_set_conn_flags(SSL *ssl, unsigned int flags)
                        return -1;
                }
                EC_KEY_free(ecdh);
+       }
+       if (flags & (TLS_CONN_SUITEB | TLS_CONN_SUITEB_NO_ECDH)) {
+               /* ECDSA+SHA384 if need to add EC support here */
+               if (SSL_set1_sigalgs_list(ssl, "RSA+SHA384") != 1) {
+                       wpa_printf(MSG_INFO,
+                                  "OpenSSL: Failed to set Suite B sigalgs");
+                       return -1;
+               }
 
                SSL_set_options(ssl, SSL_OP_NO_TLSv1);
                SSL_set_options(ssl, SSL_OP_NO_TLSv1_1);
index b387dea50815cf81feec86cc625625e311fe334a..b3d4aba048ab730278edfc4eff339fe540ade4f3 100644 (file)
@@ -88,6 +88,10 @@ static void eap_tls_params_flags(struct tls_connection_params *params,
                params->flags |= TLS_CONN_SUITEB;
        if (os_strstr(txt, "tls_suiteb=0"))
                params->flags &= ~TLS_CONN_SUITEB;
+       if (os_strstr(txt, "tls_suiteb_no_ecdh=1"))
+               params->flags |= TLS_CONN_SUITEB_NO_ECDH;
+       if (os_strstr(txt, "tls_suiteb_no_ecdh=0"))
+               params->flags &= ~TLS_CONN_SUITEB_NO_ECDH;
 }