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

Replace GF(256) division with a constant time impl #9932

Merged
merged 15 commits into from
Sep 16, 2020

Conversation

sgmiller
Copy link
Collaborator

@sgmiller sgmiller commented Sep 11, 2020

The implementation of division in the finite field GF(2^8) used by the shamir code had a test in order to correct modulo division on a uint8 that made it not constant time, as well as intermediate assignments that the Go compiler was optimizing away.

This removes the conditional modulo in div() and replaces the assignments and branches with ConstantTimeSelects.

Addresses ToB-004.

@sgmiller sgmiller requested review from briankassouf and removed request for briankassouf September 11, 2020 16:16
@sgmiller
Copy link
Collaborator Author

WIP, according to the issue, mul isn't constant time either. Need to look more closely at that side.

@sgmiller
Copy link
Collaborator Author

Okay, mul/div/invert all good to go.

Copy link
Contributor

@briankassouf briankassouf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@briankassouf briankassouf added this to the 1.6 milestone Sep 16, 2020
@sgmiller sgmiller merged commit 9510adc into master Sep 16, 2020
@sgmiller sgmiller deleted the constant-time-gf256-div branch September 16, 2020 22:36
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