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

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: Review feedback 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
Index: crypto/rsa_private_key_nss.cc
diff --git a/crypto/rsa_private_key_nss.cc b/crypto/rsa_private_key_nss.cc
index a89454e378442f92469ea38f99780f2bd3349a0e..5a99d70cb0778a9eee42afd67a54c0862d33fb41 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);
@@ -229,6 +237,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;

Powered by Google App Engine
This is Rietveld 408576698