summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_gcd.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2001-04-08 18:41:35 +0000
committerBodo Möller <bodo@openssl.org>2001-04-08 18:41:35 +0000
commit124d8cf701cb363415746d258fe30f42b989540d (patch)
treec80146820d744acb96084951f01a9b481f27815e /crypto/bn/bn_gcd.c
parent7d0d0996aa0e85734eaf5c8a3e6bd9e62604c166 (diff)
code documentation
Diffstat (limited to 'crypto/bn/bn_gcd.c')
-rw-r--r--crypto/bn/bn_gcd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/crypto/bn/bn_gcd.c b/crypto/bn/bn_gcd.c
index 2c6fb2379a..1691877f31 100644
--- a/crypto/bn/bn_gcd.c
+++ b/crypto/bn/bn_gcd.c
@@ -254,7 +254,8 @@ BIGNUM *BN_mod_inverse(BIGNUM *in,
while (!BN_is_zero(B))
{
/*
- * 0 < B < A <= |n|,
+ * 0 < B < |n|,
+ * 0 < A <= |n|,
* (1) -sign*X*a == B (mod |n|),
* (2) sign*Y*a == A (mod |n|)
*/
@@ -299,13 +300,16 @@ BIGNUM *BN_mod_inverse(BIGNUM *in,
}
- /* We still have (1) and (2), but A may no longer be larger than B.
+ /* We still have (1) and (2).
* Both A and B are odd.
* The following computations ensure that
*
- * 0 =< B < A = |n|,
+ * 0 <= B < |n|,
+ * 0 < A < |n|,
* (1) -sign*X*a == B (mod |n|),
- * (2) sign*Y*a == A (mod |n|)
+ * (2) sign*Y*a == A (mod |n|),
+ *
+ * and that either A or B is even in the next iteration.
*/
if (BN_ucmp(B, A) >= 0)
{