Skip to content

Add EIP-2537 serialization. - #223

Open
dot-asm wants to merge 8 commits into
supranational:masterfrom
dot-asm:eip-2537
Open

dot-asm wants to merge 8 commits into
supranational:masterfrom
dot-asm:eip-2537

Conversation

@dot-asm

@dot-asm dot-asm commented Jun 13, 2024

Copy link
Copy Markdown
Collaborator

No description provided.

@Yudis-bit

Copy link
Copy Markdown

Roundtrip serialization fails for the point at infinity: blst_p1_serialize_eip2537 emits 128 zero bytes when Z is zero per EIP-2537, but blst_p1_deserialize_eip2537 rejects it with BLST_POINT_NOT_ON_CURVE.

This happens because the deserializer calls internal POINTonE1_affine_on_curve(&ret), where affine infinity (0, 0) fails y^2 == x^3 + 4 (0 == 4). Shouldn't this call blst_p1_affine_on_curve instead (or check vec_is_zero), like the other affine helpers do?

Same in blst_p2_deserialize_eip2537 for POINTonE2_affine_on_curve.

--- a/src/e1.c
+++ b/src/e1.c
@@ -387,3 +387,3 @@ BLST_ERROR blst_p1_deserialize_eip2537(POINTonE1_affine *out,

-    if (!POINTonE1_affine_on_curve(&ret))
+    if (!blst_p1_affine_on_curve(&ret))
         return BLST_POINT_NOT_ON_CURVE;
--- a/src/e2.c
+++ b/src/e2.c
@@ -456,3 +456,3 @@ BLST_ERROR blst_p2_deserialize_eip2537(POINTonE2_affine *out,

-    if (!POINTonE2_affine_on_curve(&ret))
+    if (!blst_p2_affine_on_curve(&ret))
         return BLST_POINT_NOT_ON_CURVE;

@dot-asm

dot-asm commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

Roundtrip serialization fails for the point at infinity

Fixed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants