Merge bitcoin-core/secp256k1#1009: refactor: Use (int)&(int) in boolean context to avoid compiler warning
16d132215c
refactor: Use (int)&(int) in boolean context to avoid compiler warning (MarcoFalke) Pull request description: This one should *really* be only a refactor with the goal to silence static analysis warnings. clang-14 (trunk) recently added one in commitf62d18ff14
and I expect other tools will offer similar warnings. Follow up to #1006, which was not a refactor. ACKs for top commit: real-or-random: ACK16d132215c
jonasnick: ACK16d132215c
Tree-SHA512: c465522ea4ddb58b5974c95bc36423c453e6fcf5948cb32114172113b5244209ceaa9418ec86ebe210390ae5509c2f24a42c41a7353de4cfb8fd063b0d5c0e79
This commit is contained in:
commit
74c34e727b
|
@ -304,12 +304,12 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
|
||||||
high = secp256k1_scalar_is_high(sigs);
|
high = secp256k1_scalar_is_high(sigs);
|
||||||
secp256k1_scalar_cond_negate(sigs, high);
|
secp256k1_scalar_cond_negate(sigs, high);
|
||||||
if (recid) {
|
if (recid) {
|
||||||
*recid ^= high;
|
*recid ^= high;
|
||||||
}
|
}
|
||||||
/* P.x = order is on the curve, so technically sig->r could end up being zero, which would be an invalid signature.
|
/* P.x = order is on the curve, so technically sig->r could end up being zero, which would be an invalid signature.
|
||||||
* This is cryptographically unreachable as hitting it requires finding the discrete log of P.x = N.
|
* This is cryptographically unreachable as hitting it requires finding the discrete log of P.x = N.
|
||||||
*/
|
*/
|
||||||
return !secp256k1_scalar_is_zero(sigr) & !secp256k1_scalar_is_zero(sigs);
|
return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SECP256K1_ECDSA_IMPL_H */
|
#endif /* SECP256K1_ECDSA_IMPL_H */
|
||||||
|
|
Loading…
Reference in New Issue