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

Issue 7756025: Changed OAuth token+secret encryption to use supplemental user key. (Closed)

Created:
9 years, 3 months ago by zel
Modified:
9 years, 3 months ago
Reviewers:
wtc, Will Drewry
CC:
chromium-reviews, davemoore+watch_chromium.org, stevenjb, nkostylev+cc_chromium.org
Visibility:
Public.

Description

Changed OAuth token+secret encryption to use supplemental user key from NSS DB. BUG=chromium-os:18633 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=99912

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Total comments: 19

Patch Set 7 : '' #

Patch Set 8 : '' #

Patch Set 9 : '' #

Patch Set 10 : '' #

Patch Set 11 : '' #

Total comments: 26

Patch Set 12 : '' #

Patch Set 13 : '' #

Patch Set 14 : '' #

Patch Set 15 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+176 lines, -28 lines) Patch
M chrome/browser/chromeos/cros/cert_library.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +7 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/cros/cert_library.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/login/authenticator.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/login/google_authenticator.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/login/google_authenticator.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/login/login_utils.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +13 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/login/mock_authenticator.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/login/mock_authenticator.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/login/parallel_authenticator.h View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +10 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/login/parallel_authenticator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +53 lines, -26 lines 0 comments Download
M crypto/nss_util.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +10 lines, -0 lines 0 comments Download
M crypto/nss_util.cc View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +50 lines, -0 lines 0 comments Download
M crypto/symmetric_key.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +5 lines, -0 lines 0 comments Download
M crypto/symmetric_key_nss.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +7 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
zel
This still uses DES3 instead of AEC. I am planning to spend more time on ...
9 years, 3 months ago (2011-09-01 22:52:14 UTC) #1
zel
I've hashed out AEC story, PK11_TokenKeyGen() needed to get keysize in bytes, not bits :P
9 years, 3 months ago (2011-09-01 23:30:06 UTC) #2
wtc
zelidrag: I'm sorry I didn't have time to do a careful review of the meat ...
9 years, 3 months ago (2011-09-02 22:31:08 UTC) #3
zel
PTAL I have made this CL much simpler overall. I am only fetching the supplemental ...
9 years, 3 months ago (2011-09-03 01:52:22 UTC) #4
Will Drewry
I'm not super familiar with this code, but on the whole it looks good. I'm ...
9 years, 3 months ago (2011-09-06 20:20:21 UTC) #5
zel
http://codereview.chromium.org/7756025/diff/20024/crypto/nss_util.cc File crypto/nss_util.cc (right): http://codereview.chromium.org/7756025/diff/20024/crypto/nss_util.cc#newcode313 crypto/nss_util.cc:313: CK_MECHANISM_TYPE type = CKM_AES_ECB; On 2011/09/06 20:20:21, Will Drewry ...
9 years, 3 months ago (2011-09-06 21:02:22 UTC) #6
wtc
LGTM on Patch Set 11. High-level comments: After reading the whole CL, I think the ...
9 years, 3 months ago (2011-09-06 21:35:17 UTC) #7
zel
9 years, 3 months ago (2011-09-06 22:33:35 UTC) #8
http://codereview.chromium.org/7756025/diff/20024/chrome/browser/chromeos/cro...
File chrome/browser/chromeos/cros/cert_library.h (right):

http://codereview.chromium.org/7756025/diff/20024/chrome/browser/chromeos/cro...
chrome/browser/chromeos/cros/cert_library.h:104: // Returns supplemental user
key.
On 2011/09/06 21:35:17, wtc wrote:
> 
> Nit: add "the".
> 
> Does the caller own the returned crypto::SymmetricKey?

Done.

http://codereview.chromium.org/7756025/diff/20024/chrome/browser/chromeos/log...
File chrome/browser/chromeos/login/login_utils.cc (right):

http://codereview.chromium.org/7756025/diff/20024/chrome/browser/chromeos/log...
chrome/browser/chromeos/login/login_utils.cc:943: } else {
On 2011/09/06 21:35:17, wtc wrote:
> Nit: omit "else" after a return statement.

Done.

http://codereview.chromium.org/7756025/diff/20024/chrome/browser/chromeos/log...
File chrome/browser/chromeos/login/parallel_authenticator.cc (right):

http://codereview.chromium.org/7756025/diff/20024/chrome/browser/chromeos/log...
chrome/browser/chromeos/login/parallel_authenticator.cc:55: std::string
DecryptTokenWithKey(
On 2011/09/06 21:35:17, wtc wrote:
> Nit: as recommended by the Style Guide, it'd be nice to
> add a comment to document what this function does.  At
> least say it is the code common to DecryptToken and
> DecryptLegacyToken.

Done.

http://codereview.chromium.org/7756025/diff/20024/chrome/browser/chromeos/log...
File chrome/browser/chromeos/login/parallel_authenticator.h (right):

http://codereview.chromium.org/7756025/diff/20024/chrome/browser/chromeos/log...
chrome/browser/chromeos/login/parallel_authenticator.h:246: // Stores a hash of
|password|, salted with the ascii of |system_salt_|.
On 2011/09/06 21:35:17, wtc wrote:
> Nit: undo the whitespace.

Done.

http://codereview.chromium.org/7756025/diff/20024/crypto/nss_util.cc
File crypto/nss_util.cc (right):

http://codereview.chromium.org/7756025/diff/20024/crypto/nss_util.cc#newcode95
crypto/nss_util.cc:95: };
On 2011/09/06 21:35:17, wtc wrote:
> 
> Nit: on line 92, remove 'static'.
> 
> You said:
> > The bits used to identify this key are pulled out of thin
> > air. Let me know if this needs to be something meaningful,
> > registered, etc.
> 
> You mean it's 16 random bytes?  The reason I suspected it
> may be a non-random key ID was that there were two 0x00
> bytes.
> 
> The key ID doesn't need to be meaningful nor registered.

Done.

http://codereview.chromium.org/7756025/diff/20024/crypto/nss_util.cc#newcode97
crypto/nss_util.cc:97: const char kSupplementalKeyNickname[] =
"ChromeOS_SupplementalUserKey";
On 2011/09/06 21:35:17, wtc wrote:
> I believe the nickname can contain spaces, so you don't need
> to use an underscore '_' or CamelCase.

I have removed the nickname, I have no good use for it anyway.

http://codereview.chromium.org/7756025/diff/20024/crypto/nss_util.cc#newcode311
crypto/nss_util.cc:311: PLArenaPool *arena = 0;
On 2011/09/06 21:35:17, wtc wrote:
> Nit: on line 310, put '*' next to the type.
> 
> On line 311, delete 'arena' (and all the code that creates
> and frees 'arena' below).  'arena' is no longer being used.

Done.

http://codereview.chromium.org/7756025/diff/20024/crypto/nss_util.cc#newcode334
crypto/nss_util.cc:334: 32,   /* keysize in bytes*/
On 2011/09/06 21:35:17, wtc wrote:
> Nit: use C++ style comment:
>   // keysize in bytes
> 
> Please create a constant for 32 around line 95 above.

Done.

http://codereview.chromium.org/7756025/diff/20024/crypto/nss_util.cc#newcode337
crypto/nss_util.cc:337: kSupplementalKeyNickname) != SECSuccess) {
On 2011/09/06 21:35:17, wtc wrote:
> I think this if statement should say:
>     if (!key || PK11_SetSymKeyNickname(key,
>          kSupplementalKeyNickname) != SECSuccess) {
> 
> IMPORTANT: does the supplemental key have to have a nickname?
> I don't think a nickname is necessary.  If you get rid of
> the PK11_SetSymKeyNickname call, then you don't need to
> fix the leak that Will Drewry pointed out.

Done.

http://codereview.chromium.org/7756025/diff/20024/crypto/nss_util.h
File crypto/nss_util.h (right):

http://codereview.chromium.org/7756025/diff/20024/crypto/nss_util.h#newcode148
crypto/nss_util.h:148: CRYPTO_EXPORT SymmetricKey* GetSupplementalUserKey();
On 2011/09/06 21:35:17, wtc wrote:
> Remove this line?  This is a duplicate declaration of the
> GetSupplementalUserKey() function.
> 
> On line 139, can you define what a "supplemental user key"
> is?  I did a Google search for "supplemental user key", and
> the first search result is this CL :-)

Done.

http://codereview.chromium.org/7756025/diff/20024/crypto/symmetric_key.h
File crypto/symmetric_key.h (right):

http://codereview.chromium.org/7756025/diff/20024/crypto/symmetric_key.h#newc...
crypto/symmetric_key.h:36: explicit SymmetricKey(PK11SymKey* key);
On 2011/09/06 21:35:17, wtc wrote:
> 
> Maybe it's better to add an ImportPlatformKey or ImportNSSKey
> static method, rather than making this constructor public.
> 
> Please document that this constructor (or static method)
> takes ownership of |key|.

Added comment.

I thought about that ImportNSSKey approach but I still don't have a good public
SymmetricKey constructor on ChromeOS. I've create a factory function
SymmetricKey::CreateFromKey() instead.

Powered by Google App Engine
This is Rietveld 408576698