Skip to content

Commit

Permalink
Clean up some BN_div variable declarations
Browse files Browse the repository at this point in the history
Bug: 358687140
Change-Id: Ifbc8bf34a93543c6035bfee29d915818ef2875db
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/70173
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
  • Loading branch information
davidben authored and Boringssl LUCI CQ committed Aug 14, 2024
1 parent 9cc6d47 commit 5615db6
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions crypto/fipsmodule/bn/div.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,11 @@ int BN_div(BIGNUM *quotient, BIGNUM *rem, const BIGNUM *numerator,
}

for (int i = 0; i < loop - 1; i++, wnump--, resp--) {
BN_ULONG q, l0;
// the first part of the loop uses the top two words of snum and sdiv to
// calculate a BN_ULONG q such that | wnum - sdiv * q | < sdiv
BN_ULONG n0, n1, rm = 0;

n0 = wnump[0];
n1 = wnump[-1];
BN_ULONG q, rm = 0;
BN_ULONG n0 = wnump[0];
BN_ULONG n1 = wnump[-1];
if (n0 == d0) {
q = BN_MASK2;
} else {
Expand Down Expand Up @@ -344,8 +342,7 @@ int BN_div(BIGNUM *quotient, BIGNUM *rem, const BIGNUM *numerator,
#endif // !BN_ULLONG
}

l0 = bn_mul_words(tmp->d, sdiv->d, div_n, q);
tmp->d[div_n] = l0;
tmp->d[div_n] = bn_mul_words(tmp->d, sdiv->d, div_n, q);
wnum.d--;
// ingore top values of the bignums just sub the two
// BN_ULONG arrays with bn_sub_words
Expand Down

0 comments on commit 5615db6

Please sign in to comment.