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

Issue 6667020: This change loads opencryptoki and uses the TPM for keygen tags. (Closed)

Created:
9 years, 9 months ago by Greg Spencer (Chromium)
Modified:
9 years, 7 months ago
Reviewers:
rginda, kmixter1, stevenjb, wtc
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org, brettw-cc_chromium.org
Visibility:
Public.

Description

This change loads opencryptoki and uses the TPM for keygen tags. on ChromeOS. After this change, on ChromeOS we will use the TPM to generate keys for keygen tags in forms. NSS will also have opencryptoki loaded so it can talk to the TPM. BUG=chromium-os:12416, chromium-os:12417 TEST=Generated keys on a ChromeOS device. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=80806

Patch Set 1 #

Patch Set 2 : removing unneeded log messages #

Patch Set 3 : Removing spurious change #

Total comments: 2

Patch Set 4 : consolidating lines #

Patch Set 5 : Added TODO #

Total comments: 50

Patch Set 6 : Review changes #

Total comments: 27

Patch Set 7 : wtc review changes #

Total comments: 7

Patch Set 8 : Final review changes #

Patch Set 9 : Adds a flag to load opencryptoki #

Patch Set 10 : Add missing arg #

Patch Set 11 : adding missing args in unit tests #

Total comments: 3

Patch Set 12 : Refactor so I don't have to pass an arg to OpenPersistentNSSDB #

Patch Set 13 : Fixed compile #

Patch Set 14 : fixing unit test #

Patch Set 15 : Splitting out public/private distinction #

Patch Set 16 : cleaning up #

Total comments: 5

Patch Set 17 : Removing _db from names #

Unified diffs Side-by-side diffs Delta from patch set Stats (+318 lines, -74 lines) Patch
M base/crypto/rsa_private_key_nss.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +3 lines, -3 lines 0 comments Download
M base/nss_util.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +14 lines, -2 lines 0 comments Download
M base/nss_util.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 15 chunks +235 lines, -49 lines 0 comments Download
M base/nss_util_internal.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +12 lines, -4 lines 0 comments Download
M chrome/browser/chromeos/login/user_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +10 lines, -0 lines 0 comments Download
M chrome/browser/ui/webui/options/certificate_manager_handler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/chrome_switches.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/chrome_switches.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +7 lines, -0 lines 0 comments Download
M net/base/cert_database.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +6 lines, -2 lines 0 comments Download
M net/base/cert_database_nss.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +14 lines, -4 lines 0 comments Download
M net/base/cert_database_nss_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M net/base/cert_database_openssl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +7 lines, -1 line 0 comments Download
M net/base/keygen_handler_nss.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +4 lines, -4 lines 0 comments Download
M net/socket/ssl_server_socket_nss.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M net/third_party/mozilla_security_manager/nsNSSCertificateDB.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 21 (0 generated)
Greg Spencer (Chromium)
9 years, 9 months ago (2011-03-12 00:26:37 UTC) #1
stevenjb
lgtm, but someone more familiar with NSS should probably look at it also. http://codereview.chromium.org/6667020/diff/3004/base/nss_util.cc File ...
9 years, 9 months ago (2011-03-14 18:41:21 UTC) #2
Greg Spencer (Chromium)
http://codereview.chromium.org/6667020/diff/3004/base/nss_util.cc File base/nss_util.cc (right): http://codereview.chromium.org/6667020/diff/3004/base/nss_util.cc#newcode58 base/nss_util.cc:58: copied = PR_GetErrorText(error_text); On 2011/03/14 18:41:21, Steven Bennetts wrote: ...
9 years, 9 months ago (2011-03-14 18:48:09 UTC) #3
Greg Spencer (Chromium)
[+wtc, who might want to be a reviewer too] Ping? kmixter, rginda, comments?
9 years, 9 months ago (2011-03-15 23:48:37 UTC) #4
wtc
gspencer: I will review this tomorrow.
9 years, 9 months ago (2011-03-16 00:20:45 UTC) #5
kmixter1
Mostly nits but one concern about init'ing the user pin. http://codereview.chromium.org/6667020/diff/4002/base/nss_util.cc File base/nss_util.cc (right): http://codereview.chromium.org/6667020/diff/4002/base/nss_util.cc#newcode48 ...
9 years, 9 months ago (2011-03-16 06:33:18 UTC) #6
rginda
http://codereview.chromium.org/6667020/diff/4002/base/nss_util.cc File base/nss_util.cc (right): http://codereview.chromium.org/6667020/diff/4002/base/nss_util.cc#newcode48 base/nss_util.cc:48: static const char kHardwareTokenName[] = "Initialized by CrOS"; On ...
9 years, 9 months ago (2011-03-16 17:09:37 UTC) #7
wtc
LGTM. All of my comments below are just nits. - I suggest renaming some variables ...
9 years, 9 months ago (2011-03-16 18:41:43 UTC) #8
Greg Spencer (Chromium)
I think I've addressed everyone's issues. Please take another look. http://codereview.chromium.org/6667020/diff/4002/base/nss_util.cc File base/nss_util.cc (right): http://codereview.chromium.org/6667020/diff/4002/base/nss_util.cc#newcode41 ...
9 years, 9 months ago (2011-03-16 21:37:51 UTC) #9
wtc
LGTM. I reviewed Patch Set 6 carefully so I apologize for the number of comments ...
9 years, 9 months ago (2011-03-17 19:34:22 UTC) #10
Greg Spencer (Chromium)
http://codereview.chromium.org/6667020/diff/14001/base/nss_util.cc File base/nss_util.cc (right): http://codereview.chromium.org/6667020/diff/14001/base/nss_util.cc#newcode44 base/nss_util.cc:44: static const char kNSSDatabaseName[] = "Real NSS database"; On ...
9 years, 9 months ago (2011-03-17 22:41:09 UTC) #11
Greg Spencer (Chromium)
http://codereview.chromium.org/6667020/diff/18001/base/nss_util.cc File base/nss_util.cc (right): http://codereview.chromium.org/6667020/diff/18001/base/nss_util.cc#newcode338 base/nss_util.cc:338: if (nodb_init) { FYI: Rietveld's diff algorithm got very ...
9 years, 9 months ago (2011-03-17 22:50:10 UTC) #12
kmixter1
LGTM - though have you checked if entd-installed certs show up in certificate manager?
9 years, 9 months ago (2011-03-18 03:53:26 UTC) #13
wtc
LGTM! I only reviewed the diffs between Patch Sets 6 and 7. http://codereview.chromium.org/6667020/diff/18001/base/nss_util.cc File base/nss_util.cc ...
9 years, 9 months ago (2011-03-18 18:36:32 UTC) #14
Greg Spencer (Chromium)
http://codereview.chromium.org/6667020/diff/18001/base/nss_util.cc File base/nss_util.cc (right): http://codereview.chromium.org/6667020/diff/18001/base/nss_util.cc#newcode21 base/nss_util.cc:21: #include "base/environment.h" On 2011/03/18 18:36:32, wtc wrote: > Nit: ...
9 years, 9 months ago (2011-03-18 20:43:11 UTC) #15
Greg Spencer (Chromium)
On 2011/03/18 03:53:26, kmixter1 wrote: > LGTM - though have you checked if entd-installed certs ...
9 years, 9 months ago (2011-03-18 20:44:02 UTC) #16
stevenjb
Still lgtm, but since I've been working on making all DBus calls asynchronous, added some ...
9 years, 8 months ago (2011-04-05 23:57:25 UTC) #17
Greg Spencer (Chromium)
OK, I've split "GetDefaultNSSKeySlot()" into a distinction between "public" and "private" storage locations. There is ...
9 years, 8 months ago (2011-04-06 21:34:45 UTC) #18
stevenjb
lgtm
9 years, 8 months ago (2011-04-07 00:44:15 UTC) #19
wtc
The renaming makes the code more confusing to me. Fortunately you wrote good comments to ...
9 years, 8 months ago (2011-04-07 05:56:33 UTC) #20
Greg Spencer (Chromium)
9 years, 8 months ago (2011-04-07 16:46:28 UTC) #21
On 2011/04/07 05:56:33, wtc wrote:
> I'm surprised that you didn't check in Patch Set 8.  I'm
> going on a one-week vacation on Friday, so I won't be able
> to spend more time on this.  You can go ahead and check this
> in to make the M12 deadline for CrOS.  I'll try to think of
> better names in M13.

OK, thanks.  Sorry for the surprise: the reason I couldn't check it in was
because there can be only one open session for opencryptoki at a time when doing
token initialization, and if I were to check it in as it was, then it would
break Google-A on ToT, and we wanted to avoid that.

http://codereview.chromium.org/6667020/diff/30017/base/nss_util.cc
File base/nss_util.cc (right):

http://codereview.chromium.org/6667020/diff/30017/base/nss_util.cc#newcode536
base/nss_util.cc:536: PK11SlotInfo* tpm_db_slot_;
On 2011/04/07 05:56:33, wtc wrote:
> This should be just tpm_slot_.  TPM is not a database.
> 
> software_db_slot_ is confusing, too.

removed _db from both.  I agree that they are not DBs.

http://codereview.chromium.org/6667020/diff/30017/base/nss_util_internal.h
File base/nss_util_internal.h (right):

http://codereview.chromium.org/6667020/diff/30017/base/nss_util_internal.h#ne...
base/nss_util_internal.h:26: PK11SlotInfo* GetPrivateNSSKeySlot();
On 2011/04/07 05:56:33, wtc wrote:
> The use of "Public" vs. "Private" here is confusing.
> I'll think about better names.  Probably GetNSSDBSlot()
> and GetPreferredPrivateKeySlot().

Well, but this enables us to implement our policy clearly: our policy is to
place all certs/keys with private matter into the TPM, and all
public-matter-only objects into the sofware slot (for speed).  When I read the
code that uses this, the names make it clear that the right policy is being
followed.

I realize that public and private are overloaded terms between crypto and C++,
but at the least I would like it to be obvious from the names they are both
using NSS, and the circumstances under which to use them.  "GetNSSDBSlot"
doesn't say anything about why you would choose that slot over the other one,
since the TPM is managed by NSS here too.

I also like the symmetry of GetPrivate/GetPublic, because it implies that if you
don't use one, you use the other one.

Powered by Google App Engine
This is Rietveld 408576698