blob: cbc3c88ef2a63d3511d3247099e213f173d869d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright 2015 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.
#ifndef TPM_MANAGER_SERVER_TPM_STATUS_IMPL_H_
#define TPM_MANAGER_SERVER_TPM_STATUS_IMPL_H_
#include "tpm_manager/server/tpm_status.h"
#include <memory>
#include <string>
#include <base/macros.h>
#include <trousers/tss.h>
#include <trousers/trousers.h> // NOLINT(build/include_alpha)
#include <tpm_manager/server/tpm_connection.h>
namespace tpm_manager {
class TpmStatusImpl : public TpmStatus {
public:
TpmStatusImpl() = default;
~TpmStatusImpl() override = default;
// TpmState methods.
bool IsTpmEnabled() override;
bool IsTpmOwned() override;
bool GetDictionaryAttackInfo(int* counter,
int* threshold,
bool* lockout,
int* seconds_remaining) override;
private:
// This method refreshes the |is_owned_| and |is_enabled_| status of the
// Tpm. It can be called multiple times.
void RefreshOwnedEnabledInfo();
// This method wraps calls to Tspi_TPM_GetCapability. |data| is set to
// the raw capability data. If the optional out argument |tpm_result| is
// provided, it is set to the result of the |Tspi_TPM_GetCapability| call.
bool GetCapability(uint32_t capability,
uint32_t sub_capability,
std::string* data,
TSS_RESULT* tpm_result);
TpmConnection tpm_connection_;
bool is_enabled_{false};
bool is_owned_{false};
bool is_enable_initialized_{false};
DISALLOW_COPY_AND_ASSIGN(TpmStatusImpl);
};
} // namespace tpm_manager
#endif // TPM_MANAGER_SERVER_TPM_STATUS_IMPL_H_
|