On 07/28/2016 12:38 PM, Kevin O'Connor wrote:
On Tue, Jul 26, 2016 at 11:19:48AM -0400, Stefan Berger wrote:
Implement tpm20_get_capability and retrieve the PCR Bank configuration from the TPM using this function.
[...]
--- a/src/tcgbios.c +++ b/src/tcgbios.c @@ -24,6 +24,7 @@ #include "tcgbios.h"// tpm_*, prototypes #include "util.h" // printf, get_keystroke #include "stacks.h" // wait_threads, reset +#include "malloc.h" // malloc_high
/****************************************************************
- TPM 1.2 commands
@@ -76,6 +77,9 @@ static int TPM_has_physical_presence;
static TPMVersion TPM_version;
+static u32 tpm20_pcr_selection_size; +static struct tpml_pcr_selection *tpm20_pcr_selection;
- static struct tcpa_descriptor_rev2 * find_tcpa_by_rsdp(struct rsdp_descriptor *rsdp) {
@@ -181,6 +185,57 @@ tpm_log_event(struct tcg_pcr_event2_sha1 *entry, const void *event return 0; }
+static int +tpm20_getcapability(u32 capability, u32 property, u32 count,
struct tpm_rsp_header *rsp, u32 rsize)
The tcgbios.c file is getting pretty large - 2200 lines after this series. This patch adds tpm20_getcapability() in the section of the file currently labeled "ACPI TCPA table interface", but it seems very similar to tpm12_getcapability() and to other wrappers around tpmhw_transmit() that are located elsewhere in the C file.
I think it would help if the code could be segmented into like functionality, or split into multiple C files of like functionality if necessary.
I can try to move this function elsewhere and add a function prototype if necessary.
Regarding the split up. We could externalize the ACPI and log stuff into their own files. The rest has API functions, functions that are called internally, and then TPM 1.2 and TPM 2 functions. I am not sure how to split this up.
Stefan
-Kevin