Make pubkey parsing test whether points are in the correct subgroup

This commit is contained in:
Pieter Wuille
2020-09-07 18:23:52 -07:00
parent 87af00b511
commit 08d7d89299
4 changed files with 38 additions and 0 deletions

View File

@@ -284,6 +284,9 @@ int secp256k1_ec_pubkey_parse(const secp256k1_context* ctx, secp256k1_pubkey* pu
if (!secp256k1_eckey_pubkey_parse(&Q, input, inputlen)) {
return 0;
}
if (!secp256k1_ge_is_in_correct_subgroup(&Q)) {
return 0;
}
secp256k1_pubkey_save(pubkey, &Q);
secp256k1_ge_clear(&Q);
return 1;