| Index: net/base/keygen_handler_nss.cc
|
| diff --git a/net/base/keygen_handler_nss.cc b/net/base/keygen_handler_nss.cc
|
| index e5f28ac190830b497c7387e50e8c9f6af7a2cac6..c31c4c56c1bcfcd9968c20564bf6892558edc3a3 100644
|
| --- a/net/base/keygen_handler_nss.cc
|
| +++ b/net/base/keygen_handler_nss.cc
|
| @@ -7,8 +7,6 @@
|
| #include "base/logging.h"
|
| #include "crypto/nss_crypto_module_delegate.h"
|
| #include "crypto/nss_util.h"
|
| -#include "crypto/nss_util_internal.h"
|
| -#include "crypto/scoped_nss_types.h"
|
| #include "net/third_party/mozilla_security_manager/nsKeygenHandler.h"
|
|
|
| // PSM = Mozilla's Personal Security Manager.
|
| @@ -17,35 +15,33 @@ namespace psm = mozilla_security_manager;
|
| namespace net {
|
|
|
| std::string KeygenHandler::GenKeyAndSignChallenge() {
|
| - // Ensure NSS is initialized.
|
| crypto::EnsureNSSInit();
|
|
|
| - crypto::ScopedPK11Slot slot;
|
| - if (crypto_module_delegate_)
|
| - slot = crypto_module_delegate_->RequestSlot().Pass();
|
| - else
|
| - slot.reset(crypto::GetPersistentNSSKeySlot());
|
| - if (!slot.get()) {
|
| - LOG(ERROR) << "Couldn't get private key slot from NSS!";
|
| + if (!slot_) {
|
| + LOG(ERROR) << "No slot set.";
|
| return std::string();
|
| }
|
|
|
| // Authenticate to the token.
|
| if (SECSuccess !=
|
| PK11_Authenticate(
|
| - slot.get(),
|
| + slot_.get(),
|
| PR_TRUE,
|
| crypto_module_delegate_ ? crypto_module_delegate_->wincx() : NULL)) {
|
| LOG(ERROR) << "Couldn't authenticate to private key slot!";
|
| return std::string();
|
| }
|
|
|
| - return psm::GenKeyAndSignChallenge(key_size_in_bits_, challenge_, url_,
|
| - slot.get(), stores_key_);
|
| + return psm::GenKeyAndSignChallenge(
|
| + key_size_in_bits_, challenge_, url_, slot_.get(), stores_key_);
|
| +}
|
| +
|
| +void KeygenHandler::set_key_slot(PK11SlotInfo* slot) {
|
| + slot_.reset(PK11_ReferenceSlot(slot));
|
| }
|
|
|
| void KeygenHandler::set_crypto_module_delegate(
|
| - scoped_ptr<crypto::NSSCryptoModuleDelegate> delegate) {
|
| + scoped_ptr<crypto::CryptoModuleBlockingPasswordDelegate> delegate) {
|
| crypto_module_delegate_ = delegate.Pass();
|
| }
|
|
|
|
|