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

Issue 1528021: Implement PBKDF2-based key derivation, random key generation,... (Closed)

Created:
10 years, 8 months ago by wtc
Modified:
9 years, 7 months ago
Reviewers:
albertb, rsleevi-old
CC:
chromium-reviews, Paweł Hajdan Jr., brettw-cc_chromium.org
Visibility:
Public.

Description

Implement PBKDF2-based key derivation, random key generation, and AES-CBC encryption/decryption using CryptoAPI. Contributed by Ryan Sleevi <ryan.sleevi@gmail.com>;. Original review URL: http://codereview.chromium.org/1558018 R=wtc,albertb BUG=none TEST=SymmetricKeyTest.* and EncryptorTest.* Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=44106

Patch Set 1 #

Patch Set 2 : Add encryptor_{mac,nss}.cc to CL. Still need to review scoped_capi_types.h and symetric_key_win.cc. #

Total comments: 9

Patch Set 3 : Check point: finished scoped_capi_types.h and most of symmetric_key_win.cc. #

Patch Set 4 : Add symmetric_key_{mac,nss}.cc to CL. Finished review. #

Patch Set 5 : Fix nits. #

Total comments: 8

Patch Set 6 : Make albertb's suggested changes. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+866 lines, -92 lines) Patch
M base/crypto/encryptor.h View 1 2 chunks +12 lines, -2 lines 0 comments Download
M base/crypto/encryptor_mac.cc View 1 chunk +1 line, -0 lines 0 comments Download
M base/crypto/encryptor_nss.cc View 1 chunk +1 line, -0 lines 0 comments Download
M base/crypto/encryptor_unittest.cc View 1 2 3 4 5 2 chunks +82 lines, -9 lines 0 comments Download
M base/crypto/encryptor_win.cc View 1 2 3 4 5 2 chunks +85 lines, -4 lines 0 comments Download
M base/crypto/rsa_private_key.h View 1 3 chunks +6 lines, -5 lines 0 comments Download
M base/crypto/rsa_private_key_win.cc View 1 3 chunks +6 lines, -15 lines 0 comments Download
A base/crypto/scoped_capi_types.h View 1 2 3 4 5 1 chunk +124 lines, -0 lines 0 comments Download
M base/crypto/signature_creator.h View 1 3 chunks +5 lines, -4 lines 0 comments Download
M base/crypto/signature_creator_win.cc View 1 2 chunks +2 lines, -9 lines 0 comments Download
M base/crypto/signature_verifier.h View 2 chunks +7 lines, -6 lines 0 comments Download
M base/crypto/signature_verifier_win.cc View 1 4 chunks +6 lines, -20 lines 0 comments Download
M base/crypto/symmetric_key.h View 1 2 3 5 chunks +28 lines, -2 lines 0 comments Download
M base/crypto/symmetric_key_mac.cc View 4 4 chunks +6 lines, -4 lines 0 comments Download
M base/crypto/symmetric_key_nss.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M base/crypto/symmetric_key_unittest.cc View 2 chunks +2 lines, -8 lines 0 comments Download
M base/crypto/symmetric_key_win.cc View 1 2 3 4 5 2 chunks +491 lines, -4 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
wtc
The CL is now ready for review. Patch Set 1 is Ryan Sleevi's original CL. ...
10 years, 8 months ago (2010-04-09 00:11:22 UTC) #1
rsleevi-old
Just addressing comments, haven't reviewed in depth. In addition to the provided comments, I did ...
10 years, 8 months ago (2010-04-09 03:04:49 UTC) #2
rsleevi-old
http://codereview.chromium.org/1528021/diff/10002/14004 File base/crypto/symmetric_key_win.cc (right): http://codereview.chromium.org/1528021/diff/10002/14004#newcode177 base/crypto/symmetric_key_win.cc:177: ok = CryptGenRandom(safe_provider, key_size_in_bytes, One more link I forgot, ...
10 years, 8 months ago (2010-04-09 03:16:35 UTC) #3
albertb
LGTM for headers and tests. http://codereview.chromium.org/1528021/diff/44002/2012 File base/crypto/encryptor_unittest.cc (right): http://codereview.chromium.org/1528021/diff/44002/2012#newcode42 base/crypto/encryptor_unittest.cc:42: #if defined(OS_WIN) Can this ...
10 years, 8 months ago (2010-04-09 16:41:07 UTC) #4
wtc
10 years, 8 months ago (2010-04-09 17:55:22 UTC) #5
albertb: thanks for the review!

I made all the changes you suggested in Patch Set 6.  I respond
to two of your comments below.

http://codereview.chromium.org/1528021/diff/44002/2005
File base/crypto/scoped_capi_types.h (right):

http://codereview.chromium.org/1528021/diff/44002/2005#newcode66
base/crypto/scoped_capi_types.h:66: CAPIHandle* receive() {
On 2010/04/09 16:41:07, albertb wrote:
> nit: Isn't this called get() in scoped_ptr?

No.  scoped_ptr doesn't have an equivalent method.  The
receive() method returns a pointer to |handle_| to the
caller to allow the caller to set |handle_| to a value
via the pointer.

scoped_comptr_win.h has this method.

http://codereview.chromium.org/1528021/diff/44002/2006
File base/crypto/symmetric_key_win.cc (right):

http://codereview.chromium.org/1528021/diff/44002/2006#newcode416
base/crypto/symmetric_key_win.cc:416: DCHECK_GT(l, 0);
On 2010/04/09 16:41:07, albertb wrote:
> nit: Maybe call this len instead? The DCHECK looks like 1 > 0 :)

I agree.  I changed it to capital L.

The variable names L, dkLen, and hLen violate the Style Guide.
I (or rather, Ryan) named them after the names used in the
spec.  This makes it easier to verify our code conforms to
the spec.

If we want to follow the Style Guide, these variables can
be renamed as follows:
  L: num_blocks
  dkLen: derived_key_len
  hLen: hash_len or hmac_len

Powered by Google App Engine
This is Rietveld 408576698