From 7d0d0996aa0e85734eaf5c8a3e6bd9e62604c166 Mon Sep 17 00:00:00 2001 From: Bodo Möller Date: Sun, 8 Apr 2001 18:23:44 +0000 Subject: binary algorithm for modular inversion --- crypto/bn/bn_mod.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crypto/bn/bn_mod.c') diff --git a/crypto/bn/bn_mod.c b/crypto/bn/bn_mod.c index 92fe11684c..5cf82480d7 100644 --- a/crypto/bn/bn_mod.c +++ b/crypto/bn/bn_mod.c @@ -150,8 +150,8 @@ int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_ int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m) { if (!BN_add(r, a, b)) return 0; - if (BN_cmp(r, m) >= 0) - return BN_sub(r, r, m); + if (BN_ucmp(r, m) >= 0) + return BN_usub(r, r, m); return 1; } -- cgit v1.2.3