Use bn_resize_words in BN_from_montgomery_word.
Saves a bit of work, and we get a width sanity-check. Bug: 232 Change-Id: I1c6bc376c9d8aaf60a078fdc39f35b6f44a688c6 Reviewed-on: https://boringssl-review.googlesource.com/25251 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
76ce04bec8
commit
7979dbede2
@ -316,15 +316,10 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r,
|
||||
}
|
||||
|
||||
int max = (2 * n->top); // carry is stored separately
|
||||
if (!bn_wexpand(r, max) ||
|
||||
if (!bn_resize_words(r, max) ||
|
||||
!bn_wexpand(ret, n->top)) {
|
||||
return 0;
|
||||
}
|
||||
// Clear the top words of |r|.
|
||||
if (max > r->top) {
|
||||
OPENSSL_memset(r->d + r->top, 0, (max - r->top) * sizeof(BN_ULONG));
|
||||
}
|
||||
r->top = max;
|
||||
ret->top = n->top;
|
||||
|
||||
if (!bn_from_montgomery_in_place(ret->d, ret->top, r->d, r->top, mont)) {
|
||||
|
Loading…
Reference in New Issue
Block a user