Remove duplicate p1_on_curve check (#107)
Co-authored-by: George Kadianakis <desnacked@riseup.net>
This commit is contained in:
parent
021674111a
commit
ae0aeaf33d
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue