Re: [SeaBIOS] [PATCH 0/7] Some TPM code reorganization

2015-11-22 Thread Stefan Berger
On 11/22/2015 08:26 PM, Kevin O'Connor wrote: On Sun, Nov 22, 2015 at 06:54:47PM -0500, Stefan Berger wrote: On 11/22/2015 12:20 PM, Kevin O'Connor wrote: Hi Stefan, As part of trying to better understand the TPM code, I found some changes to tcgbios.c were helpful. It's mostly code movement.

Re: [SeaBIOS] [PATCH 4/8] tpm: Use pcpes->event[] to pass data to tpm_extend_acpi_log()

2015-11-22 Thread Stefan Berger
On 11/22/2015 08:52 PM, Kevin O'Connor wrote: On Sun, Nov 22, 2015 at 08:31:43PM -0500, Stefan Berger wrote: On 11/22/2015 08:02 PM, Kevin O'Connor wrote: Instead of passing in the event data to tpm_extend_acpi_log() via parameters, use the event[] field in the pcpes. Update those callers that

Re: [SeaBIOS] [PATCH 4/8] tpm: Use pcpes->event[] to pass data to tpm_extend_acpi_log()

2015-11-22 Thread Kevin O'Connor
On Sun, Nov 22, 2015 at 08:31:43PM -0500, Stefan Berger wrote: > On 11/22/2015 08:02 PM, Kevin O'Connor wrote: > >Instead of passing in the event data to tpm_extend_acpi_log() via > >parameters, use the event[] field in the pcpes. Update those callers > >that don't populate the pcpes->event to do

Re: [SeaBIOS] [PATCH 4/8] tpm: Use pcpes->event[] to pass data to tpm_extend_acpi_log()

2015-11-22 Thread Stefan Berger
On 11/22/2015 08:02 PM, Kevin O'Connor wrote: Instead of passing in the event data to tpm_extend_acpi_log() via parameters, use the event[] field in the pcpes. Update those callers that don't populate the pcpes->event to do so prior to calling tpm_extend_acpi_log(). Signed-off-by: Kevin O'Conno

Re: [SeaBIOS] [PATCH 0/7] Some TPM code reorganization

2015-11-22 Thread Kevin O'Connor
On Sun, Nov 22, 2015 at 06:54:47PM -0500, Stefan Berger wrote: > On 11/22/2015 12:20 PM, Kevin O'Connor wrote: > >Hi Stefan, > > > >As part of trying to better understand the TPM code, I found some > >changes to tcgbios.c were helpful. It's mostly code movement. I've > >only compile tested these

[SeaBIOS] [PATCH 1/8] tpm: Don't pass entry_count around in parameters to/from tpm_extend_acpi_log()

2015-11-22 Thread Kevin O'Connor
Now that entry_count is in a global variable there is no need to pass it around as function parameters. Signed-off-by: Kevin O'Connor --- src/tcgbios.c | 34 +++--- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/src/tcgbios.c b/src/tcgbios.c index c67

[SeaBIOS] [PATCH 4/8] tpm: Use pcpes->event[] to pass data to tpm_extend_acpi_log()

2015-11-22 Thread Kevin O'Connor
Instead of passing in the event data to tpm_extend_acpi_log() via parameters, use the event[] field in the pcpes. Update those callers that don't populate the pcpes->event to do so prior to calling tpm_extend_acpi_log(). Signed-off-by: Kevin O'Connor --- src/std/tcg.h | 2 +- src/tcgbios.c | 7

[SeaBIOS] [PATCH 6/8] tpm: Don't implement scatter-gather in transmit()

2015-11-22 Thread Kevin O'Connor
There are no longer any callers to transmit() that use multiple buffers. Simplify transmit() so that it takes a single request buffer. The pass_through_to_tpm() wrapper around transmit() is no longer needed. Remove the function and have all callers use transmit() directly. Now that tpm_extend()

[SeaBIOS] [PATCH 7/8] tpm: Merge tpm_log_event() and tpm_extend_acpi_log()

2015-11-22 Thread Kevin O'Connor
Merge tpm_extend_acpi_log() and tpm_log_event(). Move error checking and handling to callers. Don't shutdown the TPM on a failure from the 16bit BIOS interface. Signed-off-by: Kevin O'Connor --- src/tcgbios.c | 23 --- 1 file changed, 8 insertions(+), 15 deletions(-) diff

[SeaBIOS] [PATCH 5/8] tpm: Avoid scatter-gather copying in build_and_send_cmd()

2015-11-22 Thread Kevin O'Connor
Setup the tpm hardware request in a linear area of memory. Signed-off-by: Kevin O'Connor --- src/tcgbios.c | 37 + 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/src/tcgbios.c b/src/tcgbios.c index e7adf3f..d4f6288 100644 --- a/src/tcgbios.c +

[SeaBIOS] [PATCH 3/8] tpm: Perform hashing separately from logging

2015-11-22 Thread Kevin O'Connor
Instead of calculating the hash in hash_log_event(), create a new function (tpm_fill_hash) that will create the hash, and update all callers to use tpm_fill_hash() before calling hash_log_event(). This reduce the number of parameters to hash_log_event(). Rename hash_log_event() and hash_log_exten

[SeaBIOS] [PATCH 8/8] tpm: Merge tpm_log_extend_event() and tpm_extend(); extend before logging

2015-11-22 Thread Kevin O'Connor
Merge tpm_extend() into tpm_log_extend_event(). Also, the spec states that a log entry should only be added if the extend succeeds, so attempt the extend prior to adding to the log. Signed-off-by: Kevin O'Connor --- src/tcgbios.c | 33 + 1 file changed, 13 insert

[SeaBIOS] [PATCH 2/8] tpm: There is no need to pass pcrindex to hash_log_extend_event()

2015-11-22 Thread Kevin O'Connor
The pcrindex is already in pcpes->pcrindex, so no need to pass it as a parameter. Signed-off-by: Kevin O'Connor --- src/tcgbios.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/tcgbios.c b/src/tcgbios.c index 5461a54..1fb8e5c 100644 --- a/src/tcgbios.c +++

[SeaBIOS] [PATCH 0/8] Further TPM cleanups

2015-11-22 Thread Kevin O'Connor
This series implements some further cleanups I saw while reviewing the TPM code. Some of the TPM functions take several parameters and this series attempts to simplify that. I've only compile tested this. The series is also available at: https://github.com/KevinOConnor/seabios/tree/testing -

Re: [SeaBIOS] [PATCH 0/7] Some TPM code reorganization

2015-11-22 Thread Stefan Berger
On 11/22/2015 12:20 PM, Kevin O'Connor wrote: Hi Stefan, As part of trying to better understand the TPM code, I found some changes to tcgbios.c were helpful. It's mostly code movement. I've only compile tested these changes, but I think they are safe. I don't want to conflict with any changes

Re: [SeaBIOS] [PATCH 4/7] tpm: Open code tpm_ipl() into callers

2015-11-22 Thread Kevin O'Connor
On Sun, Nov 22, 2015 at 08:11:56PM +0100, Peter Stuge wrote: > Nice series! > > Kevin O'Connor wrote: > > The only three three callers > > Typo ^ Thanks. I fixed locally and on github. -Kevin ___ SeaBIOS mailing list SeaBIOS@seabios.org

Re: [SeaBIOS] [PATCH 4/7] tpm: Open code tpm_ipl() into callers

2015-11-22 Thread Peter Stuge
Nice series! Kevin O'Connor wrote: > The only three three callers Typo ^ //Peter ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios

[SeaBIOS] [PATCH 6/7] tpm: Move tpm_add_bootdevice() into callers

2015-11-22 Thread Kevin O'Connor
The switch statement in tpm_add_bootdevice() corresponds with its call sites - just perform the appropriate action in each caller. Signed-off-by: Kevin O'Connor --- src/tcgbios.c | 51 +++ 1 file changed, 7 insertions(+), 44 deletions(-) diff --gi

[SeaBIOS] [PATCH 7/7] tpm: Move tpm_start_option_rom_scan() and tpm_calling_int19h() into callers

2015-11-22 Thread Kevin O'Connor
Signed-off-by: Kevin O'Connor --- src/tcgbios.c | 31 ++- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/src/tcgbios.c b/src/tcgbios.c index d415714..c6782ee 100644 --- a/src/tcgbios.c +++ b/src/tcgbios.c @@ -601,18 +601,6 @@ tpm_add_action(u32 pcrIndex

[SeaBIOS] [PATCH 2/7] tpm: Move code around in tcgbios.c

2015-11-22 Thread Kevin O'Connor
Move like functions near each other. Reduce forward function declarations. This is only code movement - no code changes. This groups the code into six sections: TPM state tracking, TPM hardware interface, ACPI TCPA table interface, Helper functions, Setup and Measurements, BIOS interface. Signe

[SeaBIOS] [PATCH 3/7] tpm: Move error recovery from tpm_extend_acpi_log() to only caller

2015-11-22 Thread Kevin O'Connor
Move tpm state checking and error handling from tpm_extend_acpi_log() to its only caller hash_log_event(). This makes tpm_extend_acpi_log() specific to just ACPI table handling. Signed-off-by: Kevin O'Connor --- src/tcgbios.c | 22 -- 1 file changed, 8 insertions(+), 14 dele

[SeaBIOS] [PATCH 1/7] tpm: Add "static" declaration to functions not used outside tcgbios.c

2015-11-22 Thread Kevin O'Connor
Signed-off-by: Kevin O'Connor --- src/tcgbios.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tcgbios.c b/src/tcgbios.c index 5229b4e..341ab9d 100644 --- a/src/tcgbios.c +++ b/src/tcgbios.c @@ -1136,7 +1136,7 @@ tpm_calling_int19h(void) /* * Add event separators

[SeaBIOS] [PATCH 4/7] tpm: Open code tpm_ipl() into callers

2015-11-22 Thread Kevin O'Connor
The only three three callers of tpm_ipl() exactly correlate with the three switch branches in tpm_ipl(), so just move the appropriate code into the callers. Signed-off-by: Kevin O'Connor --- src/tcgbios.c | 80 ++- 1 file changed, 24 insert

[SeaBIOS] [PATCH 5/7] tpm: Change tpm_add_measurement() to tpm_add_action()

2015-11-22 Thread Kevin O'Connor
Make the only caller of tpm_add_measurement() with EV_SEPARATOR directly call tpm_add_measurement_to_log(). Rename to tpm_add_action() and change all callers with EV_ACTION to use this function. Signed-off-by: Kevin O'Connor --- src/tcgbios.c | 55 +--

[SeaBIOS] [PATCH 0/7] Some TPM code reorganization

2015-11-22 Thread Kevin O'Connor
Hi Stefan, As part of trying to better understand the TPM code, I found some changes to tcgbios.c were helpful. It's mostly code movement. I've only compile tested these changes, but I think they are safe. I don't want to conflict with any changes you may have pending. So, let me know if this