rsa/rsa_ossl.c: fix and extend commentary [skip ci].
authorAndy Polyakov <appro@openssl.org>
Wed, 5 Sep 2018 12:33:21 +0000 (14:33 +0200)
committerAndy Polyakov <appro@openssl.org>
Fri, 12 Oct 2018 20:29:13 +0000 (22:29 +0200)
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/7123)

(cherry picked from commit d1c008f66bad435b18aa45aa59f72bed7c682849)

crypto/rsa/rsa_ossl.c

index 5703411a89cb3d23459d99c51d7549cfd7003dd0..23f948fbbb91fbcc6e2c8d522cc8d9bd3ecd2591 100644 (file)
@@ -655,10 +655,11 @@ static int rsa_ossl_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
              */
             || !bn_mod_sub_fixed_top(r1, r1, m1, rsa->p)
 
-            /* r0 = r0 * iqmp mod p */
+            /* r1 = r1 * iqmp mod p */
             || !bn_to_mont_fixed_top(r1, r1, rsa->_method_mod_p, ctx)
             || !bn_mul_mont_fixed_top(r1, r1, rsa->iqmp, rsa->_method_mod_p,
                                       ctx)
+            /* r0 = r1 * q + m1 */
             || !bn_mul_fixed_top(r0, r1, rsa->q, ctx)
             || !bn_mod_add_fixed_top(r0, r0, m1, rsa->n))
             goto err;