From 8bde5d2e51b204e4e800137b68bb37fb3f08f18a Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Wed, 11 Nov 2015 18:36:23 -1000 Subject: [PATCH] Remove the unused |Ni| member of |BN_MONT_CTX|. Change-Id: I0a542c48c7adae28f05778d6c34c9b6836fc3449 Reviewed-on: https://boringssl-review.googlesource.com/6480 Reviewed-by: Adam Langley --- crypto/bn/montgomery.c | 5 +---- include/openssl/bn.h | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/crypto/bn/montgomery.c b/crypto/bn/montgomery.c index 11edcbf7..07e1a415 100644 --- a/crypto/bn/montgomery.c +++ b/crypto/bn/montgomery.c @@ -134,7 +134,6 @@ BN_MONT_CTX *BN_MONT_CTX_new(void) { 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 @@ void BN_MONT_CTX_free(BN_MONT_CTX *mont) { BN_free(&mont->RR); BN_free(&mont->N); - BN_free(&mont->Ni); OPENSSL_free(mont); } @@ -156,8 +154,7 @@ BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, const BN_MONT_CTX *from) { } 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 01115c82..cbc1ee7a 100644 --- a/include/openssl/bn.h +++ b/include/openssl/bn.h @@ -836,10 +836,7 @@ struct bignum_st { 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 */ };