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

Issue 10919163: Add GCM, CTR, and CTS modes to AES. (Closed)

Created:
8 years, 3 months ago by wtc
Modified:
8 years, 1 month ago
Reviewers:
rjrejyea, Ryan Sleevi
CC:
chromium-reviews
Visibility:
Public.

Description

Add GCM, CTR, and CTS modes to AES. This is Bob Relyea's NSS freebl patch https://bug373108.bugzilla.mozilla.org/attachment.cgi?id=658653 imported into Rietveld for code review. The change to lib/freebl/manifest.mn is omitted. R=rsleevi@chromium.org BUG=none TEST=none

Patch Set 1 #

Total comments: 84

Patch Set 2 : Move lib/util/pkcs11t.h from the softoken CL to this CL #

Patch Set 3 : #

Total comments: 13

Patch Set 4 : Fix comments as rsleevi suggested, fix a 32-bit bug and miscellaneous issues #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+1705 lines, -25 lines) Patch
A nss/mozilla/security/nss/lib/freebl/ReviewComments View 1 2 3 1 chunk +98 lines, -0 lines 3 comments Download
M nss/mozilla/security/nss/lib/freebl/blapii.h View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
M nss/mozilla/security/nss/lib/freebl/blapit.h View 1 chunk +3 lines, -0 lines 0 comments Download
A nss/mozilla/security/nss/lib/freebl/ctr.h View 1 2 3 1 chunk +44 lines, -0 lines 0 comments Download
A nss/mozilla/security/nss/lib/freebl/ctr.c View 1 2 3 1 chunk +167 lines, -0 lines 0 comments Download
A nss/mozilla/security/nss/lib/freebl/cts.h View 1 2 3 1 chunk +33 lines, -0 lines 0 comments Download
A nss/mozilla/security/nss/lib/freebl/cts.c View 1 2 3 1 chunk +304 lines, -0 lines 0 comments Download
A nss/mozilla/security/nss/lib/freebl/gcm.h View 1 2 3 1 chunk +31 lines, -0 lines 0 comments Download
A nss/mozilla/security/nss/lib/freebl/gcm.c View 1 2 3 1 chunk +855 lines, -0 lines 0 comments Download
M nss/mozilla/security/nss/lib/freebl/mpi/mp_gf2m.c View 1 2 4 chunks +19 lines, -8 lines 0 comments Download
M nss/mozilla/security/nss/lib/freebl/mpi/mp_gf2m-priv.h View 1 chunk +6 lines, -0 lines 0 comments Download
M nss/mozilla/security/nss/lib/freebl/rijndael.h View 1 2 2 chunks +12 lines, -7 lines 0 comments Download
M nss/mozilla/security/nss/lib/freebl/rijndael.c View 1 2 3 9 chunks +90 lines, -10 lines 0 comments Download
M nss/mozilla/security/nss/lib/util/pkcs11t.h View 1 2 2 chunks +34 lines, -0 lines 0 comments Download

Messages

Total messages: 26 (0 generated)
wtc
Patch set 1 is Bob Relyea's patch.
8 years, 3 months ago (2012-09-07 22:30:52 UTC) #1
Ryan Sleevi
Wan-Teh: Here is the first batch of comments. I am still working my way through ...
8 years, 3 months ago (2012-09-11 19:34:30 UTC) #2
Ryan Sleevi
I have not reviewed the Algorithm 1 implementation in GCM, nor the changes to the ...
8 years, 3 months ago (2012-09-12 00:22:47 UTC) #3
wtc
Status update: rsleevi: thank you for the review comments. I have reviewed everything except cts.c. ...
8 years, 3 months ago (2012-09-12 19:54:30 UTC) #4
wtc
rsleevi: please review patch set 3. Thanks. I added a ReviewComments file to summarize the ...
8 years, 3 months ago (2012-09-14 01:16:42 UTC) #5
Ryan Sleevi
wtc: I just reviewed the diffs from Patchset 2. Based on the ReviewComments, I think ...
8 years, 3 months ago (2012-09-17 22:57:26 UTC) #6
wtc
rsleevi: please review patch set 4. I made all the changes you suggested. Thanks. I ...
8 years, 3 months ago (2012-09-18 01:03:40 UTC) #7
rjrejyea
http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/ctr.h File nss/mozilla/security/nss/lib/freebl/ctr.h (right): http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/ctr.h#newcode18 nss/mozilla/security/nss/lib/freebl/ctr.h:18: }; In other headers, the structure can be opaque. ...
8 years, 3 months ago (2012-09-19 21:38:00 UTC) #8
rjrejyea
http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/ctr.c File nss/mozilla/security/nss/lib/freebl/ctr.c (right): http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/ctr.c#newcode53 nss/mozilla/security/nss/lib/freebl/ctr.c:53: PORT_Memset(ctr, 0, sizeof (CTRContext)); > We should add a ...
8 years, 3 months ago (2012-09-19 21:43:40 UTC) #9
Ryan Sleevi
http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/ctr.c File nss/mozilla/security/nss/lib/freebl/ctr.c (right): http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/ctr.c#newcode85 nss/mozilla/security/nss/lib/freebl/ctr.c:85: *counterPtr = ((*counterPtr) & ~mask) | count; On 2012/09/19 ...
8 years, 3 months ago (2012-09-19 21:53:15 UTC) #10
rjrejyea
http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/cts.c File nss/mozilla/security/nss/lib/freebl/cts.c (right): http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/cts.c#newcode123 nss/mozilla/security/nss/lib/freebl/cts.c:123: * here's the CTS magic, we pad our final ...
8 years, 3 months ago (2012-09-19 21:56:02 UTC) #11
rjrejyea
http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/ctr.c File nss/mozilla/security/nss/lib/freebl/ctr.c (right): http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/ctr.c#newcode85 nss/mozilla/security/nss/lib/freebl/ctr.c:85: *counterPtr = ((*counterPtr) & ~mask) | count; OK, so ...
8 years, 3 months ago (2012-09-19 21:59:36 UTC) #12
Ryan Sleevi
http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/ctr.c File nss/mozilla/security/nss/lib/freebl/ctr.c (right): http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/ctr.c#newcode85 nss/mozilla/security/nss/lib/freebl/ctr.c:85: *counterPtr = ((*counterPtr) & ~mask) | count; On 2012/09/19 ...
8 years, 3 months ago (2012-09-19 22:06:21 UTC) #13
Ryan Sleevi
http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/ctr.c File nss/mozilla/security/nss/lib/freebl/ctr.c (right): http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/ctr.c#newcode85 nss/mozilla/security/nss/lib/freebl/ctr.c:85: *counterPtr = ((*counterPtr) & ~mask) | count; On 2012/09/19 ...
8 years, 3 months ago (2012-09-19 22:09:42 UTC) #14
rjrejyea
http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/gcm.c File nss/mozilla/security/nss/lib/freebl/gcm.c (right): http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/gcm.c#newcode47 nss/mozilla/security/nss/lib/freebl/gcm.c:47: * tables to speed things up even more */ ...
8 years, 3 months ago (2012-09-19 22:12:29 UTC) #15
rjrejyea
http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/rijndael.c File nss/mozilla/security/nss/lib/freebl/rijndael.c (right): http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/rijndael.c#newcode1194 nss/mozilla/security/nss/lib/freebl/rijndael.c:1194: if (freeit && cx->worker_cx && cx->destroy) { It's ugly ...
8 years, 3 months ago (2012-09-19 22:19:33 UTC) #16
wtc
http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/ctr.c File nss/mozilla/security/nss/lib/freebl/ctr.c (right): http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/ctr.c#newcode75 nss/mozilla/security/nss/lib/freebl/ctr.c:75: return; Since counterBits is usually a multiple of 8, ...
8 years, 3 months ago (2012-09-19 22:19:33 UTC) #17
Ryan Sleevi
http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/cts.c File nss/mozilla/security/nss/lib/freebl/cts.c (right): http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/cts.c#newcode123 nss/mozilla/security/nss/lib/freebl/cts.c:123: * here's the CTS magic, we pad our final ...
8 years, 3 months ago (2012-09-19 22:21:35 UTC) #18
rjrejyea
How do I see inter patch diffs? (I want see the difference between patchset 1 ...
8 years, 3 months ago (2012-09-19 22:22:53 UTC) #19
wtc
Bob, Please review the delta between patch sets 1 and 4 first: http://codereview.chromium.org/10919163/diff2/1:16001/nss/mozilla/security/nss/lib/freebl/blapii.h?column_width=80 You will ...
8 years, 3 months ago (2012-09-19 22:24:21 UTC) #20
Ryan Sleevi
On 2012/09/19 22:22:53, rjrejyea wrote: > How do I see inter patch diffs? (I want ...
8 years, 3 months ago (2012-09-19 22:31:07 UTC) #21
Ryan Sleevi
Turns out the conversation about C_EncryptUpdate has been had before, and by people much more ...
8 years, 3 months ago (2012-09-19 22:34:55 UTC) #22
rjrejyea
http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/cts.c File nss/mozilla/security/nss/lib/freebl/cts.c (right): http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/cts.c#newcode123 nss/mozilla/security/nss/lib/freebl/cts.c:123: * here's the CTS magic, we pad our final ...
8 years, 3 months ago (2012-09-19 22:52:48 UTC) #23
Ryan Sleevi
http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/cts.c File nss/mozilla/security/nss/lib/freebl/cts.c (right): http://codereview.chromium.org/10919163/diff/1/nss/mozilla/security/nss/lib/freebl/cts.c#newcode123 nss/mozilla/security/nss/lib/freebl/cts.c:123: * here's the CTS magic, we pad our final ...
8 years, 3 months ago (2012-09-19 23:04:53 UTC) #24
rjrejyea
> See linked bug - looks like Nelson read the spec the same way I ...
8 years, 3 months ago (2012-09-19 23:22:41 UTC) #25
wtc
8 years, 3 months ago (2012-09-20 23:27:23 UTC) #26
http://codereview.chromium.org/10919163/diff/16001/nss/mozilla/security/nss/l...
File nss/mozilla/security/nss/lib/freebl/ReviewComments (right):

http://codereview.chromium.org/10919163/diff/16001/nss/mozilla/security/nss/l...
nss/mozilla/security/nss/lib/freebl/ReviewComments:77: the AESContext structure
is allocated.

Bob: thanks for the info. The reason for the asymmetry
between AES_CreateContext and AES_InitContext and the
reason for the 'freeit' check in AES_DestroyContext were
not obvious at all. At first, I simply added comments to
point out that AES_InitContext supports fewer modes than
AES_CreateContext. Then I figured out how to eliminate
that asymmetry and removed my comments.

I debugged this SSL Bypass crash thoroughly last night.
I summarized my findings in
https://bugzilla.mozilla.org/show_bug.cgi?id=793033

The AESContext that causes the crash is actually
initialized. It's just messed up by ssl_FreeSocket (in
DEBUG build only) before being passed to AES_DestroyContext.

Powered by Google App Engine
This is Rietveld 408576698