-
Notifications
You must be signed in to change notification settings - Fork 163
Update with latest RSA from go stdlib #331
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
Conversation
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 { |
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.
Are we missing this line? https://cs.opensource.google/go/go/+/master:src/crypto/rsa/rsa.go;l=558
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.
Doesn't seem too important.
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.
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.
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.
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.
Updates with latest RSA from go stdlib.
Also removes some code not used by blindRSA.