[PATCH 1/4] OpenSSL: clear the correct flag in crypto_ec_key_get_ecprivate_key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "(4401 440) Cedric Izoard (France)" <cedric.izoard@xxxxxxxxxxxx>

In case public Key was not included in the EC private key ASN1
sequence, the flag cleared was not the right one.

Signed-off-by: Cedric Izoard <cedric.izoard@xxxxxxxxxxxx>
---
 src/crypto/crypto_openssl.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/crypto/crypto_openssl.c b/src/crypto/crypto_openssl.c
index 96ce493e3..c198748de 100644
--- a/src/crypto/crypto_openssl.c
+++ b/src/crypto/crypto_openssl.c
@@ -2501,15 +2501,18 @@ struct wpabuf * crypto_ec_key_get_ecprivate_key(struct crypto_ec_key *key,
 	unsigned char *der = NULL;
 	int der_len;
 	struct wpabuf *buf;
+	unsigned int key_flags;
 
 	eckey = EVP_PKEY_get0_EC_KEY((EVP_PKEY *) key);
 	if (!eckey)
 		return NULL;
 
+	key_flags = EC_KEY_get_enc_flags(eckey);
 	if (include_pub)
-		EC_KEY_clear_flags(eckey, EC_PKEY_NO_PUBKEY);
+		key_flags &= ~EC_PKEY_NO_PUBKEY;
 	else
-		EC_KEY_set_enc_flags(eckey, EC_PKEY_NO_PUBKEY);
+		key_flags |= EC_PKEY_NO_PUBKEY;
+	EC_KEY_set_enc_flags(eckey, key_flags);
 
 	EC_KEY_set_conv_form(eckey, POINT_CONVERSION_UNCOMPRESSED);
 
-- 
2.25.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux