Skip to content

Commit

Permalink
Merge dashpay#841: Avoids a potentially shortening size_t to int cast…
Browse files Browse the repository at this point in the history
… in strauss_wnaf_

8893f42 Avoids a potentially shortening size_t to int cast in strauss_wnaf_ (Tim Ruffing)

Pull request description:

ACKs for top commit:
  sipa:
    ACK 8893f42. `np` and `no` shouldn't ever take on negative values.
  jonasnick:
    ACK 8893f42
  elichai:
    ACK 8893f42

Tree-SHA512: 431a6b88c8db8c8883b35c9bc03c90e37ecd0b06c7ee01c5d83cca4a7f6fc1f3cfbbaa871a4a23374ce4cc5bcfb9502c7f2e2540f9f9db9535e47e48827b6af6
  • Loading branch information
jonasnick committed Oct 27, 2020
2 parents ac05f61 + 8893f42 commit 6f54e69
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ecmult_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ struct secp256k1_strauss_state {
struct secp256k1_strauss_point_state* ps;
};

static void secp256k1_ecmult_strauss_wnaf(const secp256k1_ecmult_context *ctx, const struct secp256k1_strauss_state *state, secp256k1_gej *r, int num, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng) {
static void secp256k1_ecmult_strauss_wnaf(const secp256k1_ecmult_context *ctx, const struct secp256k1_strauss_state *state, secp256k1_gej *r, size_t num, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng) {
secp256k1_ge tmpa;
secp256k1_fe Z;
/* Splitted G factors. */
Expand All @@ -454,8 +454,8 @@ static void secp256k1_ecmult_strauss_wnaf(const secp256k1_ecmult_context *ctx, c
int bits_ng_128 = 0;
int i;
int bits = 0;
int np;
int no = 0;
size_t np;
size_t no = 0;

for (np = 0; np < num; ++np) {
if (secp256k1_scalar_is_zero(&na[np]) || secp256k1_gej_is_infinity(&a[np])) {
Expand Down

0 comments on commit 6f54e69

Please sign in to comment.