65 {
69 size_t outputlen = 33;
70 int i;
72 unsigned char msg[32];
73 unsigned char sig[74];
74 unsigned char spubkey[33];
75#ifdef ENABLE_MODULE_RECOVERY
77 int recid;
78#endif
79#ifdef ENABLE_MODULE_EXTRAKEYS
81#endif
82
83 for (i = 0; i < 32; i++) {
84 msg[i] = i + 1;
85 }
86
87
88 VALGRIND_MAKE_MEM_UNDEFINED(key, 32);
91 VALGRIND_MAKE_MEM_DEFINED(&
ret,
sizeof(
ret));
94
95
96 VALGRIND_MAKE_MEM_UNDEFINED(key, 32);
99 VALGRIND_MAKE_MEM_DEFINED(&
ret,
sizeof(
ret));
102
103#ifdef ENABLE_MODULE_ECDH
104
105 VALGRIND_MAKE_MEM_UNDEFINED(key, 32);
107 VALGRIND_MAKE_MEM_DEFINED(&
ret,
sizeof(
ret));
109#endif
110
111#ifdef ENABLE_MODULE_RECOVERY
112
113 VALGRIND_MAKE_MEM_UNDEFINED(key, 32);
115 VALGRIND_MAKE_MEM_DEFINED(&recoverable_signature, sizeof(recoverable_signature));
116 VALGRIND_MAKE_MEM_DEFINED(&
ret,
sizeof(
ret));
119 CHECK(recid >= 0 && recid <= 3);
120#endif
121
122 VALGRIND_MAKE_MEM_UNDEFINED(key, 32);
124 VALGRIND_MAKE_MEM_DEFINED(&
ret,
sizeof(
ret));
126
127 VALGRIND_MAKE_MEM_UNDEFINED(key, 32);
129 VALGRIND_MAKE_MEM_DEFINED(&
ret,
sizeof(
ret));
131
132 VALGRIND_MAKE_MEM_UNDEFINED(key, 32);
133 VALGRIND_MAKE_MEM_UNDEFINED(msg, 32);
135 VALGRIND_MAKE_MEM_DEFINED(&
ret,
sizeof(
ret));
137
138 VALGRIND_MAKE_MEM_UNDEFINED(key, 32);
139 VALGRIND_MAKE_MEM_UNDEFINED(msg, 32);
141 VALGRIND_MAKE_MEM_DEFINED(&
ret,
sizeof(
ret));
143
144
145#ifdef ENABLE_MODULE_EXTRAKEYS
146 VALGRIND_MAKE_MEM_UNDEFINED(key, 32);
148 VALGRIND_MAKE_MEM_DEFINED(&
ret,
sizeof(
ret));
150
151
152 VALGRIND_MAKE_MEM_DEFINED(msg, 32);
154 VALGRIND_MAKE_MEM_DEFINED(&
ret,
sizeof(
ret));
156
157 VALGRIND_MAKE_MEM_UNDEFINED(key, 32);
158 VALGRIND_MAKE_MEM_UNDEFINED(&keypair, sizeof(keypair));
160 VALGRIND_MAKE_MEM_DEFINED(&
ret,
sizeof(
ret));
162#endif
163
164#ifdef ENABLE_MODULE_SCHNORRSIG
165 VALGRIND_MAKE_MEM_UNDEFINED(key, 32);
167 VALGRIND_MAKE_MEM_DEFINED(&
ret,
sizeof(
ret));
170 VALGRIND_MAKE_MEM_DEFINED(&
ret,
sizeof(
ret));
172#endif
173}
fc::array< char, 72 > signature
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_tweak_mul(const secp256k1_context *ctx, unsigned char *seckey, const unsigned char *tweak32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_negate(const secp256k1_context *ctx, unsigned char *seckey) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2)
SECP256K1_API int secp256k1_ec_pubkey_serialize(const secp256k1_context *ctx, unsigned char *output, size_t *outputlen, const secp256k1_pubkey *pubkey, unsigned int flags) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_verify(const secp256k1_context *ctx, const unsigned char *seckey) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2)
SECP256K1_API int secp256k1_ecdsa_sign(const secp256k1_context *ctx, secp256k1_ecdsa_signature *sig, const unsigned char *msghash32, const unsigned char *seckey, secp256k1_nonce_function noncefp, const void *ndata) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
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)
#define SECP256K1_EC_COMPRESSED
SECP256K1_API int secp256k1_ecdsa_signature_serialize_der(const secp256k1_context *ctx, unsigned char *output, size_t *outputlen, const secp256k1_ecdsa_signature *sig) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_tweak_add(const secp256k1_context *ctx, unsigned char *seckey, const unsigned char *tweak32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdh(const secp256k1_context *ctx, unsigned char *output, const secp256k1_pubkey *pubkey, const unsigned char *seckey, secp256k1_ecdh_hash_function hashfp, void *data) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
SECP256K1_API int secp256k1_ecdsa_recoverable_signature_serialize_compact(const secp256k1_context *ctx, unsigned char *output64, int *recid, const secp256k1_ecdsa_recoverable_signature *sig) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
SECP256K1_API int secp256k1_ecdsa_sign_recoverable(const secp256k1_context *ctx, secp256k1_ecdsa_recoverable_signature *sig, const unsigned char *msghash32, const unsigned char *seckey, secp256k1_nonce_function noncefp, const void *ndata) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
SECP256K1_API int secp256k1_schnorrsig_sign32(const secp256k1_context *ctx, unsigned char *sig64, const unsigned char *msg32, const secp256k1_keypair *keypair, const unsigned char *aux_rand32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)