Commit 29da663a authored by Leo Lai's avatar Leo Lai Committed by Commit Bot

remove TpmAttestationRegisterKey APIs

Now we are using AttestationClient directly instead of passing through
CryptohomeClient.

BUG=b:158955123
TEST=build ok.

Change-Id: I02646e7e9b7428a5f9ad41a07e80ef00ca5ef2e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505394
Commit-Queue: Leo Lai <cylai@google.com>
Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823187}
parent f08dbd56
...@@ -82,19 +82,6 @@ class AsyncMethodCallerImpl : public AsyncMethodCaller, ...@@ -82,19 +82,6 @@ class AsyncMethodCallerImpl : public AsyncMethodCaller,
"Couldn't initiate async attestation finish cert request.")); "Couldn't initiate async attestation finish cert request."));
} }
void TpmAttestationRegisterKey(
chromeos::attestation::AttestationKeyType key_type,
const Identification& cryptohome_id,
const std::string& key_name,
Callback callback) override {
CryptohomeClient::Get()->TpmAttestationRegisterKey(
key_type, CreateAccountIdentifierFromIdentification(cryptohome_id),
key_name,
base::BindOnce(&AsyncMethodCallerImpl::RegisterAsyncCallback,
weak_ptr_factory_.GetWeakPtr(), std::move(callback),
"Couldn't initiate async attestation register key."));
}
void TpmAttestationSignEnterpriseChallenge( void TpmAttestationSignEnterpriseChallenge(
chromeos::attestation::AttestationKeyType key_type, chromeos::attestation::AttestationKeyType key_type,
const Identification& cryptohome_id, const Identification& cryptohome_id,
......
...@@ -78,16 +78,6 @@ class COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) AsyncMethodCaller { ...@@ -78,16 +78,6 @@ class COMPONENT_EXPORT(CHROMEOS_CRYPTOHOME) AsyncMethodCaller {
const std::string& key_name, const std::string& key_name,
DataCallback callback) = 0; DataCallback callback) = 0;
// Asks cryptohomed to asynchronously register the attestation key specified
// by |key_type| and |key_name|. If |key_type| is KEY_USER, a |user_id| must
// be provided. Otherwise |user_id| is ignored. For normal GAIA users the
// |user_id| is an AccountId-derived string (see AccountId::GetAccountIdKey).
virtual void TpmAttestationRegisterKey(
chromeos::attestation::AttestationKeyType key_type,
const Identification& user_id,
const std::string& key_name,
Callback callback) = 0;
// Asks cryptohomed to asynchronously sign an enterprise challenge with the // Asks cryptohomed to asynchronously sign an enterprise challenge with the
// key specified by |key_type| and |key_name|. The |domain| and |device_id| // key specified by |key_type| and |key_name|. The |domain| and |device_id|
// parameters will be included in the challenge response. |challenge| must be // parameters will be included in the challenge response. |challenge| must be
......
...@@ -45,9 +45,6 @@ void MockAsyncMethodCaller::SetUp(bool success, MountError return_code) { ...@@ -45,9 +45,6 @@ void MockAsyncMethodCaller::SetUp(bool success, MountError return_code) {
TpmAttestationSignEnterpriseChallenge(_, _, _, _, _, _, _, _, _)) TpmAttestationSignEnterpriseChallenge(_, _, _, _, _, _, _, _, _))
.WillByDefault(WithArgs<8>( .WillByDefault(WithArgs<8>(
Invoke(this, &MockAsyncMethodCaller::FakeEnterpriseChallenge))); Invoke(this, &MockAsyncMethodCaller::FakeEnterpriseChallenge)));
ON_CALL(*this, TpmAttestationRegisterKey(_, _, _, _))
.WillByDefault(
WithArgs<3>(Invoke(this, &MockAsyncMethodCaller::DoCallback)));
} }
void MockAsyncMethodCaller::DoCallback(Callback callback) { void MockAsyncMethodCaller::DoCallback(Callback callback) {
......
...@@ -48,11 +48,6 @@ class MockAsyncMethodCaller : public AsyncMethodCaller { ...@@ -48,11 +48,6 @@ class MockAsyncMethodCaller : public AsyncMethodCaller {
const Identification& user_id, const Identification& user_id,
const std::string& key_name, const std::string& key_name,
DataCallback callback)); DataCallback callback));
MOCK_METHOD4(TpmAttestationRegisterKey,
void(chromeos::attestation::AttestationKeyType key_type,
const Identification& user_id,
const std::string& key_name,
Callback callback));
MOCK_METHOD9(TpmAttestationSignEnterpriseChallenge, MOCK_METHOD9(TpmAttestationSignEnterpriseChallenge,
void(chromeos::attestation::AttestationKeyType key_type, void(chromeos::attestation::AttestationKeyType key_type,
const Identification& user_id, const Identification& user_id,
......
...@@ -615,25 +615,6 @@ class CryptohomeClientImpl : public CryptohomeClient { ...@@ -615,25 +615,6 @@ class CryptohomeClientImpl : public CryptohomeClient {
weak_ptr_factory_.GetWeakPtr(), std::move(callback))); weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
} }
// CryptohomeClient override.
void TpmAttestationRegisterKey(attestation::AttestationKeyType key_type,
const cryptohome::AccountIdentifier& id,
const std::string& key_name,
AsyncMethodCallback callback) override {
dbus::MethodCall method_call(
cryptohome::kCryptohomeInterface,
cryptohome::kCryptohomeTpmAttestationRegisterKey);
dbus::MessageWriter writer(&method_call);
bool is_user_specific = (key_type == attestation::KEY_USER);
writer.AppendBool(is_user_specific);
writer.AppendString(id.account_id());
writer.AppendString(key_name);
proxy_->CallMethod(
&method_call, kTpmDBusTimeoutMs,
base::BindOnce(&CryptohomeClientImpl::OnAsyncMethodCall,
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
}
// CryptohomeClient override. // CryptohomeClient override.
void TpmAttestationSignEnterpriseChallenge( void TpmAttestationSignEnterpriseChallenge(
attestation::AttestationKeyType key_type, attestation::AttestationKeyType key_type,
......
...@@ -398,18 +398,6 @@ class COMPONENT_EXPORT(CRYPTOHOME_CLIENT) CryptohomeClient { ...@@ -398,18 +398,6 @@ class COMPONENT_EXPORT(CRYPTOHOME_CLIENT) CryptohomeClient {
const std::string& key_name, const std::string& key_name,
DBusMethodCallback<TpmAttestationDataResult> callback) = 0; DBusMethodCallback<TpmAttestationDataResult> callback) = 0;
// Asynchronously registers an attestation key with the current user's
// PKCS #11 token. The |callback| will be called when the dbus call
// completes. When the operation completes, the AsyncCallStatusHandler signal
// handler is called. |key_type| and |key_name| specify the key to register.
// If |key_type| is KEY_USER, a |id| must be provided. Otherwise |id| is
// ignored.
virtual void TpmAttestationRegisterKey(
attestation::AttestationKeyType key_type,
const cryptohome::AccountIdentifier& id,
const std::string& key_name,
AsyncMethodCallback callback) = 0;
// Asynchronously signs an enterprise challenge with the key specified by // Asynchronously signs an enterprise challenge with the key specified by
// |key_type| and |key_name|. |domain| and |device_id| will be included in // |key_type| and |key_name|. |domain| and |device_id| will be included in
// the challenge response. |options| control how the challenge response is // the challenge response. |options| control how the challenge response is
......
...@@ -425,14 +425,6 @@ void FakeCryptohomeClient::TpmAttestationGetPublicKey( ...@@ -425,14 +425,6 @@ void FakeCryptohomeClient::TpmAttestationGetPublicKey(
base::BindOnce(std::move(callback), tpm_attestation_public_key_)); base::BindOnce(std::move(callback), tpm_attestation_public_key_));
} }
void FakeCryptohomeClient::TpmAttestationRegisterKey(
attestation::AttestationKeyType key_type,
const cryptohome::AccountIdentifier& cryptohome_id,
const std::string& key_name,
AsyncMethodCallback callback) {
ReturnAsyncMethodResult(std::move(callback));
}
void FakeCryptohomeClient::TpmAttestationSignEnterpriseChallenge( void FakeCryptohomeClient::TpmAttestationSignEnterpriseChallenge(
attestation::AttestationKeyType key_type, attestation::AttestationKeyType key_type,
const cryptohome::AccountIdentifier& cryptohome_id, const cryptohome::AccountIdentifier& cryptohome_id,
......
...@@ -132,11 +132,6 @@ class COMPONENT_EXPORT(CRYPTOHOME_CLIENT) FakeCryptohomeClient ...@@ -132,11 +132,6 @@ class COMPONENT_EXPORT(CRYPTOHOME_CLIENT) FakeCryptohomeClient
const cryptohome::AccountIdentifier& cryptohome_id, const cryptohome::AccountIdentifier& cryptohome_id,
const std::string& key_name, const std::string& key_name,
DBusMethodCallback<TpmAttestationDataResult> callback) override; DBusMethodCallback<TpmAttestationDataResult> callback) override;
void TpmAttestationRegisterKey(
attestation::AttestationKeyType key_type,
const cryptohome::AccountIdentifier& cryptohome_id,
const std::string& key_name,
AsyncMethodCallback callback) override;
void TpmAttestationSignEnterpriseChallenge( void TpmAttestationSignEnterpriseChallenge(
attestation::AttestationKeyType key_type, attestation::AttestationKeyType key_type,
const cryptohome::AccountIdentifier& cryptohome_id, const cryptohome::AccountIdentifier& cryptohome_id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment