Skip to content

Commit

Permalink
Merge pull request bitcoin#319
Browse files Browse the repository at this point in the history
67f7da4 Extensive interface and operations tests for secp256k1_ec_pubkey_parse. (Gregory Maxwell)
ee2cb40 Add ARG_CHECKs to secp256k1_ec_pubkey_parse/secp256k1_ec_pubkey_serialize (Gregory Maxwell)
  • Loading branch information
sipa committed Oct 14, 2015
2 parents 7450ef1 + 67f7da4 commit c98df26
Show file tree
Hide file tree
Showing 2 changed files with 415 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/secp256k1.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,11 @@ int secp256k1_ec_pubkey_parse(const secp256k1_context* ctx, secp256k1_pubkey* pu
secp256k1_ge Q;

(void)ctx;
VERIFY_CHECK(ctx != NULL);
ARG_CHECK(pubkey != NULL);
memset(pubkey, 0, sizeof(*pubkey));
ARG_CHECK(input != NULL);
if (!secp256k1_eckey_pubkey_parse(&Q, input, inputlen)) {
memset(pubkey, 0, sizeof(*pubkey));
return 0;
}
secp256k1_pubkey_save(pubkey, &Q);
Expand All @@ -159,6 +162,10 @@ int secp256k1_ec_pubkey_serialize(const secp256k1_context* ctx, unsigned char *o
secp256k1_ge Q;

(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) &&
secp256k1_eckey_pubkey_serialize(&Q, output, outputlen, flags));
}
Expand Down

0 comments on commit c98df26

Please sign in to comment.