Skip to content

Commit 02a29d1

Browse files
committed
update
1 parent 007fcf9 commit 02a29d1

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

src/pop/third_party/secp256k1/scalar_8x32_impl.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -701,13 +701,13 @@ SECP256K1_INLINE static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r,
701701
shiftlimbs = shift >> 5;
702702
shiftlow = shift & 0x1F;
703703
shifthigh = 32 - shiftlow;
704-
r->d[0] = shift < 512 ? (l[0 + shiftlimbs] >> shiftlow | (shift < 480 && shiftlow ? (l[1 + shiftlimbs] << shifthigh) : 0)) : 0;
705-
r->d[1] = shift < 480 ? (l[1 + shiftlimbs] >> shiftlow | (shift < 448 && shiftlow ? (l[2 + shiftlimbs] << shifthigh) : 0)) : 0;
706-
r->d[2] = shift < 448 ? (l[2 + shiftlimbs] >> shiftlow | (shift < 416 && shiftlow ? (l[3 + shiftlimbs] << shifthigh) : 0)) : 0;
707-
r->d[3] = shift < 416 ? (l[3 + shiftlimbs] >> shiftlow | (shift < 384 && shiftlow ? (l[4 + shiftlimbs] << shifthigh) : 0)) : 0;
708-
r->d[4] = shift < 384 ? (l[4 + shiftlimbs] >> shiftlow | (shift < 352 && shiftlow ? (l[5 + shiftlimbs] << shifthigh) : 0)) : 0;
709-
r->d[5] = shift < 352 ? (l[5 + shiftlimbs] >> shiftlow | (shift < 320 && shiftlow ? (l[6 + shiftlimbs] << shifthigh) : 0)) : 0;
710-
r->d[6] = shift < 320 ? (l[6 + shiftlimbs] >> shiftlow | (shift < 288 && shiftlow ? (l[7 + shiftlimbs] << shifthigh) : 0)) : 0;
704+
r->d[0] = shift < 512 ? (l[0 + shiftlimbs] >> shiftlow | (shift < 480 && shiftlow != 0 ? (l[1 + shiftlimbs] << shifthigh) : 0)) : 0;
705+
r->d[1] = shift < 480 ? (l[1 + shiftlimbs] >> shiftlow | (shift < 448 && shiftlow != 0 ? (l[2 + shiftlimbs] << shifthigh) : 0)) : 0;
706+
r->d[2] = shift < 448 ? (l[2 + shiftlimbs] >> shiftlow | (shift < 416 && shiftlow != 0 ? (l[3 + shiftlimbs] << shifthigh) : 0)) : 0;
707+
r->d[3] = shift < 416 ? (l[3 + shiftlimbs] >> shiftlow | (shift < 384 && shiftlow != 0 ? (l[4 + shiftlimbs] << shifthigh) : 0)) : 0;
708+
r->d[4] = shift < 384 ? (l[4 + shiftlimbs] >> shiftlow | (shift < 352 && shiftlow != 0 ? (l[5 + shiftlimbs] << shifthigh) : 0)) : 0;
709+
r->d[5] = shift < 352 ? (l[5 + shiftlimbs] >> shiftlow | (shift < 320 && shiftlow != 0 ? (l[6 + shiftlimbs] << shifthigh) : 0)) : 0;
710+
r->d[6] = shift < 320 ? (l[6 + shiftlimbs] >> shiftlow | (shift < 288 && shiftlow != 0 ? (l[7 + shiftlimbs] << shifthigh) : 0)) : 0;
711711
r->d[7] = shift < 288 ? (l[7 + shiftlimbs] >> shiftlow) : 0;
712712
secp256k1_scalar_cadd_bit(r, 0, (l[(shift - 1) >> 5] >> ((shift - 1) & 0x1f)) & 1);
713713
}

src/pop/third_party/secp256k1/scalar_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static void secp256k1_scalar_inverse(secp256k1_scalar *r, const secp256k1_scalar
220220
}
221221

222222
SECP256K1_INLINE static int secp256k1_scalar_is_even(const secp256k1_scalar *a) {
223-
return !(a->d[0] & 1);
223+
return (a->d[0] & 1) == 0;
224224
}
225225
#endif
226226

src/pop/third_party/secp256k1/secp256k1.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ int secp256k1_ec_pubkey_parse(const secp256k1_context* ctx, secp256k1_pubkey* pu
261261
ARG_CHECK(pubkey != NULL);
262262
memset(pubkey, 0, sizeof(*pubkey));
263263
ARG_CHECK(input != NULL);
264-
if (!secp256k1_eckey_pubkey_parse(&Q, input, inputlen)) {
264+
if (secp256k1_eckey_pubkey_parse(&Q, input, inputlen) == 0) {
265265
return 0;
266266
}
267267
secp256k1_pubkey_save(pubkey, &Q);
@@ -347,9 +347,9 @@ int secp256k1_ecdsa_signature_parse_compact(const secp256k1_context* ctx, secp25
347347
ARG_CHECK(input64 != NULL);
348348

349349
secp256k1_scalar_set_b32(&r, &input64[0], &overflow);
350-
ret &= !overflow;
350+
ret &= overflow == 0;
351351
secp256k1_scalar_set_b32(&s, &input64[32], &overflow);
352-
ret &= !overflow;
352+
ret &= overflow == 0;
353353
if (ret) {
354354
secp256k1_ecdsa_signature_save(sig, &r, &s);
355355
} else {
@@ -414,9 +414,9 @@ int secp256k1_ecdsa_verify(const secp256k1_context* ctx, const secp256k1_ecdsa_s
414414

415415
secp256k1_scalar_set_b32(&m, msg32, NULL);
416416
secp256k1_ecdsa_signature_load(ctx, &r, &s, sig);
417-
return (!secp256k1_scalar_is_high(&s) &&
418-
secp256k1_pubkey_load(ctx, &q, pubkey) &&
419-
secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &r, &s, &q, &m));
417+
return (secp256k1_scalar_is_high(&s) == 0 &&
418+
secp256k1_pubkey_load(ctx, &q, pubkey) != 0 &&
419+
secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &r, &s, &q, &m) != 0);
420420
}
421421

422422
static SECP256K1_INLINE void buffer_append(unsigned char *buf, unsigned int *offset, const void *data, unsigned int len) {
@@ -473,18 +473,18 @@ int secp256k1_ecdsa_sign(const secp256k1_context* ctx, secp256k1_ecdsa_signature
473473

474474
secp256k1_scalar_set_b32(&sec, seckey, &overflow);
475475
/* Fail if the secret key is invalid. */
476-
if (!overflow && !secp256k1_scalar_is_zero(&sec)) {
476+
if (overflow == 0 && secp256k1_scalar_is_zero(&sec) == 0) {
477477
unsigned char nonce32[32];
478478
unsigned int count = 0;
479479
secp256k1_scalar_set_b32(&msg, msg32, NULL);
480480
while (1) {
481481
ret = noncefp(nonce32, msg32, seckey, NULL, (void*)noncedata, count);
482-
if (!ret) {
482+
if (ret == 0) {
483483
break;
484484
}
485485
secp256k1_scalar_set_b32(&non, nonce32, &overflow);
486-
if (!overflow && !secp256k1_scalar_is_zero(&non)) {
487-
if (secp256k1_ecdsa_sig_sign(&ctx->ecmult_gen_ctx, &r, &s, &sec, &msg, &non, NULL)) {
486+
if (overflow == 0 && secp256k1_scalar_is_zero(&non) == 0) {
487+
if (secp256k1_ecdsa_sig_sign(&ctx->ecmult_gen_ctx, &r, &s, &sec, &msg, &non, NULL) != 0) {
488488
break;
489489
}
490490
}
@@ -511,7 +511,7 @@ int secp256k1_ec_seckey_verify(const secp256k1_context* ctx, const unsigned char
511511
ARG_CHECK(seckey != NULL);
512512

513513
secp256k1_scalar_set_b32(&sec, seckey, &overflow);
514-
ret = !overflow && !secp256k1_scalar_is_zero(&sec);
514+
ret = overflow == 0 && secp256k1_scalar_is_zero(&sec) == 0;
515515
secp256k1_scalar_clear(&sec);
516516
return ret;
517517
}
@@ -529,8 +529,8 @@ int secp256k1_ec_pubkey_create(const secp256k1_context* ctx, secp256k1_pubkey *p
529529
ARG_CHECK(seckey != NULL);
530530

531531
secp256k1_scalar_set_b32(&sec, seckey, &overflow);
532-
ret = !overflow && !secp256k1_scalar_is_zero(&sec);
533-
if (ret) {
532+
ret = overflow == 0 && secp256k1_scalar_is_zero(&sec) == 0;
533+
if (ret != 0) {
534534
secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &pj, &sec);
535535
secp256k1_ge_set_gej(&p, &pj);
536536
secp256k1_pubkey_save(pubkey, &p);
@@ -579,9 +579,9 @@ int secp256k1_ec_privkey_tweak_add(const secp256k1_context* ctx, unsigned char *
579579
secp256k1_scalar_set_b32(&term, tweak, &overflow);
580580
secp256k1_scalar_set_b32(&sec, seckey, NULL);
581581

582-
ret = !overflow && secp256k1_eckey_privkey_tweak_add(&sec, &term);
582+
ret = overflow == 0 && secp256k1_eckey_privkey_tweak_add(&sec, &term) != 0;
583583
memset(seckey, 0, 32);
584-
if (ret) {
584+
if (ret != 0) {
585585
secp256k1_scalar_get_b32(seckey, &sec);
586586
}
587587

@@ -601,9 +601,9 @@ int secp256k1_ec_pubkey_tweak_add(const secp256k1_context* ctx, secp256k1_pubkey
601601
ARG_CHECK(tweak != NULL);
602602

603603
secp256k1_scalar_set_b32(&term, tweak, &overflow);
604-
ret = !overflow && secp256k1_pubkey_load(ctx, &p, pubkey);
604+
ret = overflow == 0 && secp256k1_pubkey_load(ctx, &p, pubkey) != 0;
605605
memset(pubkey, 0, sizeof(*pubkey));
606-
if (ret) {
606+
if (ret != 0) {
607607
if (secp256k1_eckey_pubkey_tweak_add(&ctx->ecmult_ctx, &p, &term)) {
608608
secp256k1_pubkey_save(pubkey, &p);
609609
} else {
@@ -625,9 +625,9 @@ int secp256k1_ec_privkey_tweak_mul(const secp256k1_context* ctx, unsigned char *
625625

626626
secp256k1_scalar_set_b32(&factor, tweak, &overflow);
627627
secp256k1_scalar_set_b32(&sec, seckey, NULL);
628-
ret = !overflow && secp256k1_eckey_privkey_tweak_mul(&sec, &factor);
628+
ret = overflow == 0 && secp256k1_eckey_privkey_tweak_mul(&sec, &factor) != 0;
629629
memset(seckey, 0, 32);
630-
if (ret) {
630+
if (ret != 0) {
631631
secp256k1_scalar_get_b32(seckey, &sec);
632632
}
633633

@@ -647,9 +647,9 @@ int secp256k1_ec_pubkey_tweak_mul(const secp256k1_context* ctx, secp256k1_pubkey
647647
ARG_CHECK(tweak != NULL);
648648

649649
secp256k1_scalar_set_b32(&factor, tweak, &overflow);
650-
ret = !overflow && secp256k1_pubkey_load(ctx, &p, pubkey);
650+
ret = overflow == 0 && secp256k1_pubkey_load(ctx, &p, pubkey) != 0;
651651
memset(pubkey, 0, sizeof(*pubkey));
652-
if (ret) {
652+
if (ret != 0) {
653653
if (secp256k1_eckey_pubkey_tweak_mul(&ctx->ecmult_ctx, &p, &factor)) {
654654
secp256k1_pubkey_save(pubkey, &p);
655655
} else {

src/pop/third_party/sha256.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ void sha256_update(sha256_context *ctx,
221221

222222
if (ctx->total[0] < (unsigned long)ilen) ctx->total[1]++;
223223

224-
if (left && ilen >= fill) {
224+
if (left != 0 && ilen >= fill) {
225225
memcpy((void *)(ctx->buffer + left), (void *)input, fill);
226226
sha2_process(ctx, ctx->buffer);
227227
input += fill;

0 commit comments

Comments
 (0)