Remove the unused |Ni| member of |BN_MONT_CTX|.
Change-Id: I0a542c48c7adae28f05778d6c34c9b6836fc3449
Reviewed-on: https://boringssl-review.googlesource.com/6480
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/bn/montgomery.c b/crypto/bn/montgomery.c
index 11edcbf..07e1a41 100644
--- a/crypto/bn/montgomery.c
+++ b/crypto/bn/montgomery.c
@@ -134,7 +134,6 @@
memset(ret, 0, sizeof(BN_MONT_CTX));
BN_init(&ret->RR);
BN_init(&ret->N);
- BN_init(&ret->Ni);
return ret;
}
@@ -146,7 +145,6 @@
BN_free(&mont->RR);
BN_free(&mont->N);
- BN_free(&mont->Ni);
OPENSSL_free(mont);
}
@@ -156,8 +154,7 @@
}
if (!BN_copy(&to->RR, &from->RR) ||
- !BN_copy(&to->N, &from->N) ||
- !BN_copy(&to->Ni, &from->Ni)) {
+ !BN_copy(&to->N, &from->N)) {
return NULL;
}
to->ri = from->ri;
diff --git a/include/openssl/bn.h b/include/openssl/bn.h
index 01115c8..cbc1ee7 100644
--- a/include/openssl/bn.h
+++ b/include/openssl/bn.h
@@ -836,10 +836,7 @@
struct bn_mont_ctx_st {
BIGNUM RR; /* used to convert to montgomery form */
BIGNUM N; /* The modulus */
- BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1
- * (Ni is only stored for bignum algorithm) */
- BN_ULONG n0[2]; /* least significant word(s) of Ni;
- (type changed with 0.9.9, was "BN_ULONG n0;" before) */
+ BN_ULONG n0[2]; /* least significant words of (R*Ri-1)/N */
int ri; /* number of bits in R */
};