Skip to content

Commit 6939eab

Browse files
bbbrumleymattcaswell
authored andcommitted
RSA key generation: ensure BN_mod_inverse and BN_mod_exp_mont both get called with BN_FLG_CONSTTIME flag set.
CVE-2018-0737 Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
1 parent e4fa7cc commit 6939eab

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: crypto/rsa/rsa_gen.c

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value,
8989
if (BN_copy(rsa->e, e_value) == NULL)
9090
goto err;
9191

92+
BN_set_flags(rsa->p, BN_FLG_CONSTTIME);
93+
BN_set_flags(rsa->q, BN_FLG_CONSTTIME);
9294
BN_set_flags(r2, BN_FLG_CONSTTIME);
9395
/* generate p and q */
9496
for (;;) {

0 commit comments

Comments
 (0)