mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-11 11:16:09 -05:00
Add ARG_CHECKs to secp256k1_ec_pubkey_parse/secp256k1_ec_pubkey_serialize
This also makes secp256k1_ec_pubkey_parse's init of pubkey more unconditional.
This commit is contained in:
parent
7450ef171d
commit
ee2cb4007d
1 changed files with 8 additions and 1 deletions
|
@ -146,8 +146,11 @@ int secp256k1_ec_pubkey_parse(const secp256k1_context* ctx, secp256k1_pubkey* pu
|
||||||
secp256k1_ge Q;
|
secp256k1_ge Q;
|
||||||
|
|
||||||
(void)ctx;
|
(void)ctx;
|
||||||
if (!secp256k1_eckey_pubkey_parse(&Q, input, inputlen)) {
|
VERIFY_CHECK(ctx != NULL);
|
||||||
|
ARG_CHECK(pubkey != NULL);
|
||||||
memset(pubkey, 0, sizeof(*pubkey));
|
memset(pubkey, 0, sizeof(*pubkey));
|
||||||
|
ARG_CHECK(input != NULL);
|
||||||
|
if (!secp256k1_eckey_pubkey_parse(&Q, input, inputlen)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
secp256k1_pubkey_save(pubkey, &Q);
|
secp256k1_pubkey_save(pubkey, &Q);
|
||||||
|
@ -159,6 +162,10 @@ int secp256k1_ec_pubkey_serialize(const secp256k1_context* ctx, unsigned char *o
|
||||||
secp256k1_ge Q;
|
secp256k1_ge Q;
|
||||||
|
|
||||||
(void)ctx;
|
(void)ctx;
|
||||||
|
VERIFY_CHECK(ctx != NULL);
|
||||||
|
ARG_CHECK(output != NULL);
|
||||||
|
ARG_CHECK(outputlen != NULL);
|
||||||
|
ARG_CHECK(pubkey != NULL);
|
||||||
return (secp256k1_pubkey_load(ctx, &Q, pubkey) &&
|
return (secp256k1_pubkey_load(ctx, &Q, pubkey) &&
|
||||||
secp256k1_eckey_pubkey_serialize(&Q, output, outputlen, flags));
|
secp256k1_eckey_pubkey_serialize(&Q, output, outputlen, flags));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue