crypto/rsa: ensure that generating toy RSA keys doesn't loop.
If there are too few primes of the given length then it can be impossible to generate an RSA key with n distinct primes. This change approximates the expected number of candidate primes and causes key generation to return an error if it's unlikely to succeed. Fixes #16596. Change-Id: I53b60d0cb90e2d0e6f0662befa64d13f24af51a7 Reviewed-on: https://go-review.googlesource.com/28969Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Showing
Please register or sign in to comment