Skip to content

crypto/rsa: add rand initialization for rsa.SignPSS #39870

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

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/crypto/rsa/pss.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,14 @@ func (opts *PSSOptions) saltLength() int {
//
// digest must be the result of hashing the input message using the given hash
// function. The opts argument may be nil, in which case sensible defaults are
// used. If opts.Hash is set, it overrides hash.
// used. If opts.Hash is set, it overrides hash. The rand argument may be nil
// if nil rand will get initialized via crypto/rand.Reader
func SignPSS(rand io.Reader, priv *PrivateKey, hash crypto.Hash, digest []byte, opts *PSSOptions) ([]byte, error) {
// if no random source has been passed
// initialize with secure random from crypto/rand.Reader
if rand == nil {
rand = rand.Reader
}
if opts != nil && opts.Hash != 0 {
hash = opts.Hash
}
Expand Down