Don't use RSAPrivateKey in NSS integration code.
commita46a990b2ccae2b66e87b5f76d2866044dc3182e
authordavidben <davidben@chromium.org>
Fri, 1 May 2015 15:35:56 +0000 (1 08:35 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 1 May 2015 15:36:27 +0000 (1 15:36 +0000)
treef0102746c81371d47dc304c401dc414ee5a570a9
parentb847f7bb3b352907f617db6896bca0d3489ccfb4
Don't use RSAPrivateKey in NSS integration code.

Currently some NSS platform integration logic transits private keys through
RSAPrivateKey on CrOS. This prevents incrementally switching RSAPrivateKey to
BoringSSL while keeping platform integrations on NSS.

The intent of this change is to clarify RSAPrivateKey as a BoringSSL vs NSS
internal crypto library (use_openssl=0 vs use_openssl=1) abstraction. It's
primarily to be used with SignatureCreator. Code which uses NSS based on
use_nss_certs rather than use_openssl because the underlying platform is NSS
should call NSS routines directly, or introduce different abstractions.

Remove the problematic RSAPrivateKey methods and instead add
crypto/nss_key_util.h which contains some helper functions for manipulating NSS
keys. This is sufficient to allow consumers of the removed methods to use NSS
directly with about as much code. (This should not set back migrating that
logic to NSS as that code was already very NSS-specific; those APIs assumed
PK11SlotInfo.)

nss_key_util.h, like nss_util.h, is built whenever NSS is used either
internally or for platform integrations. This is so rsa_private_key_nss.cc can
continue to use the helper functions to implement the NSS-agnostic interface.

With this, the chimera CrOS configuration should build. The RSAPrivateKey logic
is functional with the exception of some logic in components/ownership. That
will be resolved in a future CL.

BUG=478777

Review URL: https://codereview.chromium.org/1106103003

Cr-Commit-Position: refs/heads/master@{#327909}
19 files changed:
chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc
chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc
chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc
chrome/browser/chromeos/platform_keys/platform_keys_nss.cc
components/ownership.gypi
components/ownership/BUILD.gn
components/ownership/owner_key_util_impl.cc
crypto/BUILD.gn
crypto/crypto.gyp
crypto/crypto.gypi
crypto/nss_key_util.cc [new file with mode: 0644]
crypto/nss_key_util.h [new file with mode: 0644]
crypto/nss_key_util_unittest.cc [new file with mode: 0644]
crypto/rsa_private_key.h
crypto/rsa_private_key_nss.cc
crypto/rsa_private_key_nss_unittest.cc [deleted file]
net/net.gyp
net/test/cert_test_util.h
net/test/cert_test_util_nss.cc