From: Jouni Malinen Date: Sun, 27 Jun 2010 04:03:25 +0000 (-0700) Subject: OpenSSL: Fix public key length in DH group 5 operations X-Git-Tag: hostap-1-bp~1276 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc91e07e577bec7416ae2cba478a727c7719ba48;p=thirdparty%2Fhostap.git OpenSSL: Fix public key length in DH group 5 operations The length of the prime was used incorrectly and this resulted in WPS DH operation failing whenever the public key ended up having leading zeros (i.e., about every 1/256th time). --- diff --git a/src/crypto/crypto_openssl.c b/src/crypto/crypto_openssl.c index e1fcf471c..08c98aff4 100644 --- a/src/crypto/crypto_openssl.c +++ b/src/crypto/crypto_openssl.c @@ -434,7 +434,7 @@ void * dh5_init(struct wpabuf **priv, struct wpabuf **publ) if (DH_generate_key(dh) != 1) goto err; - publen = BN_num_bytes(dh->p); + publen = BN_num_bytes(dh->pub_key); pubkey = wpabuf_alloc(publen); if (pubkey == NULL) goto err;