Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Issue 12042100: Add an optimized 32-bit implementation of the NIST P-256 elliptic curve. (Closed)

Created:
7 years, 11 months ago by wtc
Modified:
7 years, 10 months ago
Reviewers:
agl, Ryan Sleevi
CC:
chromium-reviews
Visibility:
Public.

Description

Add an optimized 32-bit implementation of the NIST P-256 elliptic curve. ecp_256_32.c was written by Adam Langley and was reviewed in https://codereview.chromium.org/10944017/ R=agl@chromium.org,rsleevi@chromium.org BUG=172178 TEST=no build or test failures on iOS, Mac, and Windows

Patch Set 1 #

Total comments: 14

Patch Set 2 : Don't use ecp_256.c #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+3037 lines, -7 lines) Patch
M README.chromium View 1 chunk +3 lines, -0 lines 0 comments Download
M mozilla/security/nss/lib/freebl/ecl/ecl.c View 1 2 chunks +10 lines, -7 lines 0 comments Download
M mozilla/security/nss/lib/freebl/ecl/ecl-priv.h View 1 1 chunk +3 lines, -0 lines 1 comment Download
A mozilla/security/nss/lib/freebl/ecl/ecp_256_32.c View 1 1 chunk +1470 lines, -0 lines 0 comments Download
M nss.gyp View 1 1 chunk +1 line, -0 lines 0 comments Download
A patches/nss-curve-p256.patch View 1 1 chunk +1550 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
wtc
I described below the changes I made to AGL's original NSS patch in https://bugzilla.mozilla.org/show_bug.cgi?id=831006. https://codereview.chromium.org/12042100/diff/1/mozilla/security/nss/lib/freebl/ecl/ecl.c ...
7 years, 11 months ago (2013-01-25 02:32:49 UTC) #1
Ryan Sleevi
I'm definitely not qualified to review this on the maths side. I'm still not sure ...
7 years, 11 months ago (2013-01-25 03:50:36 UTC) #2
agl
https://codereview.chromium.org/12042100/diff/1/mozilla/security/nss/lib/freebl/ecl/ecl.c File mozilla/security/nss/lib/freebl/ecl/ecl.c (right): https://codereview.chromium.org/12042100/diff/1/mozilla/security/nss/lib/freebl/ecl/ecl.c#newcode273 mozilla/security/nss/lib/freebl/ecl/ecl.c:273: break; On 2013/01/25 03:50:36, Ryan Sleevi wrote: > Why ...
7 years, 11 months ago (2013-01-25 16:04:03 UTC) #3
wtc
Thank you for your comments. Please review patch set 2. I figured out a way ...
7 years, 11 months ago (2013-01-27 00:11:17 UTC) #4
agl
lgtm
7 years, 10 months ago (2013-01-28 21:42:20 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wtc@chromium.org/12042100/7001
7 years, 10 months ago (2013-01-28 22:31:17 UTC) #6
commit-bot: I haz the power
Change committed as 179208
7 years, 10 months ago (2013-01-28 22:31:31 UTC) #7
wtc
7 years, 10 months ago (2013-01-31 16:59:02 UTC) #8
Message was sent while issue was closed.
https://codereview.chromium.org/12042100/diff/1/mozilla/security/nss/lib/free...
File mozilla/security/nss/lib/freebl/ecl/ecp_256_32.c (right):

https://codereview.chromium.org/12042100/diff/1/mozilla/security/nss/lib/free...
mozilla/security/nss/lib/freebl/ecl/ecp_256_32.c:168: #define
NON_ZERO_TO_ALL_ONES(x) (~((u32) (((s32) ((x)-1)) >> 31)))

On 2013/01/25 03:50:36, Ryan Sleevi wrote:
>
> Should their be a bitsmear alternative 'just in case'?
> 
> eg:
> x &= 0x80000000; x |= x >> 16;
> x |= x >> 8; x |= x >> 4;
> x |= x >> 2; x |= x >> 1;

After I worked out the detail (including plugging in Ryan's
constantTimeCondition code from the NSS RSA-OAEP patch),
I found that the result is simply

u32 NonZeroToAllOnes(u32 x) {
  x = (x - 1) >> 31;
  return x - 1;
}

or in macro form:

#define NON_ZERO_TO_ALL_ONES(x) ((((x)-1) >> 31) - 1)

This should be equally fast. I hope I didn't make a mistake.

Powered by Google App Engine
This is Rietveld 408576698