From 3f1f841392663dfb331150218908e3c159be1286 Mon Sep 17 00:00:00 2001 From: "mattm@chromium.org" Date: Wed, 19 Jan 2011 03:01:23 +0000 Subject: Cleanup for r71281: replace usage of "pk11" with "pkcs11" or "crypto module", as appropriate. BUG=42073 TEST=manual,trybotss Review URL: http://codereview.chromium.org/6303004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71749 0039d316-1c4b-4281-b951-d872f2087c98 --- base/base.gypi | 2 +- .../crypto_module_blocking_password_delegate.h | 34 ++++++++++++++++++++++ base/crypto/pk11_blocking_password_delegate.h | 34 ---------------------- base/nss_util.cc | 12 ++++---- 4 files changed, 41 insertions(+), 41 deletions(-) create mode 100644 base/crypto/crypto_module_blocking_password_delegate.h delete mode 100644 base/crypto/pk11_blocking_password_delegate.h (limited to 'base') diff --git a/base/base.gypi b/base/base.gypi index e2c659a..b68ced8 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -556,6 +556,7 @@ 'sources': [ 'crypto/capi_util.cc', 'crypto/capi_util.h', + 'crypto/crypto_module_blocking_password_delegate.h', 'crypto/cssm_init.cc', 'crypto/cssm_init.h', 'crypto/encryptor.h', @@ -563,7 +564,6 @@ 'crypto/encryptor_nss.cc', 'crypto/encryptor_openssl.cc', 'crypto/encryptor_win.cc', - 'crypto/pk11_blocking_password_delegate.h', 'crypto/rsa_private_key.h', 'crypto/rsa_private_key.cc', 'crypto/rsa_private_key_mac.cc', diff --git a/base/crypto/crypto_module_blocking_password_delegate.h b/base/crypto/crypto_module_blocking_password_delegate.h new file mode 100644 index 0000000..ae962a8 --- /dev/null +++ b/base/crypto/crypto_module_blocking_password_delegate.h @@ -0,0 +1,34 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_CRYPTO_CRYPTO_MODULE_BLOCKING_PASSWORD_DELEGATE_H_ +#define BASE_CRYPTO_CRYPTO_MODULE_BLOCKING_PASSWORD_DELEGATE_H_ +#pragma once + +#include + +namespace base { + +// PK11_SetPasswordFunc is a global setting. An implementation of +// CryptoModuleBlockingPasswordDelegate should be passed as the user data +// argument (|wincx|) to relevant NSS functions, which the global password +// handler will call to do the actual work. +class CryptoModuleBlockingPasswordDelegate { + public: + virtual ~CryptoModuleBlockingPasswordDelegate() {} + + // Requests a password to unlock |slot_name|. The interface is + // synchronous because NSS cannot issue an asynchronous + // request. |retry| is true if this is a request for the retry + // and we previously returned the wrong password. + // The implementation should set |*cancelled| to true if the user cancelled + // instead of entering a password, otherwise it should return the password the + // user entered. + virtual std::string RequestPassword(const std::string& slot_name, bool retry, + bool* cancelled) = 0; +}; + +} + +#endif // BASE_CRYPTO_CRYPTO_MODULE_BLOCKING_PASSWORD_DELEGATE_H_ diff --git a/base/crypto/pk11_blocking_password_delegate.h b/base/crypto/pk11_blocking_password_delegate.h deleted file mode 100644 index c9eb35c..0000000 --- a/base/crypto/pk11_blocking_password_delegate.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef BASE_CRYPTO_PK11_BLOCKING_PASSWORD_DELEGATE_H_ -#define BASE_CRYPTO_PK11_BLOCKING_PASSWORD_DELEGATE_H_ -#pragma once - -#include - -namespace base { - -// PK11_SetPasswordFunc is a global setting. An implementation of -// PK11BlockingPasswordDelegate should be passed as the user data argument -// (|wincx|) to relevant NSS functions, which the global password handler will -// call to do the actual work. -class PK11BlockingPasswordDelegate { - public: - virtual ~PK11BlockingPasswordDelegate() {} - - // Requests a password to unlock |slot_name|. The interface is - // synchronous because NSS cannot issue an asynchronous - // request. |retry| is true if this is a request for the retry - // and we previously returned the wrong password. - // The implementation should set |*cancelled| to true if the user cancelled - // instead of entering a password, otherwise it should return the password the - // user entered. - virtual std::string RequestPassword(const std::string& slot_name, bool retry, - bool* cancelled) = 0; -}; - -} - -#endif // BASE_CRYPTO_PK11_BLOCKING_PASSWORD_DELEGATE_H_ diff --git a/base/nss_util.cc b/base/nss_util.cc index da678f0..384cc0d 100644 --- a/base/nss_util.cc +++ b/base/nss_util.cc @@ -29,7 +29,7 @@ // use NSS for crypto or certificate verification, and we don't use the NSS // certificate and key databases. #if defined(USE_NSS) -#include "base/crypto/pk11_blocking_password_delegate.h" +#include "base/crypto/crypto_module_blocking_password_delegate.h" #include "base/environment.h" #include "base/lock.h" #include "base/scoped_ptr.h" @@ -71,10 +71,10 @@ FilePath GetInitialConfigDirectory() { } // This callback for NSS forwards all requests to a caller-specified -// PK11BlockingPasswordDelegate object. -char* PK11PasswordFunc(PK11SlotInfo* slot, PRBool retry, void* arg) { - base::PK11BlockingPasswordDelegate* delegate = - reinterpret_cast(arg); +// CryptoModuleBlockingPasswordDelegate object. +char* PKCS11PasswordFunc(PK11SlotInfo* slot, PRBool retry, void* arg) { + base::CryptoModuleBlockingPasswordDelegate* delegate = + reinterpret_cast(arg); if (delegate) { bool cancelled = false; std::string password = delegate->RequestPassword(PK11_GetTokenName(slot), @@ -274,7 +274,7 @@ class NSSInitSingleton { } } - PK11_SetPasswordFunc(PK11PasswordFunc); + PK11_SetPasswordFunc(PKCS11PasswordFunc); // If we haven't initialized the password for the NSS databases, // initialize an empty-string password so that we don't need to -- cgit v1.1