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

Update with latest RSA from go stdlib #331

Merged
merged 2 commits into from
May 4, 2022
Merged

Conversation

armfazh
Copy link
Contributor

@armfazh armfazh commented May 3, 2022

Updates with latest RSA from go stdlib.
Also removes some code not used by blindRSA.

@armfazh armfazh self-assigned this May 3, 2022
@armfazh armfazh added the cosmetic readability an cleanliness of code label May 3, 2022
func decrypt(random io.Reader, priv *rsa.PrivateKey, c *big.Int) (m *big.Int, err error) {
// TODO(agl): can we get away with reusing blinds?
if c.Cmp(priv.N) > 0 {
err = rsa.ErrDecryption
return
}
if priv.N.Sign() == 0 {
return nil, rsa.ErrDecryption
}

var ir *big.Int
if random != nil {

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Doesn't seem too important.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it shuffles the random source in case a user-provided source is provided.
in this package, the random source is always crypto/rand, which it's assumed to be secure.

Copy link

@lukevalenta lukevalenta left a comment

Choose a reason for hiding this comment

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

One comment about the omitted randutil.MaybeReadByte, but from what I can tell that's non-essential and only meant to stop callers from relying on non-guaranteed behavior. Otherwise, lgtm.

@armfazh armfazh merged commit a4b8552 into cloudflare:master May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cosmetic readability an cleanliness of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants