summaryrefslogtreecommitdiffstats
path: root/src/disabled_interface.c
blob: 5a4c91a14e3b0f42625260c1ffc6d5ec178c4ff5 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include <stddef.h>
#include "tpm_error.h"
#include "tpm_library_intern.h"

static TPM_RESULT Disabled_MainInit(void)
{
    return TPM_FAIL;
}

static void Disabled_Terminate(void)
{
}

static TPM_RESULT Disabled_Process(unsigned char **respbuffer, uint32_t *resp_size,
                               uint32_t *respbufsize,
                               unsigned char *command, uint32_t command_size)
{
    return TPM_FAIL;
}

static TPM_RESULT Disabled_VolatileAllStore(unsigned char **buffer,
                                        uint32_t *buflen)
{
    return TPM_FAIL;
}

static TPM_RESULT Disabled_CancelCommand(void)
{
    return TPM_FAIL;
}

static TPM_RESULT Disabled_GetTPMProperty(enum TPMLIB_TPMProperty prop,
                                      int *result)
{
    return TPM_FAIL;
}

static char *Disabled_GetInfo(enum TPMLIB_InfoFlags flags)
{
    return NULL;
}

static uint32_t Disabled_SetBufferSize(uint32_t wanted_size,
                                   uint32_t *min_size,
                                   uint32_t *max_size)
{
    return 0;
}

static TPM_RESULT Disabled_ValidateState(enum TPMLIB_StateType st,
                                     unsigned int flags)
{
    return TPM_FAIL;
}

static TPM_RESULT Disabled_GetState(enum TPMLIB_StateType st,
                                unsigned char **buffer, uint32_t *buflen)
{
    return TPM_FAIL;
}

static TPM_RESULT Disabled_SetState(enum TPMLIB_StateType st,
                                const unsigned char *buffer, uint32_t buflen)
{
    return TPM_FAIL;
}

static TPM_RESULT Disabled_IO_Hash_Start(void)
{
    return TPM_FAIL;
}

static TPM_RESULT Disabled_IO_Hash_Data(const unsigned char *data,
                                        uint32_t data_length)
{
    return TPM_FAIL;
}

static TPM_RESULT Disabled_IO_Hash_End(void)
{
    return TPM_FAIL;
}

static TPM_RESULT Disabled_IO_TpmEstablished_Get(TPM_BOOL *tpmEstablished)
{
    return TPM_FAIL;
}

static TPM_RESULT Disabled_IO_TpmEstablished_Reset(void)
{
    return TPM_FAIL;
}

const struct tpm_interface DisabledInterface = {
    .MainInit = Disabled_MainInit,
    .Terminate = Disabled_Terminate,
    .Process = Disabled_Process,
    .VolatileAllStore = Disabled_VolatileAllStore,
    .CancelCommand = Disabled_CancelCommand,
    .GetTPMProperty = Disabled_GetTPMProperty,
    .GetInfo = Disabled_GetInfo,
    .TpmEstablishedGet = Disabled_IO_TpmEstablished_Get,
    .TpmEstablishedReset = Disabled_IO_TpmEstablished_Reset,
    .HashStart = Disabled_IO_Hash_Start,
    .HashData = Disabled_IO_Hash_Data,
    .HashEnd = Disabled_IO_Hash_End,
    .SetBufferSize = Disabled_SetBufferSize,
    .ValidateState = Disabled_ValidateState,
    .SetState = Disabled_SetState,
    .GetState = Disabled_GetState,
};