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

Unified Diff: crypto/rsa_private_key_nss.cc

Issue 17265013: Remove platform-specific implementations of RSAPrivateKey and SignatureCreator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix colliding serial numbers Created 7 years, 6 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/rsa_private_key_mac.cc ('k') | crypto/rsa_private_key_openssl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/rsa_private_key_nss.cc
diff --git a/crypto/rsa_private_key_nss.cc b/crypto/rsa_private_key_nss.cc
index 357443205409adcfeb5a114e204d2d38bf50567e..35697abb4e721ed7fe14f0022cab16469b2676f1 100644
--- a/crypto/rsa_private_key_nss.cc
+++ b/crypto/rsa_private_key_nss.cc
@@ -19,8 +19,7 @@
#include "crypto/nss_util_internal.h"
#include "crypto/scoped_nss_types.h"
-// TODO(rafaelw): Consider refactoring common functions and definitions from
-// rsa_private_key_win.cc or using NSS's ASN.1 encoder.
+// TODO(rafaelw): Consider using NSS's ASN.1 encoder.
namespace {
static bool ReadAttribute(SECKEYPrivateKey* key,
@@ -53,31 +52,32 @@ RSAPrivateKey::~RSAPrivateKey() {
// static
RSAPrivateKey* RSAPrivateKey::Create(uint16 num_bits) {
return CreateWithParams(num_bits,
- PR_FALSE /* not permanent */,
- PR_FALSE /* not sensitive */);
-}
-
-// static
-RSAPrivateKey* RSAPrivateKey::CreateSensitive(uint16 num_bits) {
- return CreateWithParams(num_bits,
- PR_TRUE /* permanent */,
- PR_TRUE /* sensitive */);
+ false /* not permanent */,
+ false /* not sensitive */);
}
// static
RSAPrivateKey* RSAPrivateKey::CreateFromPrivateKeyInfo(
const std::vector<uint8>& input) {
return CreateFromPrivateKeyInfoWithParams(input,
- PR_FALSE /* not permanent */,
- PR_FALSE /* not sensitive */);
+ false /* not permanent */,
+ false /* not sensitive */);
+}
+
+#if defined(USE_NSS)
+// static
+RSAPrivateKey* RSAPrivateKey::CreateSensitive(uint16 num_bits) {
+ return CreateWithParams(num_bits,
+ true /* permanent */,
+ true /* sensitive */);
}
// static
RSAPrivateKey* RSAPrivateKey::CreateSensitiveFromPrivateKeyInfo(
const std::vector<uint8>& input) {
return CreateFromPrivateKeyInfoWithParams(input,
- PR_TRUE /* permanent */,
- PR_TRUE /* sensitive */);
+ true /* permanent */,
+ true /* sensitive */);
}
// static
@@ -153,6 +153,7 @@ RSAPrivateKey* RSAPrivateKey::FindFromPublicKeyInfo(
// We didn't find the key.
return NULL;
}
+#endif
RSAPrivateKey* RSAPrivateKey::Copy() const {
RSAPrivateKey* copy = new RSAPrivateKey();
@@ -202,6 +203,13 @@ RSAPrivateKey::RSAPrivateKey() : key_(NULL), public_key_(NULL) {
RSAPrivateKey* RSAPrivateKey::CreateWithParams(uint16 num_bits,
bool permanent,
bool sensitive) {
+#if !defined(USE_NSS)
+ if (permanent) {
+ NOTIMPLEMENTED();
+ return NULL;
+ }
+#endif
+
EnsureNSSInit();
scoped_ptr<RSAPrivateKey> result(new RSAPrivateKey);
@@ -230,6 +238,13 @@ RSAPrivateKey* RSAPrivateKey::CreateWithParams(uint16 num_bits,
// static
RSAPrivateKey* RSAPrivateKey::CreateFromPrivateKeyInfoWithParams(
const std::vector<uint8>& input, bool permanent, bool sensitive) {
+#if !defined(USE_NSS)
+ if (permanent) {
+ NOTIMPLEMENTED();
+ return NULL;
+ }
+#endif
+
// This method currently leaks some memory.
// See http://crbug.com/34742.
ANNOTATE_SCOPED_MEMORY_LEAK;
« no previous file with comments | « crypto/rsa_private_key_mac.cc ('k') | crypto/rsa_private_key_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698