Merge pull request #228

27bc131 Silence some warnings from pedantic static analysis tools, improve compatibility with C++. (Gregory Maxwell)
pull/11871/head
Pieter Wuille 10 years ago
commit 3087bc4d75
No known key found for this signature in database
GPG Key ID: 57896D2FF8F0B657

@ -46,7 +46,7 @@ static void secp256k1_ecmult_gen_start(void) {
/* Construct a group element with no known corresponding scalar (nothing up my sleeve). */ /* Construct a group element with no known corresponding scalar (nothing up my sleeve). */
{ {
static const unsigned char nums_b32[32] = "The scalar for this x is unknown"; static const unsigned char nums_b32[33] = "The scalar for this x is unknown";
secp256k1_fe_t nums_x; secp256k1_fe_t nums_x;
secp256k1_ge_t nums_ge; secp256k1_ge_t nums_ge;
VERIFY_CHECK(secp256k1_fe_set_b32(&nums_x, nums_b32)); VERIFY_CHECK(secp256k1_fe_set_b32(&nums_x, nums_b32));

@ -1064,7 +1064,9 @@ static void secp256k1_fe_sqr(secp256k1_fe_t *r, const secp256k1_fe_t *a) {
} }
static SECP256K1_INLINE void secp256k1_fe_storage_cmov(secp256k1_fe_storage_t *r, const secp256k1_fe_storage_t *a, int flag) { static SECP256K1_INLINE void secp256k1_fe_storage_cmov(secp256k1_fe_storage_t *r, const secp256k1_fe_storage_t *a, int flag) {
uint32_t mask0 = flag + ~((uint32_t)0), mask1 = ~mask0; uint32_t mask0, mask1;
mask0 = flag + ~((uint32_t)0);
mask1 = ~mask0;
r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1); r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1);
r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1); r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1);
r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1); r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1);

@ -400,7 +400,9 @@ static void secp256k1_fe_sqr(secp256k1_fe_t *r, const secp256k1_fe_t *a) {
} }
static SECP256K1_INLINE void secp256k1_fe_storage_cmov(secp256k1_fe_storage_t *r, const secp256k1_fe_storage_t *a, int flag) { static SECP256K1_INLINE void secp256k1_fe_storage_cmov(secp256k1_fe_storage_t *r, const secp256k1_fe_storage_t *a, int flag) {
uint64_t mask0 = flag + ~((uint64_t)0), mask1 = ~mask0; uint64_t mask0, mask1;
mask0 = flag + ~((uint64_t)0);
mask1 = ~mask0;
r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1); r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1);
r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1); r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1);
r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1); r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1);

@ -462,7 +462,7 @@ static void secp256k1_scalar_reduce_512(secp256k1_scalar_t *r, const uint32_t *l
secp256k1_scalar_reduce(r, c + secp256k1_scalar_check_overflow(r)); secp256k1_scalar_reduce(r, c + secp256k1_scalar_check_overflow(r));
} }
static void secp256k1_scalar_mul_512(uint32_t l[16], const secp256k1_scalar_t *a, const secp256k1_scalar_t *b) { static void secp256k1_scalar_mul_512(uint32_t *l, const secp256k1_scalar_t *a, const secp256k1_scalar_t *b) {
/* 96 bit accumulator. */ /* 96 bit accumulator. */
uint32_t c0 = 0, c1 = 0, c2 = 0; uint32_t c0 = 0, c1 = 0, c2 = 0;
@ -550,7 +550,7 @@ static void secp256k1_scalar_mul_512(uint32_t l[16], const secp256k1_scalar_t *a
l[15] = c0; l[15] = c0;
} }
static void secp256k1_scalar_sqr_512(uint32_t l[16], const secp256k1_scalar_t *a) { static void secp256k1_scalar_sqr_512(uint32_t *l, const secp256k1_scalar_t *a) {
/* 96 bit accumulator. */ /* 96 bit accumulator. */
uint32_t c0 = 0, c1 = 0, c2 = 0; uint32_t c0 = 0, c1 = 0, c2 = 0;

Loading…
Cancel
Save