Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/eckey_impl.h
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | static int secp256k1_eckey_pubkey_tweak_add(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak) { | ||||
if (secp256k1_gej_is_infinity(&pt)) { | if (secp256k1_gej_is_infinity(&pt)) { | ||||
return 0; | return 0; | ||||
} | } | ||||
secp256k1_ge_set_gej(key, &pt); | secp256k1_ge_set_gej(key, &pt); | ||||
return 1; | return 1; | ||||
} | } | ||||
static int secp256k1_eckey_privkey_tweak_mul(secp256k1_scalar *key, const secp256k1_scalar *tweak) { | static int secp256k1_eckey_privkey_tweak_mul(secp256k1_scalar *key, const secp256k1_scalar *tweak) { | ||||
if (secp256k1_scalar_is_zero(tweak)) { | int ret; | ||||
return 0; | ret = !secp256k1_scalar_is_zero(tweak); | ||||
} | |||||
secp256k1_scalar_mul(key, key, tweak); | secp256k1_scalar_mul(key, key, tweak); | ||||
return 1; | return ret; | ||||
} | } | ||||
static int secp256k1_eckey_pubkey_tweak_mul(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak) { | static int secp256k1_eckey_pubkey_tweak_mul(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak) { | ||||
secp256k1_scalar zero; | secp256k1_scalar zero; | ||||
secp256k1_gej pt; | secp256k1_gej pt; | ||||
if (secp256k1_scalar_is_zero(tweak)) { | if (secp256k1_scalar_is_zero(tweak)) { | ||||
return 0; | return 0; | ||||
} | } | ||||
Show All 9 Lines |