summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chromeos/dbus/cryptohome_client_stub.cc13
-rw-r--r--crypto/nss_util.cc4
-rw-r--r--crypto/nss_util.h3
3 files changed, 13 insertions, 7 deletions
diff --git a/chromeos/dbus/cryptohome_client_stub.cc b/chromeos/dbus/cryptohome_client_stub.cc
index e9faeec..96728a9 100644
--- a/chromeos/dbus/cryptohome_client_stub.cc
+++ b/chromeos/dbus/cryptohome_client_stub.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/message_loop/message_loop.h"
+#include "crypto/nss_util.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace chromeos {
@@ -184,13 +185,13 @@ void CryptohomeClientStubImpl::Pkcs11IsTpmTokenReady(
void CryptohomeClientStubImpl::Pkcs11GetTpmTokenInfo(
const Pkcs11GetTpmTokenInfoCallback& callback) {
- const char kStubLabel[] = "Stub TPM Token";
const char kStubUserPin[] = "012345";
- base::MessageLoop::current()->PostTask(FROM_HERE,
- base::Bind(callback,
- DBUS_METHOD_CALL_SUCCESS,
- std::string(kStubLabel),
- std::string(kStubUserPin)));
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(callback,
+ DBUS_METHOD_CALL_SUCCESS,
+ std::string(crypto::kTestTPMTokenName),
+ std::string(kStubUserPin)));
}
bool CryptohomeClientStubImpl::InstallAttributesGet(const std::string& name,
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc
index 069d5b6..27541ca 100644
--- a/crypto/nss_util.cc
+++ b/crypto/nss_util.cc
@@ -313,7 +313,7 @@ class NSSInitSingleton {
return true;
if (!g_test_nss_db_dir.Get().CreateUniqueTempDir())
return false;
- test_slot_ = OpenUserDB(g_test_nss_db_dir.Get().path(), "Test DB");
+ test_slot_ = OpenUserDB(g_test_nss_db_dir.Get().path(), kTestTPMTokenName);
return !!test_slot_;
}
@@ -594,6 +594,8 @@ base::LazyInstance<NSSInitSingleton>::Leaky
g_nss_singleton = LAZY_INSTANCE_INITIALIZER;
} // namespace
+const char kTestTPMTokenName[] = "Test DB";
+
#if defined(USE_NSS)
void EarlySetupForNSSInit() {
base::FilePath database_dir = GetInitialConfigDirectory();
diff --git a/crypto/nss_util.h b/crypto/nss_util.h
index 77a9649..1d7503d 100644
--- a/crypto/nss_util.h
+++ b/crypto/nss_util.h
@@ -20,6 +20,9 @@ class Time;
// initialization functions.
namespace crypto {
+// The TPMToken name used for the NSS slot opened by ScopedTestNSSDB.
+CRYPTO_EXPORT extern const char kTestTPMTokenName[];
+
#if defined(USE_NSS)
// EarlySetupForNSSInit performs lightweight setup which must occur before the
// process goes multithreaded. This does not initialise NSS. For test, see