blob: 4b3a43caf676b7f2cbfbf442cbda7f83a766dfc1 [file] [log] [blame]
// Copyright 2016 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 "attestation/common/tpm_utility_factory.h"
#include <base/logging.h>
#include <libhwsec-foundation/tpm/tpm_version.h>
#include "attestation/common/tpm_utility.h"
#if USE_TPM2
#include "attestation/common/tpm_utility_v2.h"
#endif
#if USE_TPM1
#include "attestation/common/tpm_utility_v1.h"
#endif
namespace attestation {
TpmUtility* TpmUtilityFactory::New() {
TPM_SELECT_BEGIN;
TPM1_SECTION({ return new TpmUtilityV1(); });
TPM2_SECTION({ return new TpmUtilityV2(); });
OTHER_TPM_SECTION();
TPM_SELECT_END;
LOG(WARNING) << "Using unknown TPM";
return nullptr;
}
} // namespace attestation