This PR unifies handling of invalid secret keys by introducing a new function scalar_set_b32_secret
which returns false if the b32 overflows or is 0. By using this in privkey_{negate, tweak_add, tweak_mul}
these function will now return 0 if the secret key is invalid which matches the behavior of ecdsa_sign
and pubkey_create
.
Instead of deciding whether to zeroize the secret key on failure, I only added documentation for now that the value is undefined on failure.