chore: replace rand.Reader with nil in keygen and signing calls#8802
chore: replace rand.Reader with nil in keygen and signing calls#8802mkhandker19 wants to merge 7 commits into
Conversation
|
Hi, thanks for the PR! Looks like you edited the files in vendor/ too, which is incorrect. Could you please revert that part? Also, please let us know to what extent you used AI coding tools to generate this PR. It's fine to use them, we just like to be clear. Also, my preference is for PR comments to be written in your own words, not AI. Thanks! |
| "context" | ||
| "crypto/ecdsa" | ||
| "crypto/elliptic" | ||
| "crypto/rand" |
There was a problem hiding this comment.
There are many other files touched by this PR in which this same removal can (and in fact must) be done. Ensure you remove this import from all files which no longer reference the rand package.
Hello! I actually used Claude to help me set up Go, understand the issue, and plan the steps of action. All the code changes were done by me. |
5022b2b to
5ca44dd
Compare
aarongable
left a comment
There was a problem hiding this comment.
I've taken the liberty of fixing up this PR: there were significantly more instances of import crypto/rand that needed to be removed, and I've addressed two spots where a rand reader was removed that it shouldn't have been (one where we were using it for true randomness, not signing; and one where we actually didn't need it at all).
With those compile and runtime errors fixed, it looks like this set of changes works. Asking @letsencrypt/boulder-developers for review since this PR now includes changes authored by me.
What does this PR do?
Replaces all
crypto/rand.Readerarguments in keygen and signing callsites with
nil, in preparation for Go 1.26 compatibility. In Go 1.26,cryptographic functions ignore the
randargument and use a secureinternal randomness source instead. This PR removes the now-redundant
explicit
rand.Readerreferences and cleans up the resulting unused"crypto/rand"imports.Why was this PR needed?
Go 1.26 deprecated the
randargument to functions likeecdsa.GenerateKey,rsa.GenerateKey,rsa.SignPKCS1v15,ecdsa.Sign, andx509.CreateCertificate. Passingrand.Readerexplicitly is now misleading since the argument is silently ignored.
Replacing it with
nilaligns the codebase with the new Go standardand removes unnecessary imports.
Reference: golang/go#70942
What are the relevant issue numbers?
Closes #8540
Does this PR meet the acceptance criteria?