cryptohome: cleanup pca and cryptome objects for cert provision.

BUG=b:173470557
TEST=build ok.

Change-Id: I66317b72597efc1c8b2786346de711ee5ec79108
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2543644
Tested-by: Leo Lai <cylai@google.com>
Commit-Queue: Leo Lai <cylai@google.com>
Reviewed-by: Yi Chou <yich@google.com>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
diff --git a/cryptohome/BUILD.gn b/cryptohome/BUILD.gn
index f4ed7f9..fcbc8b7 100644
--- a/cryptohome/BUILD.gn
+++ b/cryptohome/BUILD.gn
@@ -369,9 +369,7 @@
     configs += [ ":cert_provision-proto_config" ]
     sources = [
       "cert/cert_provision.cc",
-      "cert/cert_provision_cryptohome.cc",
       "cert/cert_provision_keystore.cc",
-      "cert/cert_provision_pca.cc",
       "cert/cert_provision_util.cc",
     ]
 
diff --git a/cryptohome/cert/cert_provision_cryptohome.cc b/cryptohome/cert/cert_provision_cryptohome.cc
deleted file mode 100644
index c59564b..0000000
--- a/cryptohome/cert/cert_provision_cryptohome.cc
+++ /dev/null
@@ -1,239 +0,0 @@
-// Copyright 2017 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// Cryptohome interface classes for cert_provision library.
-
-#include <chromeos/dbus/service_constants.h>
-
-#include "bindings/cryptohome.dbusclient.h"
-#include "cryptohome/cert/cert_provision_cryptohome.h"
-
-namespace {
-
-void SetSecureBlob(brillo::SecureBlob* blob, gchar* ptr, size_t len) {
-  uint8_t* data = reinterpret_cast<uint8_t*>(ptr);
-  brillo::SecureBlob tmp(data, data + len);
-  blob->swap(tmp);
-}
-
-}  // namespace
-
-namespace cert_provision {
-
-// Utility class to wait for the status of the TpmAttestationRegisterKey or
-// other similar requests, reported asynchronously by cryptohomed.
-class AsyncStatus {
- public:
-  explicit AsyncStatus(::DBusGProxy* gproxy);
-  AsyncStatus(const AsyncStatus&) = delete;
-  AsyncStatus& operator=(const AsyncStatus&) = delete;
-
-  // Waits for AsyncCallStatus with the given |async_id|. Returns the
-  // status reported in that AsyncCallStatus.
-  bool StatusWait(int async_id);
-
- private:
-  // Handles AsyncCallStatus signals.
-  static void Callback(::DBusGProxy* proxy,
-                       int async_id,
-                       bool status,
-                       int return_code,
-                       gpointer userdata);
-  void Process(int async_id, bool status);
-
-  GMainLoop* loop_ = nullptr;
-  int async_id_ = 0;
-  gboolean status_ = 0;
-  ::DBusGProxy* gproxy_;
-};
-
-CryptohomeProxy* CryptohomeProxy::subst_obj = nullptr;
-
-Scoped<CryptohomeProxy> CryptohomeProxy::Create() {
-  return subst_obj ? Scoped<CryptohomeProxy>(subst_obj)
-                   : Scoped<CryptohomeProxy>(GetDefault());
-}
-
-std::unique_ptr<CryptohomeProxy> CryptohomeProxy::GetDefault() {
-  return std::unique_ptr<CryptohomeProxy>(new CryptohomeProxyImpl());
-}
-
-CryptohomeProxyImpl::CryptohomeProxyImpl()
-    : bus_(brillo::dbus::GetSystemBusConnection()),
-      proxy_(bus_,
-             cryptohome::kCryptohomeServiceName,
-             cryptohome::kCryptohomeServicePath,
-             cryptohome::kCryptohomeInterface),
-      gproxy_(proxy_.gproxy()) {}
-
-OpResult CryptohomeProxyImpl::Init() {
-  if (!gproxy_) {
-    return {Status::DBusError, "Failed to acquire dbus proxy."};
-  }
-  dbus_g_proxy_set_default_timeout(gproxy_, kDefaultTimeoutMs);
-  return OpResult();
-}
-
-OpResult CryptohomeProxyImpl::CheckIfPrepared(bool* is_prepared) {
-  brillo::glib::ScopedError error;
-  gboolean result = FALSE;
-  if (!org_chromium_CryptohomeInterface_tpm_is_attestation_prepared(
-          gproxy_, &result, &brillo::Resetter(&error).lvalue())) {
-    return DBusError("TpmIsAttestationPrepared", error.get());
-  }
-  *is_prepared = result;
-  return OpResult();
-}
-
-OpResult CryptohomeProxyImpl::CheckIfEnrolled(bool* is_enrolled) {
-  brillo::glib::ScopedError error;
-  gboolean result = FALSE;
-  if (!org_chromium_CryptohomeInterface_tpm_is_attestation_enrolled(
-          gproxy_, &result, &brillo::Resetter(&error).lvalue())) {
-    return DBusError("TpmIsAttestationEnrolled", error.get());
-  }
-  *is_enrolled = result;
-  return OpResult();
-}
-
-OpResult CryptohomeProxyImpl::CreateEnrollRequest(PCAType pca_type,
-                                                  brillo::SecureBlob* request) {
-  brillo::glib::ScopedError error;
-  brillo::glib::ScopedArray data;
-
-  if (!org_chromium_CryptohomeInterface_tpm_attestation_create_enroll_request(
-          gproxy_, pca_type, &brillo::Resetter(&data).lvalue(),
-          &brillo::Resetter(&error).lvalue())) {
-    return DBusError("TpmAttestationCreateEnrollRequest", error.get());
-  }
-  SetSecureBlob(request, data->data, data->len);
-  return OpResult();
-}
-
-OpResult CryptohomeProxyImpl::ProcessEnrollResponse(
-    PCAType pca_type, const brillo::SecureBlob& response) {
-  brillo::glib::ScopedArray data(g_array_new(FALSE, FALSE, 1));
-  g_array_append_vals(data.get(), response.data(), response.size());
-  gboolean success = FALSE;
-  brillo::glib::ScopedError error;
-
-  if (!org_chromium_CryptohomeInterface_tpm_attestation_enroll(
-          gproxy_, pca_type, data.get(), &success,
-          &brillo::Resetter(&error).lvalue())) {
-    return DBusError("TpmAttestationEnroll", error.get());
-  }
-  return OpResult();
-}
-
-OpResult CryptohomeProxyImpl::CreateCertRequest(PCAType pca_type,
-                                                CertificateProfile cert_profile,
-                                                brillo::SecureBlob* request) {
-  brillo::glib::ScopedError error;
-  brillo::glib::ScopedArray data;
-
-  if (!org_chromium_CryptohomeInterface_tpm_attestation_create_cert_request(
-          gproxy_, pca_type, cert_profile, "" /* username */,
-          "" /* request_origin */, &brillo::Resetter(&data).lvalue(),
-          &brillo::Resetter(&error).lvalue())) {
-    return DBusError("TpmAttestationCreateCertRequest", error.get());
-  }
-  SetSecureBlob(request, data->data, data->len);
-  return OpResult();
-}
-
-OpResult CryptohomeProxyImpl::ProcessCertResponse(
-    const std::string& label,
-    const brillo::SecureBlob& response,
-    brillo::SecureBlob* cert) {
-  brillo::glib::ScopedArray data(g_array_new(FALSE, FALSE, 1));
-  g_array_append_vals(data.get(), response.data(), response.size());
-  gboolean success = FALSE;
-  brillo::glib::ScopedError error;
-  brillo::glib::ScopedArray cert_data;
-
-  if (!org_chromium_CryptohomeInterface_tpm_attestation_finish_cert_request(
-          gproxy_, data.get(), false /* is_user_specific */,
-          "" /* account_id */, label.c_str(),
-          &brillo::Resetter(&cert_data).lvalue(), &success,
-          &brillo::Resetter(&error).lvalue())) {
-    return DBusError("TpmAttestationFinishCertRequest", error.get());
-  }
-  if (!success) {
-    return {Status::CryptohomeError, "Attestation certificate request failed."};
-  }
-  if (cert) {
-    SetSecureBlob(cert, cert_data->data, cert_data->len);
-  }
-  return OpResult();
-}
-
-OpResult CryptohomeProxyImpl::GetPublicKey(const std::string& label,
-                                           brillo::SecureBlob* public_key) {
-  gboolean success = FALSE;
-  brillo::glib::ScopedError error;
-  brillo::glib::ScopedArray public_key_data;
-  if (!org_chromium_CryptohomeInterface_tpm_attestation_get_public_key(
-          gproxy_, false /* is_user_specific */, "" /* account_id */,
-          label.c_str(), &brillo::Resetter(&public_key_data).lvalue(), &success,
-          &brillo::Resetter(&error).lvalue())) {
-    return DBusError("TpmAttestationGetPublicKey", error.get());
-  }
-  if (!success) {
-    return {Status::CryptohomeError,
-            "Getting public key for the obtained certificate failed."};
-  }
-  SetSecureBlob(public_key, public_key_data->data, public_key_data->len);
-  return OpResult();
-}
-
-OpResult CryptohomeProxyImpl::Register(const std::string& label) {
-  AsyncStatus async_status(gproxy_);
-  gint async_id = -1;
-  brillo::glib::ScopedError error;
-  if (!org_chromium_CryptohomeInterface_tpm_attestation_register_key(
-          gproxy_, false /* is_user_specific */, "" /* username */,
-          label.c_str(), &async_id, &brillo::Resetter(&error).lvalue())) {
-    return DBusError("TpmAttestationRegisterKey", error.get());
-  }
-  // TODO(apronin): implement timeout waiting for the result.
-  if (!async_status.StatusWait(async_id)) {
-    return {Status::CryptohomeError, "Failed to register key."};
-  }
-
-  return OpResult();
-}
-
-AsyncStatus::AsyncStatus(::DBusGProxy* gproxy) : gproxy_(gproxy) {
-  dbus_g_object_register_marshaller(g_cclosure_marshal_generic, G_TYPE_NONE,
-                                    G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_INT,
-                                    G_TYPE_INVALID);
-  dbus_g_proxy_add_signal(gproxy_, "AsyncCallStatus", G_TYPE_INT,
-                          G_TYPE_BOOLEAN, G_TYPE_INT, G_TYPE_INVALID);
-  dbus_g_proxy_connect_signal(gproxy_, "AsyncCallStatus",
-                              G_CALLBACK(AsyncStatus::Callback), this, NULL);
-  loop_ = g_main_loop_new(NULL, TRUE);
-}
-
-void AsyncStatus::Process(int async_id, bool status) {
-  if (async_id == async_id_) {
-    status_ = status;
-    g_main_loop_quit(loop_);
-  }
-}
-
-void AsyncStatus::Callback(::DBusGProxy* /* proxy */,
-                           int async_id,
-                           bool status,
-                           int /* return_code */,
-                           gpointer userdata) {
-  reinterpret_cast<AsyncStatus*>(userdata)->Process(async_id, status);
-}
-
-bool AsyncStatus::StatusWait(int async_id) {
-  async_id_ = async_id;
-  g_main_loop_run(loop_);
-  return status_;
-}
-
-}  // namespace cert_provision
diff --git a/cryptohome/cert/cert_provision_cryptohome.h b/cryptohome/cert/cert_provision_cryptohome.h
deleted file mode 100644
index f5c1ece..0000000
--- a/cryptohome/cert/cert_provision_cryptohome.h
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2017 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// Cryptohome interface classes for cert_provision library.
-
-#ifndef CRYPTOHOME_CERT_CERT_PROVISION_CRYPTOHOME_H_
-#define CRYPTOHOME_CERT_CERT_PROVISION_CRYPTOHOME_H_
-
-#include <memory>
-#include <string>
-
-#include <brillo/glib/dbus.h>
-#include <brillo/secure_blob.h>
-
-#include "cryptohome/cert/cert_provision_util.h"
-#include "cryptohome/cert_provision.h"
-
-namespace cert_provision {
-
-// Proxy object for exchanging messages with cryptohomed over dbus.
-class CryptohomeProxy {
- public:
-  CryptohomeProxy() = default;
-
-  virtual ~CryptohomeProxy() {}
-
-  // Initializes the proxy.
-  // Returns operation result.
-  virtual OpResult Init() = 0;
-
-  // Sends TpmIsAttestationPrepared to check if the tpm is owned and
-  // enrollment is prepared.
-  // Returns operation result. If successful, sets |is_prepared|.
-  virtual OpResult CheckIfPrepared(bool* is_prepared) = 0;
-
-  // Sends TpmIsAttestationEnrolled to check if the device is enrolled.
-  // Returns operation result. If successful, sets |is_enrolled|.
-  virtual OpResult CheckIfEnrolled(bool* is_enrolled) = 0;
-
-  // Sends TpmAttestationCreateEnrollRequest to creates Enroll |request| for
-  // the PCA of type |pca_type|.
-  // Returns operation result.
-  virtual OpResult CreateEnrollRequest(PCAType pca_type,
-                                       brillo::SecureBlob* request) = 0;
-
-  // Sends TpmAttestationEnroll to process Enroll |response| received from
-  // the PCA of type |pca_type|.
-  // Returns operation result.
-  virtual OpResult ProcessEnrollResponse(
-      PCAType pca_type, const brillo::SecureBlob& response) = 0;
-
-  // Sends TpmAttestationCreateCertRequest to creates Sign |request| for the
-  // PCA of type |pca_type| and the certificate of profile |cert_profile|.
-  // Returns operation result.
-  virtual OpResult CreateCertRequest(PCAType pca_type,
-                                     CertificateProfile cert_profile,
-                                     brillo::SecureBlob* request) = 0;
-
-  // Sends TpmAttestationFinishCertRequest to process Sign |response| received
-  // from the PCA and uses |label| to store the received data.
-  // Returns operation result.
-  virtual OpResult ProcessCertResponse(const std::string& label,
-                                       const brillo::SecureBlob& response,
-                                       brillo::SecureBlob* cert) = 0;
-
-  // Sends TpmAttestationGetPublicKey to get the |public_key| for |label|.
-  // Returns operation result.
-  virtual OpResult GetPublicKey(const std::string& label,
-                                brillo::SecureBlob* public_key) = 0;
-
-  // Sends TpmAttestationRegisterKey to register the keypair from |label| in
-  // the keystore.
-  // Returns operation result.
-  virtual OpResult Register(const std::string& label) = 0;
-
-  // Returns a new scoped default CryptohomeProxy implementation unless
-  // subst_obj is set. In that case, returns subst_obj.
-  static Scoped<CryptohomeProxy> Create();
-  static CryptohomeProxy* subst_obj;
-
- private:
-  static std::unique_ptr<CryptohomeProxy> GetDefault();
-};
-
-class CryptohomeProxyImpl : public CryptohomeProxy {
- public:
-  CryptohomeProxyImpl();
-  CryptohomeProxyImpl(const CryptohomeProxyImpl&) = delete;
-  CryptohomeProxyImpl& operator=(const CryptohomeProxyImpl&) = delete;
-
-  OpResult Init() override;
-  OpResult CheckIfPrepared(bool* is_prepared) override;
-  OpResult CheckIfEnrolled(bool* is_enrolled) override;
-  OpResult CreateEnrollRequest(PCAType pca_type,
-                               brillo::SecureBlob* request) override;
-  OpResult ProcessEnrollResponse(PCAType pca_type,
-                                 const brillo::SecureBlob& response) override;
-  OpResult CreateCertRequest(PCAType pca_type,
-                             CertificateProfile cert_profile,
-                             brillo::SecureBlob* request) override;
-  OpResult ProcessCertResponse(const std::string& label,
-                               const brillo::SecureBlob& response,
-                               brillo::SecureBlob* cert) override;
-  OpResult GetPublicKey(const std::string& label,
-                        brillo::SecureBlob* public_key) override;
-  OpResult Register(const std::string& label) override;
-
- private:
-  // Default D-Bus timeout. Wait for up to 5 minutes - some operations are
-  // slow or can be stuck in the cryptohomed queue behind slow operations.
-  const int kDefaultTimeoutMs = 300000;
-
-  OpResult DBusError(std::string request, ::GError* error) {
-    return OpResult{Status::DBusError, request + " failed: " + error->message};
-  }
-
-  brillo::dbus::BusConnection bus_;
-  brillo::dbus::Proxy proxy_;
-  ::DBusGProxy* gproxy_;
-};
-
-}  // namespace cert_provision
-
-#endif  // CRYPTOHOME_CERT_CERT_PROVISION_CRYPTOHOME_H_
diff --git a/cryptohome/cert/cert_provision_keystore_unittest.cc b/cryptohome/cert/cert_provision_keystore_unittest.cc
index 62c42ec..8ec4d53 100644
--- a/cryptohome/cert/cert_provision_keystore_unittest.cc
+++ b/cryptohome/cert/cert_provision_keystore_unittest.cc
@@ -16,13 +16,9 @@
 #include <openssl/x509.h>
 
 #include "cert/cert_provision.pb.h"
-#include "cryptohome/cert/cert_provision_cryptohome.h"
 #include "cryptohome/cert/cert_provision_keystore.h"
-#include "cryptohome/cert/cert_provision_pca.h"
 #include "cryptohome/cert/cert_provision_util.h"
-#include "cryptohome/cert/mock_cert_provision_cryptohome.h"
 #include "cryptohome/cert/mock_cert_provision_keystore.h"
-#include "cryptohome/cert/mock_cert_provision_pca.h"
 #include "cryptohome/cert_provision.h"
 
 using ::brillo::SecureBlob;
diff --git a/cryptohome/cert/cert_provision_pca.cc b/cryptohome/cert/cert_provision_pca.cc
deleted file mode 100644
index 98e3a3f..0000000
--- a/cryptohome/cert/cert_provision_pca.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2017 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// Utility classes for cert_provision library.
-
-#include <brillo/mime_utils.h>
-
-#include "cryptohome/cert/cert_provision_pca.h"
-
-namespace cert_provision {
-
-PCAProxy* PCAProxy::subst_obj = nullptr;
-
-Scoped<PCAProxy> PCAProxy::Create(const std::string& pca_url) {
-  return subst_obj ? Scoped<PCAProxy>(subst_obj)
-                   : Scoped<PCAProxy>(GetDefault(pca_url));
-}
-
-std::unique_ptr<PCAProxy> PCAProxy::GetDefault(const std::string& pca_url) {
-  return std::unique_ptr<PCAProxy>(new PCAProxyImpl(pca_url));
-}
-
-PCAProxyImpl::PCAProxyImpl(const std::string& pca_url)
-    : PCAProxy(pca_url),
-      http_transport_(brillo::http::Transport::CreateDefault()) {}
-
-OpResult PCAProxyImpl::MakeRequest(const std::string& action,
-                                   const brillo::SecureBlob& request,
-                                   brillo::SecureBlob* reply) {
-  brillo::ErrorPtr error;
-  auto response = brillo::http::PostBinaryAndBlock(
-      pca_url_ + "/" + action, request.data(), request.size(),
-      brillo::mime::application::kOctet_stream, {},  // headers
-      http_transport_, &error);
-  if (!response) {
-    return {Status::HttpError, std::string("Sending PCA request failed: ") +
-                                   action + ": " + error->GetMessage()};
-  }
-  if (!response->IsSuccessful()) {
-    return {Status::ServerError, std::string("PCA server error: ") + action +
-                                     ": " + response->GetStatusText()};
-  }
-  auto response_data = response->ExtractData();
-  brillo::SecureBlob tmp(response_data.begin(), response_data.end());
-  reply->swap(tmp);
-  return OpResult();
-}
-
-}  // namespace cert_provision
diff --git a/cryptohome/cert/cert_provision_pca.h b/cryptohome/cert/cert_provision_pca.h
deleted file mode 100644
index 056dbbb..0000000
--- a/cryptohome/cert/cert_provision_pca.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2017 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// PCA interface classes for cert_provision library.
-
-#ifndef CRYPTOHOME_CERT_CERT_PROVISION_PCA_H_
-#define CRYPTOHOME_CERT_CERT_PROVISION_PCA_H_
-
-#include <memory>
-#include <string>
-
-#include <brillo/http/http_utils.h>
-#include <brillo/secure_blob.h>
-
-#include "cryptohome/cert/cert_provision_util.h"
-
-namespace cert_provision {
-
-// Proxy for exchanging messages with a PCA over network.
-class PCAProxy {
- public:
-  explicit PCAProxy(const std::string& pca_url) : pca_url_(pca_url) {}
-
-  virtual ~PCAProxy() {}
-
-  // Sends |request| to the PCA, waits for the |response|. |action| is appended
-  // to the PCA base url to form the url for the POST request.
-  virtual OpResult MakeRequest(const std::string& action,
-                               const brillo::SecureBlob& request,
-                               brillo::SecureBlob* reply) = 0;
-
-  // Returns a new scoped default PCAProxy implementation unless
-  // subst_obj is set. In that case, returns subst_obj.
-  static Scoped<PCAProxy> Create(const std::string& pca_url);
-  static PCAProxy* subst_obj;
-
- protected:
-  std::string pca_url_;
-
- private:
-  static std::unique_ptr<PCAProxy> GetDefault(const std::string& pca_url);
-};
-
-class PCAProxyImpl : public PCAProxy {
- public:
-  explicit PCAProxyImpl(const std::string& pca_url);
-  PCAProxyImpl(const PCAProxyImpl&) = delete;
-  PCAProxyImpl& operator=(const PCAProxyImpl&) = delete;
-
-  OpResult MakeRequest(const std::string& action,
-                       const brillo::SecureBlob& request,
-                       brillo::SecureBlob* reply) override;
-
- private:
-  std::shared_ptr<brillo::http::Transport> http_transport_;
-};
-
-}  // namespace cert_provision
-
-#endif  // CRYPTOHOME_CERT_CERT_PROVISION_PCA_H_
diff --git a/cryptohome/cert/mock_cert_provision_cryptohome.h b/cryptohome/cert/mock_cert_provision_cryptohome.h
deleted file mode 100644
index 02ab826..0000000
--- a/cryptohome/cert/mock_cert_provision_cryptohome.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2017 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// Mock for CryptohomeProxy.
-
-#ifndef CRYPTOHOME_CERT_MOCK_CERT_PROVISION_CRYPTOHOME_H_
-#define CRYPTOHOME_CERT_MOCK_CERT_PROVISION_CRYPTOHOME_H_
-
-#include <string>
-
-#include "cryptohome/cert/cert_provision_cryptohome.h"
-
-namespace cert_provision {
-
-class MockCryptohomeProxy : public CryptohomeProxy {
- public:
-  MockCryptohomeProxy() = default;
-  MOCK_METHOD(OpResult, Init, (), (override));
-  MOCK_METHOD(OpResult, CheckIfPrepared, (bool*), (override));
-  MOCK_METHOD(OpResult, CheckIfEnrolled, (bool*), (override));
-  MOCK_METHOD(OpResult,
-              CreateEnrollRequest,
-              (PCAType, brillo::SecureBlob*),
-              (override));
-  MOCK_METHOD(OpResult,
-              ProcessEnrollResponse,
-              (PCAType, const brillo::SecureBlob&),
-              (override));
-  MOCK_METHOD(OpResult,
-              CreateCertRequest,
-              (PCAType, CertificateProfile, brillo::SecureBlob*),
-              (override));
-  MOCK_METHOD(OpResult,
-              ProcessCertResponse,
-              (const std::string&,
-               const brillo::SecureBlob&,
-               brillo::SecureBlob*),
-              (override));
-  MOCK_METHOD(OpResult,
-              GetPublicKey,
-              (const std::string&, brillo::SecureBlob*),
-              (override));
-  MOCK_METHOD(OpResult, Register, (const std::string&), (override));
-};
-
-}  // namespace cert_provision
-
-#endif  // CRYPTOHOME_CERT_MOCK_CERT_PROVISION_CRYPTOHOME_H_
diff --git a/cryptohome/cert/mock_cert_provision_pca.h b/cryptohome/cert/mock_cert_provision_pca.h
deleted file mode 100644
index 23dd181..0000000
--- a/cryptohome/cert/mock_cert_provision_pca.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2017 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// Mock for PCAProxy.
-
-#ifndef CRYPTOHOME_CERT_MOCK_CERT_PROVISION_PCA_H_
-#define CRYPTOHOME_CERT_MOCK_CERT_PROVISION_PCA_H_
-
-#include <string>
-
-#include "cryptohome/cert/cert_provision_pca.h"
-
-namespace cert_provision {
-
-class MockPCAProxy : public PCAProxy {
- public:
-  MockPCAProxy() : PCAProxy("") {}
-  MOCK_METHOD(OpResult,
-              MakeRequest,
-              (const std::string&,
-               const brillo::SecureBlob&,
-               brillo::SecureBlob*),
-              (override));
-};
-
-}  // namespace cert_provision
-
-#endif  // CRYPTOHOME_CERT_MOCK_CERT_PROVISION_PCA_H_