Remove duplicate p1_on_curve check (#107)

Co-authored-by: George Kadianakis <desnacked@riseup.net>
This commit is contained in:
Justin Traglia 2023-03-01 03:52:44 -07:00 committed by GitHub
parent 021674111a
commit ae0aeaf33d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -646,14 +646,13 @@ static C_KZG_RET bytes_to_bls_field(fr_t *out, const Bytes32 *b) {
static C_KZG_RET validate_kzg_g1(g1_t *out, const Bytes48 *b) {
/* Convert the bytes to a p1 point */
blst_p1_affine p1_affine;
/* The uncompress routine also checks that the point is on the curve */
if (blst_p1_uncompress(&p1_affine, b->bytes) != BLST_SUCCESS)
return C_KZG_BADARGS;
blst_p1_from_affine(out, &p1_affine);
/* The point at infinity is accepted! */
if (blst_p1_is_inf(out)) return C_KZG_OK;
/* The point must be on the curve */
if (!blst_p1_on_curve(out)) return C_KZG_BADARGS;
/* The point must be on the right subgroup */
if (!blst_p1_in_g1(out)) return C_KZG_BADARGS;