summaryrefslogtreecommitdiffstats
path: root/chromeos/cryptohome
diff options
context:
space:
mode:
authordkrahn@google.com <dkrahn@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-27 06:43:50 +0000
committerdkrahn@google.com <dkrahn@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-27 06:43:50 +0000
commit1761fcc08c01fec1a792befa3da8b98ca04743df (patch)
tree552cad3b65b2ac269049e505455169f7894c72bd /chromeos/cryptohome
parentc44f743b751f0dc004d886656bf90ced68ec8df5 (diff)
downloadchromium_src-1761fcc08c01fec1a792befa3da8b98ca04743df.zip
chromium_src-1761fcc08c01fec1a792befa3da8b98ca04743df.tar.gz
chromium_src-1761fcc08c01fec1a792befa3da8b98ca04743df.tar.bz2
Updated attestation flow to conform with new DBUS interface.
The cryptohome DBUS interface has changed. This CL updates CryptohomeClient, AsyncMethodCaller and AttestationFlow accordingly. BUG=chromium-os:39830 TEST=chromeos_unittests Review URL: https://chromiumcodereview.appspot.com/12603012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190832 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/cryptohome')
-rw-r--r--chromeos/cryptohome/async_method_caller.cc29
-rw-r--r--chromeos/cryptohome/async_method_caller.h14
-rw-r--r--chromeos/cryptohome/mock_async_method_caller.cc4
-rw-r--r--chromeos/cryptohome/mock_async_method_caller.h7
4 files changed, 35 insertions, 19 deletions
diff --git a/chromeos/cryptohome/async_method_caller.cc b/chromeos/cryptohome/async_method_caller.cc
index 4de4f76..b2eb53f 100644
--- a/chromeos/cryptohome/async_method_caller.cc
+++ b/chromeos/cryptohome/async_method_caller.cc
@@ -110,25 +110,32 @@ class AsyncMethodCallerImpl : public AsyncMethodCaller {
}
virtual void AsyncTpmAttestationCreateCertRequest(
- bool is_cert_for_owner,
+ int options,
const DataCallback& callback) OVERRIDE {
DBusThreadManager::Get()->GetCryptohomeClient()->
- AsyncTpmAttestationCreateCertRequest(is_cert_for_owner, base::Bind(
- &AsyncMethodCallerImpl::RegisterAsyncDataCallback,
- weak_ptr_factory_.GetWeakPtr(),
- callback,
- "Couldn't initiate async attestation cert request."));
+ AsyncTpmAttestationCreateCertRequest(
+ options,
+ base::Bind(&AsyncMethodCallerImpl::RegisterAsyncDataCallback,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback,
+ "Couldn't initiate async attestation cert request."));
}
virtual void AsyncTpmAttestationFinishCertRequest(
const std::string& pca_response,
+ chromeos::CryptohomeClient::AttestationKeyType key_type,
+ const std::string& key_name,
const DataCallback& callback) OVERRIDE {
DBusThreadManager::Get()->GetCryptohomeClient()->
- AsyncTpmAttestationFinishCertRequest(pca_response, base::Bind(
- &AsyncMethodCallerImpl::RegisterAsyncDataCallback,
- weak_ptr_factory_.GetWeakPtr(),
- callback,
- "Couldn't initiate async attestation finish cert request."));
+ AsyncTpmAttestationFinishCertRequest(
+ pca_response,
+ key_type,
+ key_name,
+ base::Bind(
+ &AsyncMethodCallerImpl::RegisterAsyncDataCallback,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback,
+ "Couldn't initiate async attestation finish cert request."));
}
virtual void AsyncGetSanitizedUsername(
diff --git a/chromeos/cryptohome/async_method_caller.h b/chromeos/cryptohome/async_method_caller.h
index 78ff687..48eca5c 100644
--- a/chromeos/cryptohome/async_method_caller.h
+++ b/chromeos/cryptohome/async_method_caller.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/callback_forward.h"
#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/cryptohome_client.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace cryptohome {
@@ -96,18 +97,23 @@ class CHROMEOS_EXPORT AsyncMethodCaller {
const Callback& callback) = 0;
// Asks cryptohomed to asynchronously create an attestation certificate
- // request. On success the data sent to |callback| is a request to be sent
- // to the Privacy CA.
+ // request according to |options|, which is a combination of
+ // CryptohomeClient::AttestationCertificateOptions. On success the data sent
+ // to |callback| is a request to be sent to the Privacy CA.
virtual void AsyncTpmAttestationCreateCertRequest(
- bool is_cert_for_owner,
+ int options,
const DataCallback& callback) = 0;
// Asks cryptohomed to asynchronously finish an attestation certificate
// request. On success the data sent to |callback| is a certificate chain
// in PEM format. |pca_response| is the response to the certificate request
- // emitted by the Privacy CA.
+ // emitted by the Privacy CA. |key_type| determines whether the certified key
+ // is to be associated with the current user. |key_name| is a name for the
+ // key.
virtual void AsyncTpmAttestationFinishCertRequest(
const std::string& pca_response,
+ chromeos::CryptohomeClient::AttestationKeyType key_type,
+ const std::string& key_name,
const DataCallback& callback) = 0;
// Asks cryptohome to asynchronously retrieve a string associated with given
diff --git a/chromeos/cryptohome/mock_async_method_caller.cc b/chromeos/cryptohome/mock_async_method_caller.cc
index e17da7f..bf65376 100644
--- a/chromeos/cryptohome/mock_async_method_caller.cc
+++ b/chromeos/cryptohome/mock_async_method_caller.cc
@@ -50,9 +50,9 @@ void MockAsyncMethodCaller::SetUp(bool success, MountError return_code) {
.WillByDefault(
WithArgs<1>(Invoke(this,
&MockAsyncMethodCaller::FakeCreateCertRequest)));
- ON_CALL(*this, AsyncTpmAttestationFinishCertRequest(_, _))
+ ON_CALL(*this, AsyncTpmAttestationFinishCertRequest(_, _, _, _))
.WillByDefault(
- WithArgs<1>(Invoke(this,
+ WithArgs<3>(Invoke(this,
&MockAsyncMethodCaller::FakeFinishCertRequest)));
ON_CALL(*this, AsyncGetSanitizedUsername(_, _))
.WillByDefault(
diff --git a/chromeos/cryptohome/mock_async_method_caller.h b/chromeos/cryptohome/mock_async_method_caller.h
index 62df8e4..b7f8e41 100644
--- a/chromeos/cryptohome/mock_async_method_caller.h
+++ b/chromeos/cryptohome/mock_async_method_caller.h
@@ -45,9 +45,12 @@ class MockAsyncMethodCaller : public AsyncMethodCaller {
MOCK_METHOD2(AsyncTpmAttestationEnroll,
void(const std::string& pca_response, const Callback& callback));
MOCK_METHOD2(AsyncTpmAttestationCreateCertRequest,
- void(bool is_cert_for_owner, const DataCallback& callback));
- MOCK_METHOD2(AsyncTpmAttestationFinishCertRequest,
+ void(int options,
+ const DataCallback& callback));
+ MOCK_METHOD4(AsyncTpmAttestationFinishCertRequest,
void(const std::string& pca_response,
+ chromeos::CryptohomeClient::AttestationKeyType key_type,
+ const std::string& key_name,
const DataCallback& callback));
MOCK_METHOD2(AsyncGetSanitizedUsername,
void(const std::string& user,