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

crypto/rsa: GenerateKey hangs on requests for keys which are 11 bits or smaller #6849

Closed
gopherbot opened this issue Nov 29, 2013 · 8 comments

Comments

@gopherbot
Copy link

by alex.gaynor:

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

What steps will reproduce the problem?

http://play.golang.org/p/c0MyRAZxY9 hangs

What is the expected output?

Either a private key or an error


What do you see instead?

The program appears to loop infinitely


Which operating system are you using?

OSX


Which version are you using?  (run 'go version')

go version go1.1.2 darwin/amd64
@dsymonds
Copy link
Contributor

dsymonds commented Dec 2, 2013

Comment 1:

Still hangs on go1.2.

Labels changed: added priority-soon, packagebug, removed priority-triage.

Status changed to Accepted.

@minux
Copy link
Member

minux commented Dec 2, 2013

Comment 2:

the program actually hangs in crypto/rand.Prime.
http://play.golang.org/p/odcaZvHpfm
actually, because we listed all odd prime numbers less than 2^5, it won't
ever generate a prime number less than 6 bits.
which translates to a minimum of 12-bit of (two-prime) RSA key.
Thus, this issue is working as intended, but I think that we should
say something in the docs.

@minux
Copy link
Member

minux commented Dec 2, 2013

Comment 3:

https://golang.org/cl/35870043

Labels changed: added documentation.

Status changed to Started.

@gopherbot
Copy link
Author

Comment 4 by alex.gaynor:

Solving this by documenting it seems like the wrong approach, why not have Prime return
an error, what advantage is there in having it spin forever?

@minux
Copy link
Member

minux commented Dec 2, 2013

Comment 5:

yeah, as said in the CL, I also favor the error approach.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 6:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 7:

Labels changed: added repo-main.

@minux
Copy link
Member

minux commented Dec 10, 2013

Comment 8:

This issue was closed by revision 4f2cfdc.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants