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

Issue 82740043: code review 82740043: crypto/(ec)dsa: use Fermat's inversion. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 1 month ago by agl1
Modified:
10 years ago
Reviewers:
rsc
CC:
golang-codereviews, bradfitz, rsc
Visibility:
Public.

Description

crypto/(ec)dsa: use Fermat's inversion. Now that we have a constant-time P-256 implementation, it's worth paying more attention elsewhere. The inversion of k in (EC)DSA was using Euclid's algorithm which isn't constant-time. This change switches to Fermat's algorithm, which is much better. However, it's important to note that math/big itself isn't constant time and is using a 4-bit window for exponentiation with variable memory access patterns. (Since math/big depends quite deeply on its values being in minimal (as opposed to fixed-length) represetation, perhaps crypto/elliptic should grow a constant-time implementation of exponentiation in the scalar field.) R=bradfitz Fixes issue 7652.

Patch Set 1 #

Patch Set 2 : diff -r 4715c1017053 https://code.google.com/p/go/ #

Patch Set 3 : diff -r 4715c1017053 https://code.google.com/p/go/ #

Patch Set 4 : diff -r d376b77a0d7d https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+22 lines, -2 lines) Patch
M src/pkg/crypto/dsa/dsa.go View 1 2 chunks +11 lines, -1 line 0 comments Download
M src/pkg/crypto/ecdsa/ecdsa.go View 1 2 chunks +11 lines, -1 line 0 comments Download

Messages

Total messages: 5
agl1
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go/
10 years, 1 month ago (2014-03-31 17:34:29 UTC) #1
agl1
ping.
10 years, 1 month ago (2014-04-03 15:31:22 UTC) #2
bradfitz
Nowadays you should either mail it to somebody (R=) or cc one or more likely ...
10 years, 1 month ago (2014-04-03 15:33:34 UTC) #3
rsc
LGTM
10 years, 1 month ago (2014-04-03 19:30:48 UTC) #4
agl1
10 years ago (2014-04-08 23:33:21 UTC) #5
*** Submitted as https://code.google.com/p/go/source/detail?r=8b76bd413bcb ***

crypto/(ec)dsa: use Fermat's inversion.

Now that we have a constant-time P-256 implementation, it's worth
paying more attention elsewhere.

The inversion of k in (EC)DSA was using Euclid's algorithm which isn't
constant-time. This change switches to Fermat's algorithm, which is
much better. However, it's important to note that math/big itself isn't
constant time and is using a 4-bit window for exponentiation with
variable memory access patterns.

(Since math/big depends quite deeply on its values being in minimal (as
opposed to fixed-length) represetation, perhaps crypto/elliptic should
grow a constant-time implementation of exponentiation in the scalar
field.)

R=bradfitz
Fixes issue 7652.

LGTM=rsc
R=golang-codereviews, bradfitz, rsc
CC=golang-codereviews
https://codereview.appspot.com/82740043
Sign in to reply to this message.

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