Skip to content

Commit 6875b01

Browse files
committed
Merge bitcoin#386: Add some missing VERIFY_CHECK(ctx != NULL)
bcc4881 Add some missing `VERIFY_CHECK(ctx != NULL)` for functions that use `ARG_CHECK` (Andrew Poelstra)
2 parents 2c52b5d + bcc4881 commit 6875b01

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/secp256k1.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ static void secp256k1_pubkey_save(secp256k1_pubkey* pubkey, secp256k1_ge* ge) {
150150
int secp256k1_ec_pubkey_parse(const secp256k1_context* ctx, secp256k1_pubkey* pubkey, const unsigned char *input, size_t inputlen) {
151151
secp256k1_ge Q;
152152

153-
(void)ctx;
154153
VERIFY_CHECK(ctx != NULL);
155154
ARG_CHECK(pubkey != NULL);
156155
memset(pubkey, 0, sizeof(*pubkey));
@@ -168,7 +167,6 @@ int secp256k1_ec_pubkey_serialize(const secp256k1_context* ctx, unsigned char *o
168167
size_t len;
169168
int ret = 0;
170169

171-
(void)ctx;
172170
VERIFY_CHECK(ctx != NULL);
173171
ARG_CHECK(outputlen != NULL);
174172
ARG_CHECK(*outputlen >= ((flags & SECP256K1_FLAGS_BIT_COMPRESSION) ? 33 : 65));
@@ -214,7 +212,7 @@ static void secp256k1_ecdsa_signature_save(secp256k1_ecdsa_signature* sig, const
214212
int secp256k1_ecdsa_signature_parse_der(const secp256k1_context* ctx, secp256k1_ecdsa_signature* sig, const unsigned char *input, size_t inputlen) {
215213
secp256k1_scalar r, s;
216214

217-
(void)ctx;
215+
VERIFY_CHECK(ctx != NULL);
218216
ARG_CHECK(sig != NULL);
219217
ARG_CHECK(input != NULL);
220218

@@ -232,7 +230,7 @@ int secp256k1_ecdsa_signature_parse_compact(const secp256k1_context* ctx, secp25
232230
int ret = 1;
233231
int overflow = 0;
234232

235-
(void)ctx;
233+
VERIFY_CHECK(ctx != NULL);
236234
ARG_CHECK(sig != NULL);
237235
ARG_CHECK(input64 != NULL);
238236

@@ -251,7 +249,7 @@ int secp256k1_ecdsa_signature_parse_compact(const secp256k1_context* ctx, secp25
251249
int secp256k1_ecdsa_signature_serialize_der(const secp256k1_context* ctx, unsigned char *output, size_t *outputlen, const secp256k1_ecdsa_signature* sig) {
252250
secp256k1_scalar r, s;
253251

254-
(void)ctx;
252+
VERIFY_CHECK(ctx != NULL);
255253
ARG_CHECK(output != NULL);
256254
ARG_CHECK(outputlen != NULL);
257255
ARG_CHECK(sig != NULL);
@@ -263,7 +261,7 @@ int secp256k1_ecdsa_signature_serialize_der(const secp256k1_context* ctx, unsign
263261
int secp256k1_ecdsa_signature_serialize_compact(const secp256k1_context* ctx, unsigned char *output64, const secp256k1_ecdsa_signature* sig) {
264262
secp256k1_scalar r, s;
265263

266-
(void)ctx;
264+
VERIFY_CHECK(ctx != NULL);
267265
ARG_CHECK(output64 != NULL);
268266
ARG_CHECK(sig != NULL);
269267

@@ -396,7 +394,6 @@ int secp256k1_ec_seckey_verify(const secp256k1_context* ctx, const unsigned char
396394
int overflow;
397395
VERIFY_CHECK(ctx != NULL);
398396
ARG_CHECK(seckey != NULL);
399-
(void)ctx;
400397

401398
secp256k1_scalar_set_b32(&sec, seckey, &overflow);
402399
ret = !overflow && !secp256k1_scalar_is_zero(&sec);
@@ -435,7 +432,6 @@ int secp256k1_ec_privkey_tweak_add(const secp256k1_context* ctx, unsigned char *
435432
VERIFY_CHECK(ctx != NULL);
436433
ARG_CHECK(seckey != NULL);
437434
ARG_CHECK(tweak != NULL);
438-
(void)ctx;
439435

440436
secp256k1_scalar_set_b32(&term, tweak, &overflow);
441437
secp256k1_scalar_set_b32(&sec, seckey, NULL);
@@ -483,7 +479,6 @@ int secp256k1_ec_privkey_tweak_mul(const secp256k1_context* ctx, unsigned char *
483479
VERIFY_CHECK(ctx != NULL);
484480
ARG_CHECK(seckey != NULL);
485481
ARG_CHECK(tweak != NULL);
486-
(void)ctx;
487482

488483
secp256k1_scalar_set_b32(&factor, tweak, &overflow);
489484
secp256k1_scalar_set_b32(&sec, seckey, NULL);

0 commit comments

Comments
 (0)