OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/async_method_caller.h" | 5 #include "chromeos/cryptohome/async_method_caller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 DBusThreadManager::Get()->GetCryptohomeClient()-> | 127 DBusThreadManager::Get()->GetCryptohomeClient()-> |
128 AsyncTpmAttestationEnroll(pca_response, base::Bind( | 128 AsyncTpmAttestationEnroll(pca_response, base::Bind( |
129 &AsyncMethodCallerImpl::RegisterAsyncCallback, | 129 &AsyncMethodCallerImpl::RegisterAsyncCallback, |
130 weak_ptr_factory_.GetWeakPtr(), | 130 weak_ptr_factory_.GetWeakPtr(), |
131 callback, | 131 callback, |
132 "Couldn't initiate async attestation enroll.")); | 132 "Couldn't initiate async attestation enroll.")); |
133 } | 133 } |
134 | 134 |
135 virtual void AsyncTpmAttestationCreateCertRequest( | 135 virtual void AsyncTpmAttestationCreateCertRequest( |
136 chromeos::attestation::AttestationCertificateProfile certificate_profile, | 136 chromeos::attestation::AttestationCertificateProfile certificate_profile, |
137 const std::string& username, | 137 const std::string& user_id, |
138 const std::string& request_origin, | 138 const std::string& request_origin, |
139 const DataCallback& callback) OVERRIDE { | 139 const DataCallback& callback) OVERRIDE { |
140 DBusThreadManager::Get()->GetCryptohomeClient()-> | 140 DBusThreadManager::Get()->GetCryptohomeClient()-> |
141 AsyncTpmAttestationCreateCertRequest( | 141 AsyncTpmAttestationCreateCertRequest( |
142 certificate_profile, | 142 certificate_profile, |
143 username, | 143 user_id, |
144 request_origin, | 144 request_origin, |
145 base::Bind(&AsyncMethodCallerImpl::RegisterAsyncDataCallback, | 145 base::Bind(&AsyncMethodCallerImpl::RegisterAsyncDataCallback, |
146 weak_ptr_factory_.GetWeakPtr(), | 146 weak_ptr_factory_.GetWeakPtr(), |
147 callback, | 147 callback, |
148 "Couldn't initiate async attestation cert request.")); | 148 "Couldn't initiate async attestation cert request.")); |
149 } | 149 } |
150 | 150 |
151 virtual void AsyncTpmAttestationFinishCertRequest( | 151 virtual void AsyncTpmAttestationFinishCertRequest( |
152 const std::string& pca_response, | 152 const std::string& pca_response, |
153 chromeos::attestation::AttestationKeyType key_type, | 153 chromeos::attestation::AttestationKeyType key_type, |
| 154 const std::string& user_id, |
154 const std::string& key_name, | 155 const std::string& key_name, |
155 const DataCallback& callback) OVERRIDE { | 156 const DataCallback& callback) OVERRIDE { |
156 DBusThreadManager::Get()->GetCryptohomeClient()-> | 157 DBusThreadManager::Get()->GetCryptohomeClient()-> |
157 AsyncTpmAttestationFinishCertRequest( | 158 AsyncTpmAttestationFinishCertRequest( |
158 pca_response, | 159 pca_response, |
159 key_type, | 160 key_type, |
| 161 user_id, |
160 key_name, | 162 key_name, |
161 base::Bind( | 163 base::Bind( |
162 &AsyncMethodCallerImpl::RegisterAsyncDataCallback, | 164 &AsyncMethodCallerImpl::RegisterAsyncDataCallback, |
163 weak_ptr_factory_.GetWeakPtr(), | 165 weak_ptr_factory_.GetWeakPtr(), |
164 callback, | 166 callback, |
165 "Couldn't initiate async attestation finish cert request.")); | 167 "Couldn't initiate async attestation finish cert request.")); |
166 } | 168 } |
167 | 169 |
168 virtual void TpmAttestationRegisterKey( | 170 virtual void TpmAttestationRegisterKey( |
169 chromeos::attestation::AttestationKeyType key_type, | 171 chromeos::attestation::AttestationKeyType key_type, |
| 172 const std::string& user_id, |
170 const std::string& key_name, | 173 const std::string& key_name, |
171 const Callback& callback) OVERRIDE { | 174 const Callback& callback) OVERRIDE { |
172 DBusThreadManager::Get()->GetCryptohomeClient()-> | 175 DBusThreadManager::Get()->GetCryptohomeClient()-> |
173 TpmAttestationRegisterKey( | 176 TpmAttestationRegisterKey( |
174 key_type, | 177 key_type, |
| 178 user_id, |
175 key_name, | 179 key_name, |
176 base::Bind( | 180 base::Bind( |
177 &AsyncMethodCallerImpl::RegisterAsyncCallback, | 181 &AsyncMethodCallerImpl::RegisterAsyncCallback, |
178 weak_ptr_factory_.GetWeakPtr(), | 182 weak_ptr_factory_.GetWeakPtr(), |
179 callback, | 183 callback, |
180 "Couldn't initiate async attestation register key.")); | 184 "Couldn't initiate async attestation register key.")); |
181 } | 185 } |
182 | 186 |
183 virtual void TpmAttestationSignEnterpriseChallenge( | 187 virtual void TpmAttestationSignEnterpriseChallenge( |
184 chromeos::attestation::AttestationKeyType key_type, | 188 chromeos::attestation::AttestationKeyType key_type, |
| 189 const std::string& user_id, |
185 const std::string& key_name, | 190 const std::string& key_name, |
186 const std::string& domain, | 191 const std::string& domain, |
187 const std::string& device_id, | 192 const std::string& device_id, |
188 chromeos::attestation::AttestationChallengeOptions options, | 193 chromeos::attestation::AttestationChallengeOptions options, |
189 const std::string& challenge, | 194 const std::string& challenge, |
190 const DataCallback& callback) OVERRIDE { | 195 const DataCallback& callback) OVERRIDE { |
191 DBusThreadManager::Get()->GetCryptohomeClient()-> | 196 DBusThreadManager::Get()->GetCryptohomeClient()-> |
192 TpmAttestationSignEnterpriseChallenge( | 197 TpmAttestationSignEnterpriseChallenge( |
193 key_type, | 198 key_type, |
| 199 user_id, |
194 key_name, | 200 key_name, |
195 domain, | 201 domain, |
196 device_id, | 202 device_id, |
197 options, | 203 options, |
198 challenge, | 204 challenge, |
199 base::Bind( | 205 base::Bind( |
200 &AsyncMethodCallerImpl::RegisterAsyncDataCallback, | 206 &AsyncMethodCallerImpl::RegisterAsyncDataCallback, |
201 weak_ptr_factory_.GetWeakPtr(), | 207 weak_ptr_factory_.GetWeakPtr(), |
202 callback, | 208 callback, |
203 "Couldn't initiate async attestation enterprise challenge.")); | 209 "Couldn't initiate async attestation enterprise challenge.")); |
204 } | 210 } |
205 | 211 |
206 virtual void TpmAttestationSignSimpleChallenge( | 212 virtual void TpmAttestationSignSimpleChallenge( |
207 chromeos::attestation::AttestationKeyType key_type, | 213 chromeos::attestation::AttestationKeyType key_type, |
| 214 const std::string& user_id, |
208 const std::string& key_name, | 215 const std::string& key_name, |
209 const std::string& challenge, | 216 const std::string& challenge, |
210 const DataCallback& callback) OVERRIDE { | 217 const DataCallback& callback) OVERRIDE { |
211 DBusThreadManager::Get()->GetCryptohomeClient()-> | 218 DBusThreadManager::Get()->GetCryptohomeClient()-> |
212 TpmAttestationSignSimpleChallenge( | 219 TpmAttestationSignSimpleChallenge( |
213 key_type, | 220 key_type, |
| 221 user_id, |
214 key_name, | 222 key_name, |
215 challenge, | 223 challenge, |
216 base::Bind( | 224 base::Bind( |
217 &AsyncMethodCallerImpl::RegisterAsyncDataCallback, | 225 &AsyncMethodCallerImpl::RegisterAsyncDataCallback, |
218 weak_ptr_factory_.GetWeakPtr(), | 226 weak_ptr_factory_.GetWeakPtr(), |
219 callback, | 227 callback, |
220 "Couldn't initiate async attestation simple challenge.")); | 228 "Couldn't initiate async attestation simple challenge.")); |
221 } | 229 } |
222 | 230 |
223 virtual void AsyncGetSanitizedUsername( | 231 virtual void AsyncGetSanitizedUsername( |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 g_async_method_caller = NULL; | 373 g_async_method_caller = NULL; |
366 VLOG(1) << "AsyncMethodCaller Shutdown completed"; | 374 VLOG(1) << "AsyncMethodCaller Shutdown completed"; |
367 } | 375 } |
368 | 376 |
369 // static | 377 // static |
370 AsyncMethodCaller* AsyncMethodCaller::GetInstance() { | 378 AsyncMethodCaller* AsyncMethodCaller::GetInstance() { |
371 return g_async_method_caller; | 379 return g_async_method_caller; |
372 } | 380 } |
373 | 381 |
374 } // namespace cryptohome | 382 } // namespace cryptohome |
OLD | NEW |