-
Notifications
You must be signed in to change notification settings - Fork 478
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
imported fix from CROSS upstream: endianness-aware csprng #1983
Conversation
This reverts commit b59d78c. Signed-off-by: Basil Hess <[email protected]>
Signed-off-by: Basil Hess <[email protected]>
Signed-off-by: Basil Hess <[email protected]>
0b43d63
to
0d5b3e6
Compare
0d5b3e6
to
d29be80
Compare
Signed-off-by: rtjk <[email protected]>
d29be80
to
46e8b2a
Compare
Signed-off-by: rtjk <[email protected]>
@SWilson4 I rebased on branch |
Ouch! It still failed ... time to debug some more. |
FYI, looks like the s390x build uses gcc 9—does this older version support all the features you're using? |
Signed-off-by: rtjk <[email protected]>
It turns out there were a few more instances where type punning was used, causing an endianness issue. I've fixed these, so Travis CI should now pass. I also added two lines to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also added two lines to copy_from_upstream.py to create template files if they aren’t already in place. Is this okay?
Thanks for highlighting this @rtjk ! I don't think this is a good approach: Missing files in code generation imo are indicative of an incorrect code base and should lead to an error condition triggering a proper fix (manually adding the file(s) in question): Reason for my caution is that the code generation is so central to the proper operation of liboqs
that I'm very wary of too much automation in this area.
Signed-off-by: rtjk <[email protected]>
Automated template file generation removed: Thanks @rtjk!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix @rtjk. I can't claim to have read all changes but defer to the tests passing as this code being OK: As with all core crypto code in liboqs
the ultimate responsibility for correctness is with the upstream. Allow me to ask the question when/whether this code is going to flow upstream again (such as to get rid of the various "fix" statements in the version)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update @rtjk!
The plan is to release a new version of CROSS before moving on to NIST's second round (deadline January 17, 2025). This will consolidate all the changes we made since CROSS 1.2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix @rtjk!
Fixes #1961.
The rejection sampling functions in CROSS rely on pointer casting, which caused the CSPRNG to generate different numbers on big-endian versus little-endian architectures, resulting in different KATs. This fix uses the compiler flag
__BYTE_ORDER__
to detect endianness and swap the bytes when necessary. Thank you @bhess for pointing us in the right direction!