| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/platform_keys/platform_keys.h" | 5 #include "chrome/browser/chromeos/platform_keys/platform_keys.h" |
| 6 | 6 |
| 7 #include <cert.h> | 7 #include <cert.h> |
| 8 #include <cryptohi.h> | 8 #include <cryptohi.h> |
| 9 #include <keyhi.h> | 9 #include <keyhi.h> |
| 10 #include <secder.h> | 10 #include <secder.h> |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 state->OnError(FROM_HERE, kErrorKeyNotFound); | 626 state->OnError(FROM_HERE, kErrorKeyNotFound); |
| 627 return; | 627 return; |
| 628 } else if (cert_status != net::OK) { | 628 } else if (cert_status != net::OK) { |
| 629 state->OnError(FROM_HERE, net::ErrorToString(cert_status)); | 629 state->OnError(FROM_HERE, net::ErrorToString(cert_status)); |
| 630 return; | 630 return; |
| 631 } | 631 } |
| 632 | 632 |
| 633 // Check that the private key is in the correct slot. | 633 // Check that the private key is in the correct slot. |
| 634 PK11SlotInfo* slot = | 634 PK11SlotInfo* slot = |
| 635 PK11_KeyForCertExists(state->certificate_->os_cert_handle(), NULL, NULL); | 635 PK11_KeyForCertExists(state->certificate_->os_cert_handle(), NULL, NULL); |
| 636 if (slot != state->slot_) { | 636 if (slot != state->slot_.get()) { |
| 637 state->OnError(FROM_HERE, kErrorKeyNotFound); | 637 state->OnError(FROM_HERE, kErrorKeyNotFound); |
| 638 return; | 638 return; |
| 639 } | 639 } |
| 640 | 640 |
| 641 const net::Error import_status = | 641 const net::Error import_status = |
| 642 static_cast<net::Error>(db->AddUserCert(state->certificate_.get())); | 642 static_cast<net::Error>(db->AddUserCert(state->certificate_.get())); |
| 643 if (import_status != net::OK) { | 643 if (import_status != net::OK) { |
| 644 LOG(ERROR) << "Could not import certificate."; | 644 LOG(ERROR) << "Could not import certificate."; |
| 645 state->OnError(FROM_HERE, net::ErrorToString(import_status)); | 645 state->OnError(FROM_HERE, net::ErrorToString(import_status)); |
| 646 return; | 646 return; |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 NSSOperationState* state_ptr = state.get(); | 894 NSSOperationState* state_ptr = state.get(); |
| 895 GetCertDatabase(std::string() /* don't get any specific slot */, | 895 GetCertDatabase(std::string() /* don't get any specific slot */, |
| 896 base::Bind(&GetTokensWithDB, base::Passed(&state)), | 896 base::Bind(&GetTokensWithDB, base::Passed(&state)), |
| 897 browser_context, | 897 browser_context, |
| 898 state_ptr); | 898 state_ptr); |
| 899 } | 899 } |
| 900 | 900 |
| 901 } // namespace platform_keys | 901 } // namespace platform_keys |
| 902 | 902 |
| 903 } // namespace chromeos | 903 } // namespace chromeos |
| OLD | NEW |