]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OpenSSL: Support EC key from private_key blob
authorJouni Malinen <jouni@codeaurora.org>
Tue, 16 Jun 2020 14:48:47 +0000 (17:48 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 16 Jun 2020 15:24:23 +0000 (18:24 +0300)
Try to parse the private_key blob as an ECPrivateKey in addition to the
previously supported RSA and DSA.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/crypto/tls_openssl.c

index 160578e0e2559debfe1414675b2c56afe869022c..29c7688a508455a56f8445723490f748b3bc907f 100644 (file)
@@ -3772,6 +3772,17 @@ static int tls_connection_private_key(struct tls_data *data,
                        break;
                }
 
+#ifndef OPENSSL_NO_EC
+               if (SSL_use_PrivateKey_ASN1(EVP_PKEY_EC, conn->ssl,
+                                           (u8 *) private_key_blob,
+                                           private_key_blob_len) == 1) {
+                       wpa_printf(MSG_DEBUG,
+                                  "OpenSSL: SSL_use_PrivateKey_ASN1(EVP_PKEY_EC) --> OK");
+                       ok = 1;
+                       break;
+               }
+#endif /* OPENSSL_NO_EC */
+
                if (SSL_use_RSAPrivateKey_ASN1(conn->ssl,
                                               (u8 *) private_key_blob,
                                               private_key_blob_len) == 1) {