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

Unified Diff: crypto/rsa_private_key.h

Issue 881213004: Support building BoringSSL with NSS certificates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crypto/crypto.gyp ('k') | crypto/rsa_private_key_nss.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/rsa_private_key.h
diff --git a/crypto/rsa_private_key.h b/crypto/rsa_private_key.h
index 78a660e903e677df2b6211b2a40b73d3bf99ea6f..9ab9c5768c010b7352129efcdd1feb335cb6e35e 100644
--- a/crypto/rsa_private_key.h
+++ b/crypto/rsa_private_key.h
@@ -180,7 +180,22 @@ class CRYPTO_EXPORT RSAPrivateKey {
static RSAPrivateKey* CreateFromPrivateKeyInfo(
const std::vector<uint8>& input);
-#if defined(USE_NSS_CERTS)
+#if defined(USE_OPENSSL)
+ // Create a new instance from an existing EVP_PKEY, taking a
+ // reference to it. |key| must be an RSA key. Returns NULL on
+ // failure.
+ static RSAPrivateKey* CreateFromKey(EVP_PKEY* key);
+#else
+ // Create a new instance by referencing an existing private key
+ // structure. Does not import the key.
+ static RSAPrivateKey* CreateFromKey(SECKEYPrivateKey* key);
+#endif
+
+ // TODO(davidben): These functions are used when NSS is the platform key
+ // store, but they also assume that the internal crypto library is NSS. Split
+ // out the convenience NSS platform key methods from the logic which expects
+ // an RSAPrivateKey. See https://crbug.com/478777.
+#if defined(USE_NSS_CERTS) && !defined(USE_OPENSSL)
// Create a new random instance in |slot|. Can return NULL if initialization
// fails. The created key is permanent and is not exportable in plaintext
// form.
@@ -194,10 +209,6 @@ class CRYPTO_EXPORT RSAPrivateKey {
PK11SlotInfo* slot,
const std::vector<uint8>& input);
- // Create a new instance by referencing an existing private key
- // structure. Does not import the key.
- static RSAPrivateKey* CreateFromKey(SECKEYPrivateKey* key);
-
// Import an existing public key, and then search for the private
// half in the key database. The format of the public key blob is is
// an X509 SubjectPublicKeyInfo block. This can return NULL if
@@ -216,13 +227,7 @@ class CRYPTO_EXPORT RSAPrivateKey {
static RSAPrivateKey* FindFromPublicKeyInfoInSlot(
const std::vector<uint8>& input,
PK11SlotInfo* slot);
-#elif defined(USE_OPENSSL)
- // Create a new instance from an existing EVP_PKEY, taking a
- // reference to it. |key| must be an RSA key. Returns NULL on
- // failure.
- static RSAPrivateKey* CreateFromKey(EVP_PKEY* key);
-
-#endif
+#endif // USE_NSS_CERTS && !USE_OPENSSL
#if defined(USE_OPENSSL)
EVP_PKEY* key() { return key_; }
« no previous file with comments | « crypto/crypto.gyp ('k') | crypto/rsa_private_key_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698