Commit 6939eab0 authored by Billy Brumley's avatar Billy Brumley Committed by Matt Caswell
Browse files

RSA key generation: ensure BN_mod_inverse and BN_mod_exp_mont both get called...


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: default avatarRich Salz <rsalz@openssl.org>
Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
parent e4fa7cc3
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -89,6 +89,8 @@ static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value,
    if (BN_copy(rsa->e, e_value) == NULL)
    if (BN_copy(rsa->e, e_value) == NULL)
        goto err;
        goto err;


    BN_set_flags(rsa->p, BN_FLG_CONSTTIME);
    BN_set_flags(rsa->q, BN_FLG_CONSTTIME);
    BN_set_flags(r2, BN_FLG_CONSTTIME);
    BN_set_flags(r2, BN_FLG_CONSTTIME);
    /* generate p and q */
    /* generate p and q */
    for (;;) {
    for (;;) {