summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_eay.c
diff options
context:
space:
mode:
authorbeck <>2017-01-21 10:38:29 +0000
committerbeck <>2017-01-21 10:38:29 +0000
commitbce45cc241b51da39ead8b476c811b47d76ccc46 (patch)
treeec1232403b181357067d4ac6dc7124fb566c88d8 /src/lib/libcrypto/rsa/rsa_eay.c
parentba7dab5b77b1e4dd797dbe7a4c31b5f4cbea0cd7 (diff)
downloadopenbsd-bce45cc241b51da39ead8b476c811b47d76ccc46.tar.gz
openbsd-bce45cc241b51da39ead8b476c811b47d76ccc46.tar.bz2
openbsd-bce45cc241b51da39ead8b476c811b47d76ccc46.zip
Split out BN_div and BN_mod into ct and nonct versions for Internal use.
ok jsing@
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_eay.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_eay.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c
index 640ed9a0d6..c4da147ddf 100644
--- a/src/lib/libcrypto/rsa/rsa_eay.c
+++ b/src/lib/libcrypto/rsa/rsa_eay.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_eay.c,v 1.44 2017/01/21 09:38:59 beck Exp $ */ 1/* $OpenBSD: rsa_eay.c,v 1.45 2017/01/21 10:38:29 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -770,7 +770,7 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
770 BN_init(&c); 770 BN_init(&c);
771 BN_with_flags(&c, I, BN_FLG_CONSTTIME); 771 BN_with_flags(&c, I, BN_FLG_CONSTTIME);
772 772
773 if (!BN_mod(r1, &c, rsa->q, ctx)) 773 if (!BN_mod_ct(r1, &c, rsa->q, ctx))
774 goto err; 774 goto err;
775 775
776 /* compute r1^dmq1 mod q */ 776 /* compute r1^dmq1 mod q */
@@ -784,7 +784,7 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
784 /* compute I mod p */ 784 /* compute I mod p */
785 BN_with_flags(&c, I, BN_FLG_CONSTTIME); 785 BN_with_flags(&c, I, BN_FLG_CONSTTIME);
786 786
787 if (!BN_mod(r1, &c, rsa->p, ctx)) 787 if (!BN_mod_ct(r1, &c, rsa->p, ctx))
788 goto err; 788 goto err;
789 789
790 /* compute r1^dmp1 mod p */ 790 /* compute r1^dmp1 mod p */
@@ -813,7 +813,7 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
813 BN_init(&pr1); 813 BN_init(&pr1);
814 BN_with_flags(&pr1, r1, BN_FLG_CONSTTIME); 814 BN_with_flags(&pr1, r1, BN_FLG_CONSTTIME);
815 815
816 if (!BN_mod(r0, &pr1, rsa->p, ctx)) 816 if (!BN_mod_ct(r0, &pr1, rsa->p, ctx))
817 goto err; 817 goto err;
818 818
819 /* 819 /*
@@ -844,7 +844,7 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
844 */ 844 */
845 if (!BN_sub(vrfy, vrfy, I)) 845 if (!BN_sub(vrfy, vrfy, I))
846 goto err; 846 goto err;
847 if (!BN_mod(vrfy, vrfy, rsa->n, ctx)) 847 if (!BN_mod_ct(vrfy, vrfy, rsa->n, ctx))
848 goto err; 848 goto err;
849 if (BN_is_negative(vrfy)) 849 if (BN_is_negative(vrfy))
850 if (!BN_add(vrfy, vrfy, rsa->n)) 850 if (!BN_add(vrfy, vrfy, rsa->n))