20 unsigned char xy_sk[32];
21 unsigned char buf32[32];
22 unsigned char ones32[32];
23 unsigned char zeros64[64] = { 0 };
28 memset(ones32, 0xFF, 32);
38 memset(&pk, 0,
sizeof(pk));
42 memset(sk, 0,
sizeof(sk));
47 CHECK(pk_parity == 0);
55 CHECK(pk_parity == 1);
56 secp256k1_pubkey_load(CTX, &pk1, &pk);
70 memset(&pk_tmp, 0,
sizeof(pk_tmp));
86 memset(&xonly_pk, 1,
sizeof(xonly_pk));
90 memset(&xonly_pk, 1,
sizeof(xonly_pk));
97 for (i = 0; i <
COUNT; i++) {
98 unsigned char rand33[33];
99 testrand256(&rand33[1]);
102 memset(&xonly_pk, 1,
sizeof(xonly_pk));
112 unsigned char pk1_ser[32] = {
113 0x58, 0x84, 0xb3, 0xa2, 0x4b, 0x97, 0x37, 0x88, 0x92, 0x38, 0xa6, 0x26, 0x62, 0x52, 0x35, 0x11,
114 0xd0, 0x9a, 0xa1, 0x1b, 0x80, 0x0b, 0x5e, 0x93, 0x80, 0x26, 0x11, 0xef, 0x67, 0x4b, 0xd9, 0x23
116 const unsigned char pk2_ser[32] = {
117 0xde, 0x36, 0x0e, 0x87, 0x59, 0x8f, 0x3c, 0x01, 0x36, 0x2a, 0x2a, 0xb8, 0xc6, 0xf4, 0x5e, 0x4d,
118 0xb2, 0xc2, 0xd5, 0x03, 0xa7, 0xf9, 0xf1, 0x4f, 0xa8, 0xfa, 0x95, 0xa8, 0xe9, 0x69, 0x76, 0x1c
132 memset(&pk1, 0,
sizeof(pk1));
145 unsigned char zeros64[64] = { 0 };
146 unsigned char overflows[32];
147 unsigned char sk[32];
152 unsigned char tweak[32];
155 memset(overflows, 0xff,
sizeof(overflows));
180 for (i = 0; i <
COUNT; i++) {
184 secp256k1_scalar_set_b32(&scalar_tweak, sk, NULL);
185 secp256k1_scalar_negate(&scalar_tweak, &scalar_tweak);
186 secp256k1_scalar_get_b32(
tweak, &scalar_tweak);
193 memset(&internal_xonly_pk, 0,
sizeof(internal_xonly_pk));
200 unsigned char zeros64[64] = { 0 };
201 unsigned char overflows[32];
202 unsigned char sk[32];
207 unsigned char output_pk32[32];
208 unsigned char buf32[32];
210 unsigned char tweak[32];
212 memset(overflows, 0xff,
sizeof(overflows));
254 unsigned char sk[32];
256 unsigned char pk_serialized[32];
283 unsigned char sk[32];
284 unsigned char sk_tmp[32];
285 unsigned char zeros96[96] = { 0 };
286 unsigned char overflows[32];
290 int pk_parity, pk_parity_tmp;
292 CHECK(
sizeof(zeros96) ==
sizeof(keypair));
293 memset(overflows, 0xFF,
sizeof(overflows));
323 memset(&keypair, 0,
sizeof(keypair));
344 memset(&keypair, 0,
sizeof(keypair));
354 CHECK(pk_parity == pk_parity_tmp);
371 memset(&keypair, 0,
sizeof(keypair));
377 unsigned char sk[32];
379 unsigned char overflows[32];
380 unsigned char zeros96[96] = { 0 };
381 unsigned char tweak[32];
384 CHECK(
sizeof(zeros96) ==
sizeof(keypair));
387 memset(overflows, 0xFF, 32);
408 for (i = 0; i <
COUNT; i++) {
413 memcpy(&keypair_tmp, &keypair,
sizeof(keypair));
416 secp256k1_scalar_set_b32(&scalar_tweak, sk, NULL);
417 secp256k1_scalar_negate(&scalar_tweak, &scalar_tweak);
418 secp256k1_scalar_get_b32(
tweak, &scalar_tweak);
426 memset(&keypair, 0,
sizeof(keypair));
432 memset(&keypair, 0, 32);
436 memset(&keypair.
data[32], 0, 64);
441 for (i = 0; i <
COUNT; i++) {
446 unsigned char pk32[32];
447 unsigned char sk32[32];
SECP256K1_API void secp256k1_context_set_illegal_callback(secp256k1_context *ctx, void(*fun)(const char *message, void *data), const void *data) SECP256K1_ARG_NONNULL(1)
Set a callback function to be called when an illegal argument is passed to an API call.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_parse(const secp256k1_context *ctx, secp256k1_pubkey *pubkey, const unsigned char *input, size_t inputlen) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Parse a variable-length public key into the pubkey object.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_create(const secp256k1_context *ctx, secp256k1_pubkey *pubkey, const unsigned char *seckey) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Compute the public key for a secret key.