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

Unified Diff: crypto/nss_util.cc

Issue 428933002: Make NSSInitSingleton::tpm_slot_ a ScopedPK11Slot. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/nss_util.cc
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc
index 96c13e219dcbe222532d4d683266217b6e47bb2d..3e7ce0c805b818a2ef6b17a0fbb54208264c531b 100644
--- a/crypto/nss_util.cc
+++ b/crypto/nss_util.cc
@@ -386,11 +386,11 @@ class NSSInitSingleton {
<< ", got tpm slot: " << !!tpm_args->tpm_slot;
chaps_module_ = tpm_args->chaps_module;
- tpm_slot_ = tpm_args->tpm_slot;
+ tpm_slot_.reset(tpm_args->tpm_slot);
Ryan Sleevi 2014/07/29 23:43:40 Would be great to either make this a scoped_ptr<>
pneubeck (no reviews) 2014/07/30 08:28:49 Done.
if (!chaps_module_ && test_system_slot_) {
// chromeos_unittests try to test the TPM initialization process. If we
// have a test DB open, pretend that it is the TPM slot.
- tpm_slot_ = PK11_ReferenceSlot(test_system_slot_.get());
+ tpm_slot_.reset(PK11_ReferenceSlot(test_system_slot_.get()));
}
initializing_tpm_token_ = false;
@@ -419,7 +419,7 @@ class NSSInitSingleton {
<< base::debug::StackTrace().ToString();
}
- if (tpm_slot_ != NULL)
+ if (tpm_slot_)
return true;
if (!callback.is_null())
@@ -596,7 +596,7 @@ class NSSInitSingleton {
#if defined(OS_CHROMEOS)
void GetSystemNSSKeySlotCallback(
const base::Callback<void(ScopedPK11Slot)>& callback) {
- callback.Run(ScopedPK11Slot(PK11_ReferenceSlot(tpm_slot_)));
+ callback.Run(ScopedPK11Slot(PK11_ReferenceSlot(tpm_slot_.get())));
}
ScopedPK11Slot GetSystemNSSKeySlot(
@@ -615,7 +615,7 @@ class NSSInitSingleton {
callback);
}
if (IsTPMTokenReady(wrapped_callback))
- return ScopedPK11Slot(PK11_ReferenceSlot(tpm_slot_));
+ return ScopedPK11Slot(PK11_ReferenceSlot(tpm_slot_.get()));
return ScopedPK11Slot();
}
#endif
@@ -639,7 +639,6 @@ class NSSInitSingleton {
: tpm_token_enabled_for_nss_(false),
initializing_tpm_token_(false),
chaps_module_(NULL),
- tpm_slot_(NULL),
root_(NULL) {
base::TimeTicks start_time = base::TimeTicks::Now();
@@ -756,10 +755,7 @@ class NSSInitSingleton {
#if defined(OS_CHROMEOS)
STLDeleteValues(&chromeos_user_map_);
#endif
- if (tpm_slot_) {
- PK11_FreeSlot(tpm_slot_);
- tpm_slot_ = NULL;
- }
+ tpm_slot_.reset();
if (root_) {
SECMOD_UnloadUserModule(root_);
SECMOD_DestroyModule(root_);
@@ -844,7 +840,7 @@ class NSSInitSingleton {
typedef std::vector<base::Closure> TPMReadyCallbackList;
TPMReadyCallbackList tpm_ready_callback_list_;
SECMODModule* chaps_module_;
- PK11SlotInfo* tpm_slot_;
+ crypto::ScopedPK11Slot tpm_slot_;
SECMODModule* root_;
#if defined(OS_CHROMEOS)
typedef std::map<std::string, ChromeOSUserData*> ChromeOSUserMap;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698