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

Fix secretKey bigger than curve order and stack smashing in ECP mul #41

Merged
merged 2 commits into from
Mar 11, 2020

Conversation

mratsim
Copy link
Contributor

@mratsim mratsim commented Mar 11, 2020

This PR changes 2 things:

  1. it uses a DBIG_384 (double BIG_384) in to hold the raw bytes coming from HKDF-expand.
    Some of the raw outputs require more than 381-bit
    With a BIG the fromBytes procedure doesn't fail, the resulting BIG can be printed but calling norm or mod on it gives incorrect result and this creates an invalid secret key that causes stack smashing issues: Stack corruption on keypair generation #40 (comment), Bls v0.10.1 nimbus-eth2#780

  2. In the process of debugging, I changed HKDF to use openarray thinking that the rootcause was hidden in some raw pointers

@mratsim mratsim merged commit e6849cd into master Mar 11, 2020
@delete-merged-branch delete-merged-branch bot deleted the debug-seckey-curve-order branch March 11, 2020 13:35
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.

1 participant