Explicitly guarantee BN_MONT_CTX::{RR,N} have the same width.
This is so the *_small functions can assume somewhat more uniform
widths, to simplify their error-handling.
Change-Id: I0420cb237084b253e918c64b0c170a5dfd99ab40
Reviewed-on: https://boringssl-review.googlesource.com/27584
Reviewed-by: Adam Langley <alangley@gmail.com>
diff --git a/include/openssl/bn.h b/include/openssl/bn.h
index b0f8a2d..90b4b36 100644
--- a/include/openssl/bn.h
+++ b/include/openssl/bn.h
@@ -957,9 +957,10 @@
};
struct bn_mont_ctx_st {
- // RR is R^2, reduced modulo |N|. It is used to convert to Montgomery form.
+ // RR is R^2, reduced modulo |N|. It is used to convert to Montgomery form. It
+ // is guaranteed to have the same width as |N|.
BIGNUM RR;
- // N is the modulus. It is always stored in minimal form, so |N.top|
+ // N is the modulus. It is always stored in minimal form, so |N.width|
// determines R.
BIGNUM N;
BN_ULONG n0[2]; // least significant words of (R*Ri-1)/N