Re: [PATCH 0/3] tpm: Support boot measurements

2023-01-05 Thread Ilias Apalodimas
Hi Eddie,


On Wed, Jan 04, 2023 at 08:55:06AM -0600, Eddie James wrote:
> 
> On 1/4/23 01:47, Ilias Apalodimas wrote:
> > Hi Eddie,
> > Thanks for the patch
> > 
> > Looking at the patch there's a lot of code duplication with
> > lib/efi_loader/efi_tcg2.c.
> > Any reason why we aren't reusing that ?
> 
> 
> Hi,
> 
> Well the EFI code can't be used directly without configuring to include the
> EFI subsystem and exporting a bunch of those functions in a header file
> somewhere, so I added the functions in the generic tpm librrary. Now it's a
> matter of doing the work to use the generic functions in the EFI system. I
> can do that in this series if necesssary, I just haven't gotten to it.

Doing it the other way around is easier.  Just carve out the functions you
want from efi_tcg.c to tpm-v2.c and use them for bootm measurements.  Then
the rest of the EFI will remain unaffected.

Cheers
/Ilias
> 
> Thanks,
> 
> Eddie
> 
> 
> > 
> > Regards
> > /Ilias
> > 
> > On Tue, 3 Jan 2023 at 22:42, Eddie James  wrote:
> > > This series adds support for measuring the boot images more generically
> > > than the existing EFI support. The series includes optional measurement
> > > from the bootm command.
> > > Eventually the EFI code could be refactored to use the generic functions.
> > > 
> > > Eddie James (3):
> > >tpm: Fix spelling for tpmu_ha union
> > >tpm: Support boot measurements
> > >bootm: Support boot measurement
> > > 
> > >   boot/bootm.c   |  53 
> > >   cmd/bootm.c|   2 +
> > >   common/Kconfig |   6 +
> > >   include/efi_tcg2.h |  44 ---
> > >   include/image.h|   1 +
> > >   include/tpm-v2.h   | 139 -
> > >   lib/tpm-v2.c   | 700 +
> > >   7 files changed, 899 insertions(+), 46 deletions(-)
> > > 
> > > --
> > > 2.31.1
> > > 


Re: [PATCH 0/3] tpm: Support boot measurements

2023-01-04 Thread Simon Glass
Hi Eddie,

On Wed, 4 Jan 2023 at 07:55, Eddie James  wrote:
>
>
> On 1/4/23 01:47, Ilias Apalodimas wrote:
> > Hi Eddie,
> > Thanks for the patch
> >
> > Looking at the patch there's a lot of code duplication with
> > lib/efi_loader/efi_tcg2.c.
> > Any reason why we aren't reusing that ?
>
>
> Hi,
>
> Well the EFI code can't be used directly without configuring to include
> the EFI subsystem and exporting a bunch of those functions in a header
> file somewhere, so I added the functions in the generic tpm librrary.
> Now it's a matter of doing the work to use the generic functions in the
> EFI system. I can do that in this series if necesssary, I just haven't
> gotten to it.

We cannot have EFI code in tpm-v2.h

The TPM layer should implement the feature, with the EFI layer calling
into it. This allows the TPM feature to be used by VBE and other
non-EFI systems.

Regards,
Simon


Re: [PATCH 0/3] tpm: Support boot measurements

2023-01-04 Thread Eddie James



On 1/4/23 01:47, Ilias Apalodimas wrote:

Hi Eddie,
Thanks for the patch

Looking at the patch there's a lot of code duplication with
lib/efi_loader/efi_tcg2.c.
Any reason why we aren't reusing that ?



Hi,

Well the EFI code can't be used directly without configuring to include 
the EFI subsystem and exporting a bunch of those functions in a header 
file somewhere, so I added the functions in the generic tpm librrary. 
Now it's a matter of doing the work to use the generic functions in the 
EFI system. I can do that in this series if necesssary, I just haven't 
gotten to it.


Thanks,

Eddie




Regards
/Ilias

On Tue, 3 Jan 2023 at 22:42, Eddie James  wrote:

This series adds support for measuring the boot images more generically
than the existing EFI support. The series includes optional measurement
from the bootm command.
Eventually the EFI code could be refactored to use the generic functions.

Eddie James (3):
   tpm: Fix spelling for tpmu_ha union
   tpm: Support boot measurements
   bootm: Support boot measurement

  boot/bootm.c   |  53 
  cmd/bootm.c|   2 +
  common/Kconfig |   6 +
  include/efi_tcg2.h |  44 ---
  include/image.h|   1 +
  include/tpm-v2.h   | 139 -
  lib/tpm-v2.c   | 700 +
  7 files changed, 899 insertions(+), 46 deletions(-)

--
2.31.1



Re: [PATCH 0/3] tpm: Support boot measurements

2023-01-03 Thread Ilias Apalodimas
Hi Eddie,
Thanks for the patch

Looking at the patch there's a lot of code duplication with
lib/efi_loader/efi_tcg2.c.
Any reason why we aren't reusing that ?

Regards
/Ilias

On Tue, 3 Jan 2023 at 22:42, Eddie James  wrote:
>
> This series adds support for measuring the boot images more generically
> than the existing EFI support. The series includes optional measurement
> from the bootm command.
> Eventually the EFI code could be refactored to use the generic functions.
>
> Eddie James (3):
>   tpm: Fix spelling for tpmu_ha union
>   tpm: Support boot measurements
>   bootm: Support boot measurement
>
>  boot/bootm.c   |  53 
>  cmd/bootm.c|   2 +
>  common/Kconfig |   6 +
>  include/efi_tcg2.h |  44 ---
>  include/image.h|   1 +
>  include/tpm-v2.h   | 139 -
>  lib/tpm-v2.c   | 700 +
>  7 files changed, 899 insertions(+), 46 deletions(-)
>
> --
> 2.31.1
>


[PATCH 0/3] tpm: Support boot measurements

2023-01-03 Thread Eddie James
This series adds support for measuring the boot images more generically
than the existing EFI support. The series includes optional measurement
from the bootm command.
Eventually the EFI code could be refactored to use the generic functions.

Eddie James (3):
  tpm: Fix spelling for tpmu_ha union
  tpm: Support boot measurements
  bootm: Support boot measurement

 boot/bootm.c   |  53 
 cmd/bootm.c|   2 +
 common/Kconfig |   6 +
 include/efi_tcg2.h |  44 ---
 include/image.h|   1 +
 include/tpm-v2.h   | 139 -
 lib/tpm-v2.c   | 700 +
 7 files changed, 899 insertions(+), 46 deletions(-)

-- 
2.31.1