Return 0 if the given seckey is invalid in privkey_negate, privkey_tweak_add and privkey_tweak_mul

This commit is contained in:
Jonas Nick
2019-12-17 16:52:07 +00:00
parent 8f814cddb9
commit 5894e1f1df
4 changed files with 77 additions and 20 deletions

View File

@@ -54,10 +54,7 @@ static int secp256k1_eckey_pubkey_serialize(secp256k1_ge *elem, unsigned char *p
static int secp256k1_eckey_privkey_tweak_add(secp256k1_scalar *key, const secp256k1_scalar *tweak) {
secp256k1_scalar_add(key, key, tweak);
if (secp256k1_scalar_is_zero(key)) {
return 0;
}
return 1;
return !secp256k1_scalar_is_zero(key);
}
static int secp256k1_eckey_pubkey_tweak_add(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak) {