OpenSSL: Fix public key length in DH group 5 operations
authorJouni Malinen <jouni.malinen@atheros.com>
Sun, 27 Jun 2010 04:03:25 +0000 (21:03 -0700)
committerJouni Malinen <j@w1.fi>
Sun, 27 Jun 2010 04:03:25 +0000 (21:03 -0700)
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).

src/crypto/crypto_openssl.c

index e1fcf47..08c98af 100644 (file)
@@ -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;