Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No subgroup checks performed in point validation #271

Closed
guidovranken opened this issue Aug 17, 2021 · 9 comments
Closed

No subgroup checks performed in point validation #271

guidovranken opened this issue Aug 17, 2021 · 9 comments

Comments

@guidovranken
Copy link

The following G1 point:

X: 1850443652098619803069679949935703490545934817616361671487073351271435645926537537028144222559542259604367871156773
Y: 1776970151258755586951871078535415548807448204545244204542330019247278385570277860229537378843413568111354158837149

Is on the curve but not in the subgroup. G1Element::CheckValid only performs a curve check but not a subgroup check. Is this intentional?

@dfaranha

@dfaranha
Copy link
Contributor

G1Element::CheckValid actually defers the subgroup check to RELIC, which performs checks for curve and order.
It turns out that the optimized check I had implemented was satisfied by points in the prime-order subgroup r but also by points with order multiple of r.

I just fixed it with 3429421e84b3a2124d8744573084c1a0ba0b729a by making the check more strict and a bit slower. I know there are papers in progress with faster techniques, so part of the performance penalty will be reverted soon.

@dfaranha
Copy link
Contributor

dfaranha commented Aug 17, 2021

Yes, my starting point was also Bowe's ePrint, but I replaced the multiplication by (z^2 - 1) with the endomorphism. Too good to be true, I guess.

I have the same subgroup check as in blst implemented for G2.

@guidovranken
Copy link
Author

@hoffmang9 Can you update relic to 3429421e84b3a2124d8744573084c1a0ba0b729a or later?

@hoffmang9
Copy link
Member

hoffmang9 commented Aug 29, 2021 via email

@AmineKhaldi
Copy link
Contributor

Unfortunately 3429421e84b3a2124d8744573084c1a0ba0b729a introduced the following test failure: https://github.com/Chia-Network/bls-signatures/blob/main/src/test.cpp#L478

  REQUIRE_NOTHROW( G1Element::FromByteVector(buf) )
due to unexpected exception with message:
  G1 element is invalid

377091f0e728463bc2da7d546c53b9f6b81df4a1cc1ab5bf29c5908b7151a32d
86243290bbcbfd9ae75bdece7981965350208eb5e99b04d5cd24e955ada961f8c0a162dee740be7bdc6c3c0613ba2eb1
b00ab9a8af54804b43067531d96c176710c05980fccf8eee1ae12a4fd543df929cce860273af931fe4fdbc407d495f73114ab7d17ef08922e56625daada0497582340ecde841a9e997f2f557653c21c070119662dd2efa47e2d6c5e2de00eefa
===============================================================================
test cases:   13 |   12 passed | 1 failed
assertions: 1217 | 1216 passed | 1 failed

@dfaranha
Copy link
Contributor

I don't fully understand what is going on there, but I assume that the group element being tested does not have the right order?

@mariano54
Copy link
Contributor

I am looking into this issue now.

AmineKhaldi added a commit to AmineKhaldi/bls-signatures that referenced this issue Sep 8, 2021
wjblanke pushed a commit that referenced this issue Sep 8, 2021
* Update Relic anchor to aecdcae7956f542fbee2392c1f0feb0a8ac41dc5. Addresses issue #271.

* Update tests

* Switch relic_ietf_64 to the aecdcae version.

* Use our main repo as the related PR got merged.

Co-authored-by: Mariano Sorgente <sorgente711@gmail.com>
@hoffmang9
Copy link
Member

Fixed in 1.0.6 and released in chia-blockchain 1.2.6

UdjinM6 pushed a commit to UdjinM6/bls-signatures that referenced this issue Dec 1, 2021
…a-Network#277)

* Update Relic anchor to aecdcae7956f542fbee2392c1f0feb0a8ac41dc5. Addresses issue Chia-Network#271.

* Update tests

* Switch relic_ietf_64 to the aecdcae version.

* Use our main repo as the related PR got merged.

Co-authored-by: Mariano Sorgente <sorgente711@gmail.com>
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

No branches or pull requests

5 participants