Debian Codegraph @

stubdom/vtpm-locality.patch

raw
1 diff --git a/tpm/tpm_capability.c b/tpm/tpm_capability.c
2 index 60bbb90..f8f7f0f 100644
3 --- a/tpm/tpm_capability.c
4 +++ b/tpm/tpm_capability.c
5 @@ -949,6 +949,8 @@ static TPM_RESULT set_vendor(UINT32 subCap, BYTE *setValue,
6 UINT32 setValueSize, BOOL ownerAuth,
7 BOOL deactivated, BOOL disabled)
8 {
9 + if (tpmData.stany.flags.localityModifier != 8)
10 + return TPM_BAD_PARAMETER;
11 /* set the capability area with the specified data, on failure
12 deactivate the TPM */
13 switch (subCap) {
14 diff --git a/tpm/tpm_cmd_handler.c b/tpm/tpm_cmd_handler.c
15 index 288d1ce..9e1cfb4 100644
16 --- a/tpm/tpm_cmd_handler.c
17 +++ b/tpm/tpm_cmd_handler.c
18 @@ -4132,7 +4132,7 @@ void tpm_emulator_shutdown()
19 tpm_extern_release();
20 }
21
22 -int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint32_t *out_size)
23 +int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint32_t *out_size, int locality)
24 {
25 TPM_REQUEST req;
26 TPM_RESPONSE rsp;
27 @@ -4140,7 +4140,9 @@ int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint3
28 UINT32 len;
29 BOOL free_out;
30
31 - debug("tpm_handle_command()");
32 + debug("tpm_handle_command(%d)", locality);
33 + if (locality != -1)
34 + tpmData.stany.flags.localityModifier = locality;
35
36 /* we need the whole packet at once, otherwise unmarshalling will fail */
37 if (tpm_unmarshal_TPM_REQUEST((uint8_t**)&in, &in_size, &req) != 0) {
38 diff --git a/tpm/tpm_emulator.h b/tpm/tpm_emulator.h
39 index eed749e..4c228bd 100644
40 --- a/tpm/tpm_emulator.h
41 +++ b/tpm/tpm_emulator.h
42 @@ -59,7 +59,7 @@ void tpm_emulator_shutdown(void);
43 * its usage. In case of an error, all internally allocated memory
44 * is released and the the state of out and out_size is unspecified.
45 */
46 -int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint32_t *out_size);
47 +int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint32_t *out_size, int locality);
48
49 #endif /* _TPM_EMULATOR_H_ */
50