39 ARG_CHECK(output != NULL);
40 ARG_CHECK(point != NULL);
41 ARG_CHECK(scalar != NULL);
47 secp256k1_pubkey_load(ctx, &pt, point);
48 secp256k1_scalar_set_b32(&s, scalar, &overflow);
50 overflow |= secp256k1_scalar_is_zero(&s);
51 secp256k1_scalar_cmov(&s, &secp256k1_scalar_one, overflow);
53 secp256k1_ecmult_const(&
res, &pt, &s, 256);
54 secp256k1_ge_set_gej(&pt, &
res);
57 secp256k1_fe_normalize(&pt.
x);
58 secp256k1_fe_normalize(&pt.
y);
59 secp256k1_fe_get_b32(x, &pt.
x);
60 secp256k1_fe_get_b32(y, &pt.
y);
62 ret = hashfp(output, x, y, data);
66 secp256k1_scalar_clear(&s);
68 return !!ret & !overflow;
int secp256k1_ecdh(const secp256k1_context *ctx, unsigned char *output, const secp256k1_pubkey *point, const unsigned char *scalar, secp256k1_ecdh_hash_function hashfp, void *data)