Avoid calling secp256k1_*_is_zero when secp256k1_*_set_b32 fails.

Most of the codebase correctly used short-cutting to avoid calling
 _is_zero on possibly incompletely initialized elements, but a few
 places were missed.
This commit is contained in:
Gregory Maxwell
2019-05-26 10:22:38 +00:00
parent 6c36de7a33
commit cd473e02c3
3 changed files with 4 additions and 4 deletions

View File

@@ -147,7 +147,7 @@ int secp256k1_ecdsa_sign_recoverable(const secp256k1_context* ctx, secp256k1_ecd
break;
}
secp256k1_scalar_set_b32(&non, nonce32, &overflow);
if (!secp256k1_scalar_is_zero(&non) && !overflow) {
if (!overflow && !secp256k1_scalar_is_zero(&non)) {
if (secp256k1_ecdsa_sig_sign(&ctx->ecmult_gen_ctx, &r, &s, &sec, &msg, &non, &recid)) {
break;
}