OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ |
6 #define CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 // default, GetSystemSalt() returns the value generated by | 207 // default, GetSystemSalt() returns the value generated by |
208 // GetStubSystemSalt(). | 208 // GetStubSystemSalt(). |
209 void set_system_salt(const std::vector<uint8_t>& system_salt) { | 209 void set_system_salt(const std::vector<uint8_t>& system_salt) { |
210 system_salt_ = system_salt; | 210 system_salt_ = system_salt; |
211 } | 211 } |
212 | 212 |
213 // Returns the stub system salt as raw bytes. (not as a string encoded in the | 213 // Returns the stub system salt as raw bytes. (not as a string encoded in the |
214 // format used by SystemSaltGetter::ConvertRawSaltToHexString()). | 214 // format used by SystemSaltGetter::ConvertRawSaltToHexString()). |
215 static std::vector<uint8_t> GetStubSystemSalt(); | 215 static std::vector<uint8_t> GetStubSystemSalt(); |
216 | 216 |
217 // Signature nonces are twenty bytes. This matches the attestation code. | |
218 static const std::string kTwentyBytesNonce; | |
219 // Something symbolic as a signature. | |
220 static const std::string kSignature; | |
Darren Krahn
2016/09/02 17:32:12
These constants can go in the cc file in an anonym
The one and only Dr. Crash
2016/09/03 01:17:37
Thanks for the pointer. And to think these were PO
| |
221 | |
217 private: | 222 private: |
218 void ReturnProtobufMethodCallback( | 223 void ReturnProtobufMethodCallback( |
219 const cryptohome::BaseReply& reply, | 224 const cryptohome::BaseReply& reply, |
220 const ProtobufMethodCallback& callback); | 225 const ProtobufMethodCallback& callback); |
221 | 226 |
222 // Posts tasks which return fake results to the UI thread. | 227 // Posts tasks which return fake results to the UI thread. |
223 void ReturnAsyncMethodResult(const AsyncMethodCallback& callback, | 228 void ReturnAsyncMethodResult(const AsyncMethodCallback& callback); |
224 bool returns_data); | |
225 | 229 |
226 // This method is used to implement ReturnAsyncMethodResult. | 230 // Posts tasks which return fake data to the UI thread. |
227 void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback, | 231 void ReturnAsyncMethodData(const AsyncMethodCallback& callback, |
228 bool returns_data); | 232 const std::string& data); |
233 | |
234 // This method is used to implement ReturnAsyncMethodResult without data. | |
235 void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback); | |
236 | |
237 // This method is used to implement ReturnAsyncMethodResult with data. | |
238 void ReturnAsyncMethodDataInternal(const AsyncMethodCallback& callback, | |
239 const std::string& data); | |
229 | 240 |
230 bool service_is_available_; | 241 bool service_is_available_; |
231 int async_call_id_; | 242 int async_call_id_; |
232 AsyncCallStatusHandler async_call_status_handler_; | 243 AsyncCallStatusHandler async_call_status_handler_; |
233 AsyncCallStatusWithDataHandler async_call_status_data_handler_; | 244 AsyncCallStatusWithDataHandler async_call_status_data_handler_; |
234 bool unmount_result_; | 245 bool unmount_result_; |
235 std::vector<uint8_t> system_salt_; | 246 std::vector<uint8_t> system_salt_; |
236 | 247 |
237 std::vector<WaitForServiceToBeAvailableCallback> | 248 std::vector<WaitForServiceToBeAvailableCallback> |
238 pending_wait_for_service_to_be_available_callbacks_; | 249 pending_wait_for_service_to_be_available_callbacks_; |
239 | 250 |
240 // A stub store for InstallAttributes, mapping an attribute name to the | 251 // A stub store for InstallAttributes, mapping an attribute name to the |
241 // associated data blob. Used to implement InstallAttributesSet and -Get. | 252 // associated data blob. Used to implement InstallAttributesSet and -Get. |
242 std::map<std::string, std::vector<uint8_t>> install_attrs_; | 253 std::map<std::string, std::vector<uint8_t>> install_attrs_; |
243 bool locked_; | 254 bool locked_; |
244 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; | 255 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; |
245 | 256 |
246 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); | 257 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); |
247 }; | 258 }; |
248 | 259 |
249 } // namespace chromeos | 260 } // namespace chromeos |
250 | 261 |
251 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ | 262 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ |
OLD | NEW |