blob: 7fc5f49920f9c2961f42e1138524a94bf44e6189 [file] [log] [blame]
// Copyright 2019 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.
#include <memory>
#include <string>
#include <brillo/syslog_logging.h>
#include "tpm_softclear_utils/tpm.h"
int main(int argc, char* argv[]) {
// All logs go to the system log file.
int flags = brillo::kLogToSyslog;
std::unique_ptr<tpm_softclear_utils::Tpm> tpm(
if (!tpm->Initialize()) {
LOG(ERROR) << "Failed to initialize for soft-clearing TPM.";
return -1;
base::Optional<std::string> auth_value = tpm->GetAuthForOwnerReset();
if (!auth_value) {
LOG(ERROR) << "Unable to soft-clear the TPM: failed to get the auth value.";
return -1;
if (!tpm->SoftClearOwner(*auth_value)) {
LOG(ERROR) << "Unable to soft-clear the TPM.";
return -1;
LOG(INFO) << "TPM is soft-cleared.";
return 0;