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 "chromeos/cryptohome/cryptohome_parameters.h" | 5 #include "chromeos/cryptohome/cryptohome_parameters.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "chromeos/dbus/cryptohome/key.pb.h" | 10 #include "chromeos/dbus/cryptohome/key.pb.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 bool encrypt, | 105 bool encrypt, |
106 bool sign, | 106 bool sign, |
107 const std::string& symmetric_key) : type(TYPE_HMACSHA256) { | 107 const std::string& symmetric_key) : type(TYPE_HMACSHA256) { |
108 secrets.push_back(Secret(encrypt, | 108 secrets.push_back(Secret(encrypt, |
109 sign, | 109 sign, |
110 symmetric_key, | 110 symmetric_key, |
111 std::string() /* public_key */, | 111 std::string() /* public_key */, |
112 false /* wrapped */)); | 112 false /* wrapped */)); |
113 } | 113 } |
114 | 114 |
| 115 KeyDefinition::AuthorizationData::AuthorizationData( |
| 116 const AuthorizationData& other) = default; |
115 | 117 |
116 KeyDefinition::AuthorizationData::~AuthorizationData() { | 118 KeyDefinition::AuthorizationData::~AuthorizationData() { |
117 } | 119 } |
118 | 120 |
119 bool KeyDefinition::AuthorizationData::operator==( | 121 bool KeyDefinition::AuthorizationData::operator==( |
120 const AuthorizationData& other) const { | 122 const AuthorizationData& other) const { |
121 if (type != other.type || secrets.size() != other.secrets.size()) | 123 if (type != other.type || secrets.size() != other.secrets.size()) |
122 return false; | 124 return false; |
123 for (size_t i = 0; i < secrets.size(); ++i) { | 125 for (size_t i = 0; i < secrets.size(); ++i) { |
124 if (!(secrets[i] == other.secrets[i])) | 126 if (!(secrets[i] == other.secrets[i])) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 KeyDefinition::KeyDefinition(const std::string& secret, | 183 KeyDefinition::KeyDefinition(const std::string& secret, |
182 const std::string& label, | 184 const std::string& label, |
183 int /*AuthKeyPrivileges*/ privileges) | 185 int /*AuthKeyPrivileges*/ privileges) |
184 : type(TYPE_PASSWORD), | 186 : type(TYPE_PASSWORD), |
185 label(label), | 187 label(label), |
186 privileges(privileges), | 188 privileges(privileges), |
187 revision(0), | 189 revision(0), |
188 secret(secret) { | 190 secret(secret) { |
189 } | 191 } |
190 | 192 |
| 193 KeyDefinition::KeyDefinition(const KeyDefinition& other) = default; |
| 194 |
191 KeyDefinition::~KeyDefinition() { | 195 KeyDefinition::~KeyDefinition() { |
192 } | 196 } |
193 | 197 |
194 bool KeyDefinition::operator==(const KeyDefinition& other) const { | 198 bool KeyDefinition::operator==(const KeyDefinition& other) const { |
195 if (type != other.type || | 199 if (type != other.type || |
196 label != other.label || | 200 label != other.label || |
197 privileges != other.privileges || | 201 privileges != other.privileges || |
198 revision != other.revision || | 202 revision != other.revision || |
199 authorization_data.size() != other.authorization_data.size() || | 203 authorization_data.size() != other.authorization_data.size() || |
200 provider_data.size() != other.provider_data.size()) { | 204 provider_data.size() != other.provider_data.size()) { |
(...skipping 21 matching lines...) Expand all Loading... |
222 label(key_def.label) { | 226 label(key_def.label) { |
223 } | 227 } |
224 | 228 |
225 bool Authorization::operator==(const Authorization& other) const { | 229 bool Authorization::operator==(const Authorization& other) const { |
226 return key == other.key && label == other.label; | 230 return key == other.key && label == other.label; |
227 } | 231 } |
228 | 232 |
229 MountParameters::MountParameters(bool ephemeral) : ephemeral(ephemeral) { | 233 MountParameters::MountParameters(bool ephemeral) : ephemeral(ephemeral) { |
230 } | 234 } |
231 | 235 |
| 236 MountParameters::MountParameters(const MountParameters& other) = default; |
| 237 |
232 bool MountParameters::operator==(const MountParameters& other) const { | 238 bool MountParameters::operator==(const MountParameters& other) const { |
233 return ephemeral == other.ephemeral && create_keys == other.create_keys; | 239 return ephemeral == other.ephemeral && create_keys == other.create_keys; |
234 } | 240 } |
235 | 241 |
236 MountParameters::~MountParameters() { | 242 MountParameters::~MountParameters() { |
237 } | 243 } |
238 | 244 |
239 bool GetGaiaIdMigrationStatus(const AccountId& account_id) { | 245 bool GetGaiaIdMigrationStatus(const AccountId& account_id) { |
240 return user_manager::known_user::GetGaiaIdMigrationStatus(account_id, | 246 return user_manager::known_user::GetGaiaIdMigrationStatus(account_id, |
241 kCryptohome); | 247 kCryptohome); |
242 } | 248 } |
243 | 249 |
244 void SetGaiaIdMigrationStatusDone(const AccountId& account_id) { | 250 void SetGaiaIdMigrationStatusDone(const AccountId& account_id) { |
245 user_manager::known_user::SetGaiaIdMigrationStatusDone(account_id, | 251 user_manager::known_user::SetGaiaIdMigrationStatusDone(account_id, |
246 kCryptohome); | 252 kCryptohome); |
247 } | 253 } |
248 | 254 |
249 } // namespace cryptohome | 255 } // namespace cryptohome |
250 | 256 |
251 namespace BASE_HASH_NAMESPACE { | 257 namespace BASE_HASH_NAMESPACE { |
252 | 258 |
253 std::size_t hash<cryptohome::Identification>::operator()( | 259 std::size_t hash<cryptohome::Identification>::operator()( |
254 const cryptohome::Identification& cryptohome_id) const { | 260 const cryptohome::Identification& cryptohome_id) const { |
255 return hash<std::string>()(cryptohome_id.id()); | 261 return hash<std::string>()(cryptohome_id.id()); |
256 } | 262 } |
257 | 263 |
258 } // namespace BASE_HASH_NAMESPACE | 264 } // namespace BASE_HASH_NAMESPACE |
OLD | NEW |