diff options
author | Bodo Möller <bodo@openssl.org> | 2000-01-27 13:00:10 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2000-01-27 13:00:10 +0000 |
commit | ec1258dd446e39649f846ee870721ca4dfe56cff (patch) | |
tree | de27c84434bcf6293327c8f5b1b9c15532465663 /crypto | |
parent | b99b110766b23729f1f123ba68d02788229dedda (diff) | |
download | openssl-ec1258dd446e39649f846ee870721ca4dfe56cff.tar.gz |
Update comments to provide a better approximation of reality.
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/bn/bn.h | 5 | ||||
-rw-r--r-- | crypto/bn/bn_mont.c | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/crypto/bn/bn.h b/crypto/bn/bn.h index 456d34f59b..9c92d76b41 100644 --- a/crypto/bn/bn.h +++ b/crypto/bn/bn.h @@ -262,8 +262,9 @@ typedef struct bn_mont_ctx_st int ri; /* number of bits in R */ BIGNUM RR; /* used to convert to montgomery form */ BIGNUM N; /* The modulus */ - BIGNUM Ni; /* The inverse of N (bignum form) */ - BN_ULONG n0; /* The inverse of N in word form */ + BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 + * (Ni is only stored for bignum algorithm) */ + BN_ULONG n0; /* least significant word of Ni */ int flags; } BN_MONT_CTX; diff --git a/crypto/bn/bn_mont.c b/crypto/bn/bn_mont.c index 5ef08d9157..cdf7ca191a 100644 --- a/crypto/bn/bn_mont.c +++ b/crypto/bn/bn_mont.c @@ -304,7 +304,8 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) BN_sub_word(&Ri,1); else /* if N mod word size == 1 */ BN_set_word(&Ri,BN_MASK2); /* Ri-- (mod word size) */ - BN_div(&Ri,NULL,&Ri,&tmod,ctx); /* Ni = (R*Ri-1)/N */ + BN_div(&Ri,NULL,&Ri,&tmod,ctx); /* Ni = (R*Ri-1)/N, + * keep only list significant word: */ mont->n0=Ri.d[0]; BN_free(&Ri); } |