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/login/auth/chrome_cryptohome_authenticator.h" | 5 #include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include <string> | 9 #include <string> |
8 #include <vector> | 10 #include <vector> |
9 | 11 |
10 #include "base/basictypes.h" | |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
13 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 15 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
16 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
17 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
18 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
19 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 21 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
20 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" | 22 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
21 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact
ory.h" | 23 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact
ory.h" |
22 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 24 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
23 #include "chrome/browser/chromeos/settings/cros_settings.h" | 25 #include "chrome/browser/chromeos/settings/cros_settings.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 67 |
66 namespace { | 68 namespace { |
67 | 69 |
68 // Label under which the user's key is stored. | 70 // Label under which the user's key is stored. |
69 const char kCryptohomeGAIAKeyLabel[] = "gaia"; | 71 const char kCryptohomeGAIAKeyLabel[] = "gaia"; |
70 | 72 |
71 // Salt used by pre-hashed key. | 73 // Salt used by pre-hashed key. |
72 const char kSalt[] = "SALT $$"; | 74 const char kSalt[] = "SALT $$"; |
73 | 75 |
74 // An owner key in PKCS#8 PrivateKeyInfo for testing owner checks. | 76 // An owner key in PKCS#8 PrivateKeyInfo for testing owner checks. |
75 const uint8 kOwnerPrivateKey[] = { | 77 const uint8_t kOwnerPrivateKey[] = { |
76 0x30, 0x82, 0x01, 0x53, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, | 78 0x30, 0x82, 0x01, 0x53, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, |
77 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, | 79 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, |
78 0x01, 0x3d, 0x30, 0x82, 0x01, 0x39, 0x02, 0x01, 0x00, 0x02, 0x41, 0x00, | 80 0x01, 0x3d, 0x30, 0x82, 0x01, 0x39, 0x02, 0x01, 0x00, 0x02, 0x41, 0x00, |
79 0xb4, 0xf5, 0xab, 0xfe, 0xd8, 0xf1, 0xcb, 0x5f, 0x8f, 0x48, 0x3e, 0xdf, | 81 0xb4, 0xf5, 0xab, 0xfe, 0xd8, 0xf1, 0xcb, 0x5f, 0x8f, 0x48, 0x3e, 0xdf, |
80 0x40, 0x8e, 0x2b, 0x15, 0x43, 0x6c, 0x67, 0x74, 0xa2, 0xcb, 0xe4, 0xf3, | 82 0x40, 0x8e, 0x2b, 0x15, 0x43, 0x6c, 0x67, 0x74, 0xa2, 0xcb, 0xe4, 0xf3, |
81 0xec, 0xab, 0x41, 0x57, 0x1d, 0x5f, 0xed, 0xcf, 0x09, 0xf4, 0xcc, 0xbb, | 83 0xec, 0xab, 0x41, 0x57, 0x1d, 0x5f, 0xed, 0xcf, 0x09, 0xf4, 0xcc, 0xbb, |
82 0x52, 0x52, 0xe8, 0x46, 0xf5, 0xc5, 0x01, 0xa3, 0xd8, 0x24, 0xc0, 0x15, | 84 0x52, 0x52, 0xe8, 0x46, 0xf5, 0xc5, 0x01, 0xa3, 0xd8, 0x24, 0xc0, 0x15, |
83 0xc5, 0x65, 0x50, 0x7d, 0xbd, 0x4e, 0x81, 0xb2, 0x28, 0x38, 0xf9, 0x3d, | 85 0xc5, 0x65, 0x50, 0x7d, 0xbd, 0x4e, 0x81, 0xb2, 0x28, 0x38, 0xf9, 0x3d, |
84 0x3e, 0x2a, 0x68, 0xf7, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x40, 0x40, | 86 0x3e, 0x2a, 0x68, 0xf7, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x40, 0x40, |
85 0xc7, 0xb5, 0xb3, 0xbc, 0xac, 0x0a, 0x77, 0x02, 0x0f, 0x05, 0xda, 0xdb, | 87 0xc7, 0xb5, 0xb3, 0xbc, 0xac, 0x0a, 0x77, 0x02, 0x0f, 0x05, 0xda, 0xdb, |
(...skipping 11 matching lines...) Expand all Loading... |
97 0x72, 0xcc, 0xd4, 0xf3, 0x97, 0xc6, 0x44, 0x55, 0xf2, 0xe0, 0x94, 0x9c, | 99 0x72, 0xcc, 0xd4, 0xf3, 0x97, 0xc6, 0x44, 0x55, 0xf2, 0xe0, 0x94, 0x9c, |
98 0x97, 0x75, 0x64, 0x34, 0x52, 0x4b, 0xc1, 0x53, 0xdd, 0x8f, 0x21, 0x02, | 100 0x97, 0x75, 0x64, 0x34, 0x52, 0x4b, 0xc1, 0x53, 0xdd, 0x8f, 0x21, 0x02, |
99 0x20, 0x0e, 0xef, 0x48, 0x92, 0x2d, 0x9c, 0xe8, 0xd3, 0x7e, 0x1e, 0x55, | 101 0x20, 0x0e, 0xef, 0x48, 0x92, 0x2d, 0x9c, 0xe8, 0xd3, 0x7e, 0x1e, 0x55, |
100 0x0f, 0x23, 0x74, 0x76, 0x07, 0xec, 0x2c, 0x9e, 0xe4, 0x0e, 0xc0, 0x72, | 102 0x0f, 0x23, 0x74, 0x76, 0x07, 0xec, 0x2c, 0x9e, 0xe4, 0x0e, 0xc0, 0x72, |
101 0xeb, 0x70, 0xcb, 0x74, 0xef, 0xcc, 0x26, 0x50, 0xff, 0x02, 0x20, 0x29, | 103 0xeb, 0x70, 0xcb, 0x74, 0xef, 0xcc, 0x26, 0x50, 0xff, 0x02, 0x20, 0x29, |
102 0x32, 0xd0, 0xbf, 0x11, 0xf2, 0xbf, 0x54, 0xfd, 0x6d, 0xf2, 0x1c, 0xbe, | 104 0x32, 0xd0, 0xbf, 0x11, 0xf2, 0xbf, 0x54, 0xfd, 0x6d, 0xf2, 0x1c, 0xbe, |
103 0x50, 0x18, 0x62, 0x6d, 0x23, 0xe4, 0x26, 0x03, 0x8b, 0xb3, 0x42, 0x24, | 105 0x50, 0x18, 0x62, 0x6d, 0x23, 0xe4, 0x26, 0x03, 0x8b, 0xb3, 0x42, 0x24, |
104 0x7e, 0x68, 0x37, 0x26, 0xda, 0xb9, 0x87}; | 106 0x7e, 0x68, 0x37, 0x26, 0xda, 0xb9, 0x87}; |
105 | 107 |
106 // The public key alone matcing kOwnerPrivateKey. | 108 // The public key alone matcing kOwnerPrivateKey. |
107 const uint8 kOwnerPublicKey[] = { | 109 const uint8_t kOwnerPublicKey[] = { |
108 0x30, 0x5c, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, | 110 0x30, 0x5c, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, |
109 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b, 0x00, 0x30, 0x48, 0x02, 0x41, | 111 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b, 0x00, 0x30, 0x48, 0x02, 0x41, |
110 0x00, 0xb4, 0xf5, 0xab, 0xfe, 0xd8, 0xf1, 0xcb, 0x5f, 0x8f, 0x48, 0x3e, | 112 0x00, 0xb4, 0xf5, 0xab, 0xfe, 0xd8, 0xf1, 0xcb, 0x5f, 0x8f, 0x48, 0x3e, |
111 0xdf, 0x40, 0x8e, 0x2b, 0x15, 0x43, 0x6c, 0x67, 0x74, 0xa2, 0xcb, 0xe4, | 113 0xdf, 0x40, 0x8e, 0x2b, 0x15, 0x43, 0x6c, 0x67, 0x74, 0xa2, 0xcb, 0xe4, |
112 0xf3, 0xec, 0xab, 0x41, 0x57, 0x1d, 0x5f, 0xed, 0xcf, 0x09, 0xf4, 0xcc, | 114 0xf3, 0xec, 0xab, 0x41, 0x57, 0x1d, 0x5f, 0xed, 0xcf, 0x09, 0xf4, 0xcc, |
113 0xbb, 0x52, 0x52, 0xe8, 0x46, 0xf5, 0xc5, 0x01, 0xa3, 0xd8, 0x24, 0xc0, | 115 0xbb, 0x52, 0x52, 0xe8, 0x46, 0xf5, 0xc5, 0x01, 0xa3, 0xd8, 0x24, 0xc0, |
114 0x15, 0xc5, 0x65, 0x50, 0x7d, 0xbd, 0x4e, 0x81, 0xb2, 0x28, 0x38, 0xf9, | 116 0x15, 0xc5, 0x65, 0x50, 0x7d, 0xbd, 0x4e, 0x81, 0xb2, 0x28, 0x38, 0xf9, |
115 0x3d, 0x3e, 0x2a, 0x68, 0xf7, 0x02, 0x03, 0x01, 0x00, 0x01}; | 117 0x3d, 0x3e, 0x2a, 0x68, 0xf7, 0x02, 0x03, 0x01, 0x00, 0x01}; |
116 | 118 |
117 std::vector<uint8> GetOwnerPublicKey() { | 119 std::vector<uint8_t> GetOwnerPublicKey() { |
118 return std::vector<uint8>(kOwnerPublicKey, | 120 return std::vector<uint8_t>(kOwnerPublicKey, |
119 kOwnerPublicKey + arraysize(kOwnerPublicKey)); | 121 kOwnerPublicKey + arraysize(kOwnerPublicKey)); |
120 } | 122 } |
121 | 123 |
122 bool CreateOwnerKeyInSlot(PK11SlotInfo* slot) { | 124 bool CreateOwnerKeyInSlot(PK11SlotInfo* slot) { |
123 const std::vector<uint8> key(kOwnerPrivateKey, | 125 const std::vector<uint8_t> key( |
124 kOwnerPrivateKey + arraysize(kOwnerPrivateKey)); | 126 kOwnerPrivateKey, kOwnerPrivateKey + arraysize(kOwnerPrivateKey)); |
125 return crypto::ImportNSSKeyFromPrivateKeyInfo(slot, key, | 127 return crypto::ImportNSSKeyFromPrivateKeyInfo(slot, key, |
126 true /* permanent */); | 128 true /* permanent */); |
127 } | 129 } |
128 | 130 |
129 } // namespace | 131 } // namespace |
130 | 132 |
131 class CryptohomeAuthenticatorTest : public testing::Test { | 133 class CryptohomeAuthenticatorTest : public testing::Test { |
132 public: | 134 public: |
133 CryptohomeAuthenticatorTest() | 135 CryptohomeAuthenticatorTest() |
134 : user_context_(AccountId::FromUserEmail("me@nowhere.org")), | 136 : user_context_(AccountId::FromUserEmail("me@nowhere.org")), |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 .WillOnce(Invoke(MockAuthStatusConsumer::OnGuestSuccessQuit)) | 240 .WillOnce(Invoke(MockAuthStatusConsumer::OnGuestSuccessQuit)) |
239 .RetiresOnSaturation(); | 241 .RetiresOnSaturation(); |
240 } | 242 } |
241 | 243 |
242 void ExpectPasswordChange() { | 244 void ExpectPasswordChange() { |
243 EXPECT_CALL(consumer_, OnPasswordChangeDetected()) | 245 EXPECT_CALL(consumer_, OnPasswordChangeDetected()) |
244 .WillOnce(Invoke(MockAuthStatusConsumer::OnMigrateQuit)) | 246 .WillOnce(Invoke(MockAuthStatusConsumer::OnMigrateQuit)) |
245 .RetiresOnSaturation(); | 247 .RetiresOnSaturation(); |
246 } | 248 } |
247 | 249 |
248 void ExpectGetKeyDataExCall(scoped_ptr<int64> key_type, | 250 void ExpectGetKeyDataExCall(scoped_ptr<int64_t> key_type, |
249 scoped_ptr<std::string> salt) { | 251 scoped_ptr<std::string> salt) { |
250 key_definitions_.clear(); | 252 key_definitions_.clear(); |
251 key_definitions_.push_back(cryptohome::KeyDefinition( | 253 key_definitions_.push_back(cryptohome::KeyDefinition( |
252 std::string() /* secret */, | 254 std::string() /* secret */, |
253 kCryptohomeGAIAKeyLabel, | 255 kCryptohomeGAIAKeyLabel, |
254 cryptohome::PRIV_DEFAULT)); | 256 cryptohome::PRIV_DEFAULT)); |
255 cryptohome::KeyDefinition& key_definition = key_definitions_.back(); | 257 cryptohome::KeyDefinition& key_definition = key_definitions_.back(); |
256 key_definition.revision = 1; | 258 key_definition.revision = 1; |
257 if (key_type) { | 259 if (key_type) { |
258 key_definition.provider_data.push_back( | 260 key_definition.provider_data.push_back( |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 // Set up mock async method caller to respond successfully to a cryptohome | 562 // Set up mock async method caller to respond successfully to a cryptohome |
561 // remove attempt. | 563 // remove attempt. |
562 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); | 564 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); |
563 EXPECT_CALL(*mock_caller_, | 565 EXPECT_CALL(*mock_caller_, |
564 AsyncRemove(user_context_.GetAccountId().GetUserEmail(), _)) | 566 AsyncRemove(user_context_.GetAccountId().GetUserEmail(), _)) |
565 .Times(1) | 567 .Times(1) |
566 .RetiresOnSaturation(); | 568 .RetiresOnSaturation(); |
567 | 569 |
568 // Set up mock homedir methods to respond successfully to a cryptohome create | 570 // Set up mock homedir methods to respond successfully to a cryptohome create |
569 // attempt. | 571 // attempt. |
570 ExpectGetKeyDataExCall(scoped_ptr<int64>(), scoped_ptr<std::string>()); | 572 ExpectGetKeyDataExCall(scoped_ptr<int64_t>(), scoped_ptr<std::string>()); |
571 ExpectMountExCall(true /* expect_create_attempt */); | 573 ExpectMountExCall(true /* expect_create_attempt */); |
572 | 574 |
573 state_->PresetOnlineLoginStatus(AuthFailure::AuthFailureNone()); | 575 state_->PresetOnlineLoginStatus(AuthFailure::AuthFailureNone()); |
574 SetAttemptState(auth_.get(), state_.release()); | 576 SetAttemptState(auth_.get(), state_.release()); |
575 | 577 |
576 auth_->ResyncEncryptedData(); | 578 auth_->ResyncEncryptedData(); |
577 base::MessageLoop::current()->Run(); | 579 base::MessageLoop::current()->Run(); |
578 } | 580 } |
579 | 581 |
580 TEST_F(CryptohomeAuthenticatorTest, DriveResyncFail) { | 582 TEST_F(CryptohomeAuthenticatorTest, DriveResyncFail) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 // Set up mock async method caller to respond successfully to a key migration. | 617 // Set up mock async method caller to respond successfully to a key migration. |
616 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); | 618 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); |
617 EXPECT_CALL(*mock_caller_, | 619 EXPECT_CALL(*mock_caller_, |
618 AsyncMigrateKey(user_context_.GetAccountId().GetUserEmail(), _, | 620 AsyncMigrateKey(user_context_.GetAccountId().GetUserEmail(), _, |
619 transformed_key_.GetSecret(), _)) | 621 transformed_key_.GetSecret(), _)) |
620 .Times(1) | 622 .Times(1) |
621 .RetiresOnSaturation(); | 623 .RetiresOnSaturation(); |
622 | 624 |
623 // Set up mock homedir methods to respond successfully to a cryptohome mount | 625 // Set up mock homedir methods to respond successfully to a cryptohome mount |
624 // attempt. | 626 // attempt. |
625 ExpectGetKeyDataExCall(scoped_ptr<int64>(), scoped_ptr<std::string>()); | 627 ExpectGetKeyDataExCall(scoped_ptr<int64_t>(), scoped_ptr<std::string>()); |
626 ExpectMountExCall(false /* expect_create_attempt */); | 628 ExpectMountExCall(false /* expect_create_attempt */); |
627 | 629 |
628 state_->PresetOnlineLoginStatus(AuthFailure::AuthFailureNone()); | 630 state_->PresetOnlineLoginStatus(AuthFailure::AuthFailureNone()); |
629 SetAttemptState(auth_.get(), state_.release()); | 631 SetAttemptState(auth_.get(), state_.release()); |
630 | 632 |
631 auth_->RecoverEncryptedData(std::string()); | 633 auth_->RecoverEncryptedData(std::string()); |
632 base::MessageLoop::current()->Run(); | 634 base::MessageLoop::current()->Run(); |
633 } | 635 } |
634 | 636 |
635 TEST_F(CryptohomeAuthenticatorTest, DriveDataRecoverButFail) { | 637 TEST_F(CryptohomeAuthenticatorTest, DriveDataRecoverButFail) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 | 679 |
678 TEST_F(CryptohomeAuthenticatorTest, DriveCreateForNewUser) { | 680 TEST_F(CryptohomeAuthenticatorTest, DriveCreateForNewUser) { |
679 UserContext expected_user_context(user_context_with_transformed_key_); | 681 UserContext expected_user_context(user_context_with_transformed_key_); |
680 expected_user_context.SetUserIDHash( | 682 expected_user_context.SetUserIDHash( |
681 cryptohome::MockAsyncMethodCaller::kFakeSanitizedUsername); | 683 cryptohome::MockAsyncMethodCaller::kFakeSanitizedUsername); |
682 ExpectLoginSuccess(expected_user_context); | 684 ExpectLoginSuccess(expected_user_context); |
683 FailOnLoginFailure(); | 685 FailOnLoginFailure(); |
684 | 686 |
685 // Set up mock homedir methods to respond successfully to a cryptohome create | 687 // Set up mock homedir methods to respond successfully to a cryptohome create |
686 // attempt. | 688 // attempt. |
687 ExpectGetKeyDataExCall(scoped_ptr<int64>(), scoped_ptr<std::string>()); | 689 ExpectGetKeyDataExCall(scoped_ptr<int64_t>(), scoped_ptr<std::string>()); |
688 ExpectMountExCall(true /* expect_create_attempt */); | 690 ExpectMountExCall(true /* expect_create_attempt */); |
689 | 691 |
690 // Set up state as though a cryptohome mount attempt has occurred | 692 // Set up state as though a cryptohome mount attempt has occurred |
691 // and been rejected because the user doesn't exist; additionally, | 693 // and been rejected because the user doesn't exist; additionally, |
692 // an online auth attempt has completed successfully. | 694 // an online auth attempt has completed successfully. |
693 state_->PresetCryptohomeStatus(false, | 695 state_->PresetCryptohomeStatus(false, |
694 cryptohome::MOUNT_ERROR_USER_DOES_NOT_EXIST); | 696 cryptohome::MOUNT_ERROR_USER_DOES_NOT_EXIST); |
695 state_->PresetOnlineLoginStatus(AuthFailure::AuthFailureNone()); | 697 state_->PresetOnlineLoginStatus(AuthFailure::AuthFailureNone()); |
696 SetAttemptState(auth_.get(), state_.release()); | 698 SetAttemptState(auth_.get(), state_.release()); |
697 | 699 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 expected_user_context.SetUserIDHash( | 748 expected_user_context.SetUserIDHash( |
747 cryptohome::MockAsyncMethodCaller::kFakeSanitizedUsername); | 749 cryptohome::MockAsyncMethodCaller::kFakeSanitizedUsername); |
748 ExpectLoginSuccess(expected_user_context); | 750 ExpectLoginSuccess(expected_user_context); |
749 FailOnLoginFailure(); | 751 FailOnLoginFailure(); |
750 | 752 |
751 // Set up mock homedir methods to respond with key metadata indicating that a | 753 // Set up mock homedir methods to respond with key metadata indicating that a |
752 // pre-hashed key was used to create the cryptohome and allow a successful | 754 // pre-hashed key was used to create the cryptohome and allow a successful |
753 // mount when this pre-hashed key is used. | 755 // mount when this pre-hashed key is used. |
754 | 756 |
755 ExpectGetKeyDataExCall( | 757 ExpectGetKeyDataExCall( |
756 make_scoped_ptr(new int64(Key::KEY_TYPE_SALTED_SHA256)), | 758 make_scoped_ptr(new int64_t(Key::KEY_TYPE_SALTED_SHA256)), |
757 make_scoped_ptr(new std::string(kSalt))); | 759 make_scoped_ptr(new std::string(kSalt))); |
758 ExpectMountExCall(false /* expect_create_attempt */); | 760 ExpectMountExCall(false /* expect_create_attempt */); |
759 | 761 |
760 auth_->AuthenticateToLogin(NULL, user_context_); | 762 auth_->AuthenticateToLogin(NULL, user_context_); |
761 base::RunLoop().Run(); | 763 base::RunLoop().Run(); |
762 } | 764 } |
763 | 765 |
764 TEST_F(CryptohomeAuthenticatorTest, FailLoginWithMissingSalt) { | 766 TEST_F(CryptohomeAuthenticatorTest, FailLoginWithMissingSalt) { |
765 CreateTransformedKey(Key::KEY_TYPE_SALTED_SHA256, kSalt); | 767 CreateTransformedKey(Key::KEY_TYPE_SALTED_SHA256, kSalt); |
766 | 768 |
767 FailOnLoginSuccess(); | 769 FailOnLoginSuccess(); |
768 ExpectLoginFailure(AuthFailure(AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME)); | 770 ExpectLoginFailure(AuthFailure(AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME)); |
769 | 771 |
770 // Set up mock homedir methods to respond with key metadata indicating that a | 772 // Set up mock homedir methods to respond with key metadata indicating that a |
771 // pre-hashed key was used to create the cryptohome but without the required | 773 // pre-hashed key was used to create the cryptohome but without the required |
772 // salt. | 774 // salt. |
773 ExpectGetKeyDataExCall( | 775 ExpectGetKeyDataExCall( |
774 make_scoped_ptr(new int64(Key::KEY_TYPE_SALTED_SHA256)), | 776 make_scoped_ptr(new int64_t(Key::KEY_TYPE_SALTED_SHA256)), |
775 scoped_ptr<std::string>()); | 777 scoped_ptr<std::string>()); |
776 | 778 |
777 auth_->AuthenticateToLogin(NULL, user_context_); | 779 auth_->AuthenticateToLogin(NULL, user_context_); |
778 base::RunLoop().Run(); | 780 base::RunLoop().Run(); |
779 } | 781 } |
780 | 782 |
781 } // namespace chromeos | 783 } // namespace chromeos |
OLD | NEW |