Commit 3a15f3ea authored by Leo Lai's avatar Leo Lai Committed by Chromium LUCI CQ

Remove TpmGetVersion APIs.

We are deprecating tpm-related APIs by cryptohome.

BUG=b:172748724
TEST=build ok.

Change-Id: Ieda901dfcc6908e83e4e694ad77cfe83de8cae9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2569197Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Commit-Queue: Leo Lai <cylai@google.com>
Cr-Commit-Position: refs/heads/master@{#834220}
parent 2f93e6c1
......@@ -451,17 +451,6 @@ class CryptohomeClientImpl : public CryptohomeClient {
return CallBoolMethodAndBlock(&method_call, is_first_install);
}
// CryptohomeClient override.
void TpmGetVersion(DBusMethodCallback<TpmVersionInfo> callback) override {
dbus::MethodCall method_call(
cryptohome::kCryptohomeInterface,
cryptohome::kCryptohomeTpmGetVersionStructured);
proxy_->CallMethod(
&method_call, kTpmDBusTimeoutMs,
base::BindOnce(&CryptohomeClientImpl::OnTpmGetVersion,
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
}
void GetKeyDataEx(
const cryptohome::AccountIdentifier& id,
const cryptohome::AuthorizationRequest& auth,
......@@ -981,28 +970,6 @@ class CryptohomeClientImpl : public CryptohomeClient {
std::move(callback).Run(std::move(token_info));
}
// Handles responses for TpmGetVersion.
void OnTpmGetVersion(DBusMethodCallback<TpmVersionInfo> callback,
dbus::Response* response) {
if (!response) {
std::move(callback).Run(base::nullopt);
return;
}
dbus::MessageReader reader(response);
TpmVersionInfo version;
if (!reader.PopUint32(&version.family) ||
!reader.PopUint64(&version.spec_level) ||
!reader.PopUint32(&version.manufacturer) ||
!reader.PopUint32(&version.tpm_model) ||
!reader.PopUint64(&version.firmware_version) ||
!reader.PopString(&version.vendor_specific)) {
std::move(callback).Run(base::nullopt);
LOG(ERROR) << "Invalid response: " << response->ToString();
return;
}
std::move(callback).Run(std::move(version));
}
// Handles AsyncCallStatus signal.
void AsyncCallStatusReceived(dbus::Signal* signal) {
dbus::MessageReader reader(signal);
......
......@@ -120,17 +120,6 @@ class COMPONENT_EXPORT(CRYPTOHOME_CLIENT) CryptohomeClient {
int slot = -1;
};
// Holds TPM version info. Mirrors cryptohome::Tpm::TpmVersionInfo from CrOS
// side.
struct TpmVersionInfo {
uint32_t family = 0;
uint64_t spec_level = 0;
uint32_t manufacturer = 0;
uint32_t tpm_model = 0;
uint64_t firmware_version = 0;
std::string vendor_specific;
};
// Creates and initializes the global instance. |bus| must not be null.
static void Initialize(dbus::Bus* bus);
......@@ -306,10 +295,6 @@ class COMPONENT_EXPORT(CRYPTOHOME_CLIENT) CryptohomeClient {
// succeeds. This method blocks until the call returns.
virtual bool InstallAttributesIsFirstInstall(bool* is_first_install) = 0;
// Asynchronously gets the underlying TPM version information and passes it to
// the given callback.
virtual void TpmGetVersion(DBusMethodCallback<TpmVersionInfo> callback) = 0;
// Asynchronously calls the GetKeyDataEx method. |callback| will be invoked
// with the reply protobuf.
// GetKeyDataEx returns information about the key specified in |request|. At
......
......@@ -315,12 +315,6 @@ bool FakeCryptohomeClient::InstallAttributesIsFirstInstall(
return true;
}
void FakeCryptohomeClient::TpmGetVersion(
DBusMethodCallback<TpmVersionInfo> callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback), TpmVersionInfo()));
}
void FakeCryptohomeClient::GetKeyDataEx(
const cryptohome::AccountIdentifier& cryptohome_id,
const cryptohome::AuthorizationRequest& auth,
......
......@@ -96,7 +96,6 @@ class COMPONENT_EXPORT(CRYPTOHOME_CLIENT) FakeCryptohomeClient
void InstallAttributesIsReady(DBusMethodCallback<bool> callback) override;
bool InstallAttributesIsInvalid(bool* is_invalid) override;
bool InstallAttributesIsFirstInstall(bool* is_first_install) override;
void TpmGetVersion(DBusMethodCallback<TpmVersionInfo> callback) override;
void GetKeyDataEx(
const cryptohome::AccountIdentifier& cryptohome_id,
const cryptohome::AuthorizationRequest& auth,
......
......@@ -32,16 +32,6 @@ bool TpmIsBeingOwned() {
return result;
}
void GetTpmVersion(GetTpmVersionCallback callback) {
CryptohomeClient::Get()->TpmGetVersion(base::BindOnce(
[](GetTpmVersionCallback callback,
base::Optional<CryptohomeClient::TpmVersionInfo> tpm_version_info) {
std::move(callback).Run(
tpm_version_info.value_or(CryptohomeClient::TpmVersionInfo()));
},
std::move(callback)));
}
bool InstallAttributesGet(const std::string& name, std::string* value) {
std::vector<uint8_t> buf;
bool success = false;
......
......@@ -28,12 +28,6 @@ COMPONENT_EXPORT(CRYPTOHOME_CLIENT) bool TpmIsOwned();
// generating).
COMPONENT_EXPORT(CRYPTOHOME_CLIENT) bool TpmIsBeingOwned();
// Asynchronous. Provides the TPM version information in |callback|.
using GetTpmVersionCallback = base::OnceCallback<void(
const CryptohomeClient::TpmVersionInfo& tpm_version_info)>;
COMPONENT_EXPORT(CRYPTOHOME_CLIENT)
void GetTpmVersion(GetTpmVersionCallback callback);
// Blocking calls to CryptohomeClient methods.
COMPONENT_EXPORT(CRYPTOHOME_CLIENT)
bool InstallAttributesGet(const std::string& name, std::string* value);
......
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