-// Copyright (c) 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "crypto/unexportable_key.h"
#include "base/check.h"
+#include "base/functional/bind.h"
#include "build/build_config.h"
namespace crypto {
+namespace {
+std::unique_ptr<UnexportableKeyProvider> (*g_mock_provider)() = nullptr;
+} // namespace
+
UnexportableSigningKey::~UnexportableSigningKey() = default;
UnexportableKeyProvider::~UnexportableKeyProvider() = default;
-#if defined(OS_WIN)
+VirtualUnexportableSigningKey::~VirtualUnexportableSigningKey() = default;
+VirtualUnexportableKeyProvider::~VirtualUnexportableKeyProvider() = default;
+
+#if BUILDFLAG(IS_WIN)
std::unique_ptr<UnexportableKeyProvider> GetUnexportableKeyProviderWin();
+std::unique_ptr<VirtualUnexportableKeyProvider>
+GetVirtualUnexportableKeyProviderWin();
#endif
-static std::unique_ptr<UnexportableKeyProvider> (*g_mock_provider)() = nullptr;
+// Implemented in unexportable_key_software_unsecure.cc.
+std::unique_ptr<UnexportableKeyProvider>
+GetUnexportableKeyProviderSoftwareUnsecure();
std::unique_ptr<UnexportableKeyProvider> GetUnexportableKeyProvider() {
if (g_mock_provider) {
return g_mock_provider();
}
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
return GetUnexportableKeyProviderWin();
#else
return nullptr;
#endif
}
+std::unique_ptr<VirtualUnexportableKeyProvider>
+GetVirtualUnexportableKeyProvider_DO_NOT_USE_METRICS_ONLY() {
+#if BUILDFLAG(IS_WIN)
+ return GetVirtualUnexportableKeyProviderWin();
+#else
+ return nullptr;
+#endif
+}
+
namespace internal {
void SetUnexportableKeyProviderForTesting(