Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1027)

Issue 253041: code review 253041: crypto/rsa: don't use safe primes. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years ago by agl1
Modified:
15 years ago
Reviewers:
CC:
rsc, golang-dev
Visibility:
Public.

Description

crypto/rsa: don't use safe primes. Previously we would require safe primes for our RSA key generation. Since this took rather a long time, this removes the requirement that the primes be safe. OpenSSL doesn't use safe primes for RSA key generation either (openssl-0.9.8l/crypto/rsa/rsa_gen.c:122) Fixes issue 649.

Patch Set 1 #

Patch Set 2 : code review 253041: crypto/rsa: don't use safe primes. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -11 lines) Patch
M src/pkg/crypto/rsa/rsa.go View 3 chunks +6 lines, -10 lines 0 comments Download
M src/pkg/crypto/rsa/rsa_test.go View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 5
agl1
15 years ago (2010-03-05 19:59:43 UTC) #1
rsc
LGTM However, I am curious: does it help any to force the two (not just ...
15 years ago (2010-03-06 02:01:55 UTC) #2
agl1
Hello rsc (cc: golang-dev@googlegroups.com), I'd like you to review this change.
15 years ago (2010-03-08 14:25:22 UTC) #3
agl1
*** Submitted as http://code.google.com/p/go/source/detail?r=596599038dd4 *** crypto/rsa: don't use safe primes. Previously we would require safe ...
15 years ago (2010-03-08 14:25:33 UTC) #4
agl1
15 years ago (2010-03-08 14:29:23 UTC) #5
On Fri, Mar 5, 2010 at 9:01 PM, Russ Cox <rsc@golang.org> wrote:
> However, I am curious: does it help any to force
> the two (not just one) low bits of the random choice to 1?
> That would ensure that (p-1)/2 is odd, which would
> be an easy factor of two.

You're right that both LSBs should be forced to one but the code was
an order of magnitude too slow when using safe primes, not just a
factor of 2x.

I think it's also just a vestigial habit now: modern factorisation
methods don't depend on the size of the prime factors of p-1 and p+1
which is probably why OpenSSL doesn't bother.


Cheers

AGL
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b