Merge DSA reallocation timing fix CVE-2018-0734.
authorPauli <paul.dale@oracle.com>
Sun, 28 Oct 2018 22:24:22 +0000 (08:24 +1000)
committerPauli <paul.dale@oracle.com>
Sun, 28 Oct 2018 22:24:22 +0000 (08:24 +1000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7513)

crypto/dsa/dsa_ossl.c

index 2dcfede..100e269 100644 (file)
@@ -279,7 +279,7 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
         goto err;
 
     /* Preallocate space */
-    q_bits = BN_num_bits(dsa->q);
+    q_bits = BN_num_bits(dsa->q) + sizeof(dsa->q->d[0]) * 16;
     if (!BN_set_bit(&k, q_bits)
         || !BN_set_bit(&l, q_bits)
         || !BN_set_bit(&m, q_bits))