summaryrefslogtreecommitdiffstats
path: root/recipes-extended/xen/files/vtpm-locality.patch
diff options
context:
space:
mode:
authorKurt Bodiker <kurt.bodiker@braintrust-us.com>2018-05-01 10:05:33 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2018-05-01 23:17:29 -0400
commit230198a7d1f9d3cc7df986b4fbc4ab1cc4211640 (patch)
tree8576114fc3bebd740646afabfedaba55379aa3b9 /recipes-extended/xen/files/vtpm-locality.patch
parent299c5243ddcdbf6028e44e0fa3e3ff314d97cc38 (diff)
downloadmeta-virtualization-230198a7d1f9d3cc7df986b4fbc4ab1cc4211640.tar.gz
xen: TPM Emulator for Xen stubdoms
TPM Emulator is a software-based TPM and MTM emulator. This TPM Emulator recipe creates a static library that is cross-compiled against MiniOS, Xen, LWIP, Newlib, PolarSSL, and the stubdom-specific GMP headers and subsequently used during the cross-compilation and linking of the Xen vTPM and vTPM Manager stubdomains. The current Xen source code is hardcoded to fetch a specific version of this package. The patch files originate from the Xen/stubdom source tree. This recipe provides the flexibility to change version or modify the patches. Signed-off-by: Kurt Bodiker <kurt.bodiker@braintrust-us.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'recipes-extended/xen/files/vtpm-locality.patch')
-rw-r--r--recipes-extended/xen/files/vtpm-locality.patch50
1 files changed, 50 insertions, 0 deletions
diff --git a/recipes-extended/xen/files/vtpm-locality.patch b/recipes-extended/xen/files/vtpm-locality.patch
new file mode 100644
index 00000000..8ab7dea6
--- /dev/null
+++ b/recipes-extended/xen/files/vtpm-locality.patch
@@ -0,0 +1,50 @@
1diff --git a/tpm/tpm_capability.c b/tpm/tpm_capability.c
2index 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) {
14diff --git a/tpm/tpm_cmd_handler.c b/tpm/tpm_cmd_handler.c
15index 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) {
38diff --git a/tpm/tpm_emulator.h b/tpm/tpm_emulator.h
39index 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