[PATCH v2 0/3] Enhance Measured Boot

2021-09-21 Thread Masahisa Kojima
This patch series add the following measurement mandated in the TCG PC Client PFP Specification. - SMBIOS tables - GPT disk partition topology - AuditMode and Deployed mode Masahisa Kojima (3): efi_loader: add SMBIOS table measurement efi_loader: add UEFI GPT measurement efi_loader: add

Re: [PATCH 2/3] efi_loader: add UEFI GPT measurement

2021-09-16 Thread Masahisa Kojima
On Thu, 16 Sept 2021 at 16:29, Heinrich Schuchardt wrote: > > > > On 9/15/21 7:15 AM, Masahisa Kojima wrote: > > This commit adds the UEFI GPT disk partition topology > > measurement required in TCG PC Client PFP Spec. > > Thanks for looking into the missing part

Re: [PATCH 3/3] efi_loader: add DeployedMode and AuditMode variable measurement

2021-09-16 Thread Masahisa Kojima
Hi Heinrich, On Thu, 16 Sept 2021 at 16:02, Heinrich Schuchardt wrote: > > > > On 9/15/21 7:15 AM, Masahisa Kojima wrote: > > This commit adds the DeployedMode and AuditMode variable > > measurement required in TCG PC Client PFP Spec. > > > > Signed-off-by

Re: [PATCH 1/3] efi_loader: add SMBIOS table measurement

2021-09-15 Thread Masahisa Kojima
Hi Ilias, Thank you for the review. On Wed, 15 Sept 2021 at 17:37, Ilias Apalodimas wrote: > > Hi Kojima-san, > > On Wed, Sep 15, 2021 at 02:15:44PM +0900, Masahisa Kojima wrote: > > TCG PC Client spec requires to measure the SMBIOS > > table that contain static c

[PATCH 3/3] efi_loader: add DeployedMode and AuditMode variable measurement

2021-09-14 Thread Masahisa Kojima
This commit adds the DeployedMode and AuditMode variable measurement required in TCG PC Client PFP Spec. Signed-off-by: Masahisa Kojima --- lib/efi_loader/efi_tcg2.c | 47 +++ 1 file changed, 47 insertions(+) diff --git a/lib/efi_loader/efi_tcg2.c b/lib

[PATCH 1/3] efi_loader: add SMBIOS table measurement

2021-09-14 Thread Masahisa Kojima
*)entry->struct_table_address; Signed-off-by: Masahisa Kojima --- include/efi_loader.h | 2 + include/efi_tcg2.h| 15 include/smbios.h | 13 lib/efi_loader/Kconfig| 1 + lib/efi_loader/efi_boottime.c | 2 + lib/efi_loader/efi_smbios.c |

[PATCH 2/3] efi_loader: add UEFI GPT measurement

2021-09-14 Thread Masahisa Kojima
This commit adds the UEFI GPT disk partition topology measurement required in TCG PC Client PFP Spec. Signed-off-by: Masahisa Kojima --- include/blk.h | 3 + include/efi_loader.h | 2 +- include/efi_tcg2.h| 12 +++ lib/efi_loader/efi_boottime.c | 2

[PATCH 0/3] Enhance Measured Boot

2021-09-14 Thread Masahisa Kojima
This patch series add the following measurement mandated in the TCG PC Client PFP Specification. - SMBIOS tables - GPT disk partition topology - AuditMode and Deployed mode Masahisa Kojima (3): efi_loader: add SMBIOS table measurement efi_loader: add UEFI GPT measurement efi_loader: add

[PATCH] efi_loader: boot_service_capability_min should be capitalized

2021-09-05 Thread Masahisa Kojima
boot_service_capability_min is constant, it should be capitalized. Signed-off-by: Masahisa Kojima --- include/efi_tcg2.h| 2 +- lib/efi_loader/efi_tcg2.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/efi_tcg2.h b/include/efi_tcg2.h index c99384fb00

Re: [PATCH 2/3] efi_loader: fix boot_service_capability_min calculation

2021-09-03 Thread Masahisa Kojima
On Fri, 3 Sept 2021 at 16:01, Heinrich Schuchardt wrote: > > On 9/3/21 3:55 AM, Masahisa Kojima wrote: > > TCG EFI Protocol Specification requires to the input > > ProtocolCapability.Size < size of the EFI_TCG2_BOOT_SERVICE_CAPABILITY > > up to and including the ven

[PATCH 3/3] efi_loader: fix efi_tcg2_hash_log_extend_event() parameter check

2021-09-02 Thread Masahisa Kojima
to check the range of PCRIndex parameter. Signed-off-by: Masahisa Kojima --- include/efi_tcg2.h| 2 ++ lib/efi_loader/efi_tcg2.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/efi_tcg2.h b/include/efi_tcg2.h index 45788d55d5..b647361d44 100644 --- a/include

[PATCH 2/3] efi_loader: fix boot_service_capability_min calculation

2021-09-02 Thread Masahisa Kojima
TCG EFI Protocol Specification requires to the input ProtocolCapability.Size < size of the EFI_TCG2_BOOT_SERVICE_CAPABILITY up to and including the vendor ID field. Current implementation does different calculation, let's fix it. Signed-off-by: Masahisa Kojima --- include/efi_tcg2.h | 2 +-

[PATCH 1/3] efi_loader: add missing parameter check for EFI_TCG2_PROTOCOL api

2021-09-02 Thread Masahisa Kojima
TCG EFI Protocol Specification defines the required parameter checking and return value for each API. This commit adds the missing parameter check and fixes the wrong return value to comply the specification. Signed-off-by: Masahisa Kojima --- lib/efi_loader/efi_tcg2.c | 19

[PATCH 0/3] Miscellaneous fixes of efi_tcg2

2021-09-02 Thread Masahisa Kojima
Arm is preparing the BBSR(Base Boot Security Requirement) compiance test tool. This tool covers Measured Boot, it checks TCG EFI Protocol compliance. This patch series fix the failure items detected by this BBSR compliance test tool. Masahisa Kojima (3): efi_loader: add missing parameter check

Re: [PATCH v4 3/5] efi_loader: add ExitBootServices() measurement

2021-08-15 Thread Masahisa Kojima
On Sat, 14 Aug 2021 at 18:06, Heinrich Schuchardt wrote: > > On 8/13/21 9:12 AM, Masahisa Kojima wrote: > > TCG PC Client PFP spec requires to measure > > "Exit Boot Services Invocation" if ExitBootServices() is invoked. > > Depending upon the return cod

[PATCH v4 5/5] efi_loader: add comment for efi_tcg2.h

2021-08-13 Thread Masahisa Kojima
This commit adds the comment of the TCG Specification efi_tcg2.h file refers, and comment for the structure. Signed-off-by: Masahisa Kojima --- (no change since v3) Changes in v3: - update comment format Changes in v2: - newly create commit from v2 include/efi_tcg2.h | 57

[PATCH v4 4/5] efi_loader: refactor efi_append_scrtm_version()

2021-08-13 Thread Masahisa Kojima
Refactor efi_append_scrtm_version() to use common function for adding eventlog and extending PCR. Signed-off-by: Masahisa Kojima --- (no changes since v1) lib/efi_loader/efi_tcg2.c | 14 +- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/efi_loader/efi_tcg2.c b

[PATCH v4 3/5] efi_loader: add ExitBootServices() measurement

2021-08-13 Thread Masahisa Kojima
is also measured. Signed-off-by: Masahisa Kojima --- Changes in v4: - remove unnecessary EFIAPI specifier Changes in v2: - use strlen instead of sizeof, event log for EV_EFI_ACTION string shall not include NUL terminator include/efi_loader.h | 1 + lib/efi_loader/efi_boottime.c | 5

[PATCH v4 2/5] efi_loader: add boot variable measurement

2021-08-13 Thread Masahisa Kojima
requires to measure "Calling EFI Application from Boot Option" for each boot attempt, and "Returning from EFI Application from Boot Option" if a boot device returns control back to the Boot Manager. Signed-off-by: Masahisa Kojima --- Changes in v4: - remove unnecessary EFIAPI speci

[PATCH v4 1/5] efi_loader: add secure boot variable measurement

2021-08-13 Thread Masahisa Kojima
te that this implementation assumes that secure boot variables are pre-configured and not be set/updated in runtime. Signed-off-by: Masahisa Kojima --- Changes in v4: - remove unnecessary EFIAPI specifier - modify wrong guid for dbt and dbr Changes in v3: - add "dbt" and "dbr" meas

[PATCH v4 0/5] add measurement support

2021-08-13 Thread Masahisa Kojima
easurement of U-boot itself. I assume U-boot measurement will be done by the former firmware such as trusted firmware. Masahisa Kojima (5): efi_loader: add secure boot variable measurement efi_loader: add boot variable measurement efi_loader: add ExitBootServices() measurement

Re: [PATCH v3 2/5] efi_loader: add boot variable measurement

2021-08-11 Thread Masahisa Kojima
On Wed, 11 Aug 2021 at 15:50, AKASHI Takahiro wrote: > > On Wed, Aug 11, 2021 at 12:05:39PM +0900, Masahisa Kojima wrote: > > On Tue, 10 Aug 2021 at 11:19, AKASHI Takahiro > > wrote: > > > > > > On Fri, Aug 06, 2021 at 04:02:12PM +0900, Masahisa Kojima w

Re: [PATCH v3 2/5] efi_loader: add boot variable measurement

2021-08-10 Thread Masahisa Kojima
On Tue, 10 Aug 2021 at 11:19, AKASHI Takahiro wrote: > > On Fri, Aug 06, 2021 at 04:02:12PM +0900, Masahisa Kojima wrote: > > TCG PC Client PFP spec requires to measure "Boot" > > and "BootOrder" variables, EV_SEPARATOR event prior > > to the Rea

Re: [PATCH v3 1/5] efi_loader: add secure boot variable measurement

2021-08-10 Thread Masahisa Kojima
Hi Akashi-san, Thank you for your comment. On Tue, 10 Aug 2021 at 10:44, AKASHI Takahiro wrote: > > Kojima-san, > > On Fri, Aug 06, 2021 at 04:02:11PM +0900, Masahisa Kojima wrote: > > TCG PC Client PFP spec requires to measure the secure > > boot policy before v

[PATCH v3 5/5] efi_loader: add comment for efi_tcg2.h

2021-08-06 Thread Masahisa Kojima
This commit adds the comment of the TCG Specification efi_tcg2.h file refers, and comment for the structure. Signed-off-by: Masahisa Kojima --- Changes in v3: - update comment format Changes in v2: - newly create commit from v2 include/efi_tcg2.h | 57

[PATCH v3 4/5] efi_loader: refactor efi_append_scrtm_version()

2021-08-06 Thread Masahisa Kojima
Refactor efi_append_scrtm_version() to use common function for adding eventlog and extending PCR. Signed-off-by: Masahisa Kojima --- (no changes since v1) lib/efi_loader/efi_tcg2.c | 14 +- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/efi_loader/efi_tcg2.c b

[PATCH v3 2/5] efi_loader: add boot variable measurement

2021-08-06 Thread Masahisa Kojima
requires to measure "Calling EFI Application from Boot Option" for each boot attempt, and "Returning from EFI Application from Boot Option" if a boot device returns control back to the Boot Manager. Signed-off-by: Masahisa Kojima --- Changes in v3: - modify log output Chan

[PATCH v3 3/5] efi_loader: add ExitBootServices() measurement

2021-08-06 Thread Masahisa Kojima
is also measured. Signed-off-by: Masahisa Kojima --- (no changes since v2) Changes in v2: - use strlen instead of sizeof, event log for EV_EFI_ACTION string shall not include NUL terminator include/efi_loader.h | 1 + lib/efi_loader/efi_boottime.c | 5 +++ lib/

[PATCH v3 1/5] efi_loader: add secure boot variable measurement

2021-08-06 Thread Masahisa Kojima
te that this implementation assumes that secure boot variables are pre-configured and not be set/updated in runtime. Signed-off-by: Masahisa Kojima --- Changes in v3: - add "dbt" and "dbr" measurement - accept empty variable measurement for "SecureBoot", "PK", &qu

[PATCH v3 0/5] add measurement support

2021-08-06 Thread Masahisa Kojima
easurement of U-boot itself. I assume U-boot measurement will be done by the former firmware such as trusted firmware. Masahisa Kojima (5): efi_loader: add secure boot variable measurement efi_loader: add boot variable measurement efi_loader: add ExitBootServices() measurement

Re: [PATCH v2 2/6] efi_loader: add secure boot variable measurement

2021-08-05 Thread Masahisa Kojima
On Thu, 15 Jul 2021 at 15:44, Heinrich Schuchardt wrote: > > > > On 7/14/21 3:00 PM, Masahisa Kojima wrote: > > TCG PC Client PFP spec requires to measure the secure > > boot policy before validating the UEFI image. > > This commit adds the secure boot variable

Re: [PATCH v2 2/6] efi_loader: add secure boot variable measurement

2021-07-20 Thread Masahisa Kojima
Hi Simon, On Wed, 21 Jul 2021 at 03:34, Simon Glass wrote: > > Hi, > > On Wed, 14 Jul 2021 at 06:59, Masahisa Kojima > wrote: > > > > TCG PC Client PFP spec requires to measure the secure > > boot policy before validating the UEFI image. > > This commit ad

Re: [PATCH v2 3/6] efi_loader: add boot variable measurement

2021-07-15 Thread Masahisa Kojima
On Thu, 15 Jul 2021 at 15:59, Heinrich Schuchardt wrote: > > > > On 7/14/21 3:00 PM, Masahisa Kojima wrote: > > TCG PC Client PFP spec requires to measure "Boot" > > and "BootOrder" variables, EV_SEPARATOR event prior > > to the Ready to Bo

Re: [PATCH 1/5] efi_loader: increase eventlog buffer size

2021-07-15 Thread Masahisa Kojima
On Thu, 15 Jul 2021 at 15:46, Ilias Apalodimas wrote: > > > On Thu, Jul 15, 2021 at 02:09:57PM +0900, Masahisa Kojima wrote: > > Hi Simon, Ilias, > > > > On Wed, 14 Jul 2021 at 23:50, Simon Glass wrote: > > > > > > Hi Masahisa, > > &g

Re: [PATCH 1/5] efi_loader: increase eventlog buffer size

2021-07-14 Thread Masahisa Kojima
Hi Simon, Ilias, On Wed, 14 Jul 2021 at 23:50, Simon Glass wrote: > > Hi Masahisa, > > On Mon, 12 Jul 2021 at 02:40, Masahisa Kojima > wrote: > > > > Hi Simon, > > > > On Sun, 11 Jul 2021 at 09:01, Simon Glass wrote: > > > > > > Hi Ma

[PATCH v2 6/6] efi_loader: add comment for efi_tcg2.h

2021-07-14 Thread Masahisa Kojima
This commit adds the comment of the TCG Specification efi_tcg2.h file refers, and comment for the structure. Signed-off-by: Masahisa Kojima --- Changes in v2: - newly create commit from v2 include/efi_tcg2.h | 51 ++ 1 file changed, 51 insertions

[PATCH v2 5/6] efi_loader: refactor efi_append_scrtm_version()

2021-07-14 Thread Masahisa Kojima
Refactor efi_append_scrtm_version() to use common function for adding eventlog and extending PCR. Signed-off-by: Masahisa Kojima --- Changes in v2: no update lib/efi_loader/efi_tcg2.c | 14 +- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/efi_loader/efi_tcg2.c

[PATCH v2 4/6] efi_loader: add ExitBootServices() measurement

2021-07-14 Thread Masahisa Kojima
is also measured. Signed-off-by: Masahisa Kojima --- Changes in v2: - use strlen instead of sizeof, event log for EV_EFI_ACTION string shall not include NUL terminator include/efi_loader.h | 1 + lib/efi_loader/efi_boottime.c | 5 +++ lib/efi_loader/efi_tcg2.c | 70 ++

[PATCH v2 3/6] efi_loader: add boot variable measurement

2021-07-14 Thread Masahisa Kojima
requires to measure "Calling EFI Application from Boot Option" for each boot attempt, and "Returning from EFI Application from Boot Option" if a boot device returns control back to the Boot Manager. Signed-off-by: Masahisa Kojima --- Changes in v2: - use efi_create_indexed_

[PATCH v2 2/6] efi_loader: add secure boot variable measurement

2021-07-14 Thread Masahisa Kojima
umes that secure boot variables are pre-configured and not be set/updated in runtime. Signed-off-by: Masahisa Kojima --- Changes in v2: - missing null check for getting variable data - some minor fix for readability include/efi_tcg2.h| 20 ++ lib/efi_loader/efi_tcg2.c | 139 +

[PATCH v2 1/6] efi_loader: increase eventlog buffer size

2021-07-14 Thread Masahisa Kojima
TCG PC Client PFP spec says "The Log Area Minimum Length for the TCG event log MUST be at least 64KB." in ACPI chapter. This commit increase the buffer size to 64KB. Signed-off-by: Masahisa Kojima --- Changes in v2: - increase buffer size to 64KB, it follows the minimum size r

[PATCH v2 0/6] add measurement support

2021-07-14 Thread Masahisa Kojima
easurement of U-boot itself. I assume U-boot measurement will be done by the former firmware such as trusted firmware. Masahisa Kojima (6): efi_loader: increase eventlog buffer size efi_loader: add secure boot variable measurement efi_loader: add boot variable measurement efi_loader:

Re: [PATCH 3/5] efi_loader: add boot variable measurement

2021-07-13 Thread Masahisa Kojima
Hi Heinrich, Akashi-san, Thank you for your comment. I will keep current implementation. Thanks, Masahisa Kojima On Wed, 14 Jul 2021 at 08:54, AKASHI Takahiro wrote: > > On Tue, Jul 13, 2021 at 04:24:52PM +0200, Heinrich Schuchardt wrote: > > > > > > On 13.07.21 10:3

Re: [PATCH 3/5] efi_loader: add boot variable measurement

2021-07-13 Thread Masahisa Kojima
oot event handler, ready_to_boot handler is called upon the user selects the boot option in boot manager. What do you think? Thanks, Masahisa Kojima On Fri, 9 Jul 2021 at 11:44, Masahisa Kojima wrote: > > On Fri, 9 Jul 2021 at 02:46, Heinrich Schuchardt wrote: &g

Re: [PATCH 1/5] efi_loader: increase eventlog buffer size

2021-07-12 Thread Masahisa Kojima
Hi Simon, On Sun, 11 Jul 2021 at 09:01, Simon Glass wrote: > > Hi Masahisa, > > On Wed, 7 Jul 2021 at 20:21, Masahisa Kojima > wrote: > > > > On Wed, 7 Jul 2021 at 22:47, Heinrich Schuchardt wrote: > > > > > > > > > > > > On 7/7/2

Re: [PATCH 4/5] efi_loader: add ExitBootServices() measurement

2021-07-08 Thread Masahisa Kojima
On Fri, 9 Jul 2021 at 02:40, Heinrich Schuchardt wrote: > > On 7/7/21 3:36 PM, Masahisa Kojima wrote: > > TCG PC Client PFP spec requires to measure > > "Exit Boot Services Invocation" if ExitBootServices() is invoked. > > Depending upon the return code from the

Re: [PATCH 3/5] efi_loader: add boot variable measurement

2021-07-08 Thread Masahisa Kojima
On Fri, 9 Jul 2021 at 02:46, Heinrich Schuchardt wrote: > > On 7/7/21 3:36 PM, Masahisa Kojima wrote: > > TCG PC Client PFP spec requires to measure "Boot" > > and "BootOrder" variables, EV_SEPARATOR event prior > > to the Ready to Boot invocatio

Re: [PATCH 2/5] efi_loader: add secure boot variable measurement

2021-07-08 Thread Masahisa Kojima
On Fri, 9 Jul 2021 at 02:46, Heinrich Schuchardt wrote: > > On 7/7/21 3:36 PM, Masahisa Kojima wrote: > > TCG PC Client PFP spec requires to measure the secure > > boot policy before validating the UEFI image. > > This commit adds the secure boot variable measurement

Re: [PATCH 5/5] efi_loader: refactor efi_append_scrtm_version()

2021-07-08 Thread Masahisa Kojima
On Fri, 9 Jul 2021 at 02:32, Heinrich Schuchardt wrote: > > On 7/7/21 3:36 PM, Masahisa Kojima wrote: > > Refactor efi_append_scrtm_version() to use common > > function for adding eventlog and extending PCR. > > > > Signed-off-by: Masahisa Kojima > > ---

Re: [PATCH 3/5] efi_loader: add boot variable measurement

2021-07-07 Thread Masahisa Kojima
i_status_t ret; > > + struct udevice *dev; > > + > > + ret = platform_get_tpm2_device(); > > + if (ret != EFI_SUCCESS) > > + return ret; > > + > > + ret = tcg2_measure_event(dev, 4, EV_EFI_ACTION, > > + strlen(EFI_RETURNING_FROM_EFI_APPLICATION), > > Do we need a NUL terminator on this string or not? No, TCG spec says "the actual log entries SHALL NOT include the quote characters or a NUL terminator." Thanks, Masahisa Kojima > > > Regards > /Ilias

Re: [PATCH 1/5] efi_loader: increase eventlog buffer size

2021-07-07 Thread Masahisa Kojima
On Wed, 7 Jul 2021 at 22:47, Heinrich Schuchardt wrote: > > > > On 7/7/21 3:36 PM, Masahisa Kojima wrote: > > This is a preperation to add eventlog support > > described in TCG PC Client PFP spec. > > > > Signed-off-by: Masahisa Kojima > > --- > &

[PATCH 5/5] efi_loader: refactor efi_append_scrtm_version()

2021-07-07 Thread Masahisa Kojima
Refactor efi_append_scrtm_version() to use common function for adding eventlog and extending PCR. Signed-off-by: Masahisa Kojima --- lib/efi_loader/efi_tcg2.c | 14 +- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c

[PATCH 4/5] efi_loader: add ExitBootServices() measurement

2021-07-07 Thread Masahisa Kojima
is also measured. Signed-off-by: Masahisa Kojima --- include/efi_loader.h | 1 + lib/efi_loader/efi_boottime.c | 5 +++ lib/efi_loader/efi_tcg2.c | 70 +++ 3 files changed, 76 insertions(+) diff --git a/include/efi_loader.h b/include/efi_loader.h index

[PATCH 2/5] efi_loader: add secure boot variable measurement

2021-07-07 Thread Masahisa Kojima
umes that secure boot variables are pre-configured and not be set/updated in runtime. Signed-off-by: Masahisa Kojima --- include/efi_tcg2.h| 20 ++ lib/efi_loader/efi_tcg2.c | 135 ++ 2 files changed, 155 insertions(+) diff --git a/include/efi_tcg2.h b/incl

[PATCH 3/5] efi_loader: add boot variable measurement

2021-07-07 Thread Masahisa Kojima
requires to measure "Calling EFI Application from Boot Option" for each boot attempt, and "Returning from EFI Application from Boot Option" if a boot device returns control back to the Boot Manager. Signed-off-by: Masahisa Kojima --- include/efi_loader.h | 4 ++ includ

[PATCH 1/5] efi_loader: increase eventlog buffer size

2021-07-07 Thread Masahisa Kojima
This is a preperation to add eventlog support described in TCG PC Client PFP spec. Signed-off-by: Masahisa Kojima --- lib/efi_loader/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index b2ab48a048..a87bf3cc98 100644

[PATCH 0/5] add measurement support

2021-07-07 Thread Masahisa Kojima
easurement of U-boot itself. I assume U-boot measurement will be done by the former firmware such as trusted firmware. Masahisa Kojima (5): efi_loader: increase eventlog buffer size efi_loader: add secure boot variable measurement efi_loader: add boot variable measurement efi_loader:

Re: [PATCH 1/1] efi_loader: fix Sphinx warning

2021-06-09 Thread Masahisa Kojima
e one entry of region \[@start, @end\[ and insert it into the list. > * > * * If @nocheck is false, the list will be sorted ascending by address. > * Overlapping entries will not be allowed. > -- > 2.30.2 > Reviewed-by: Masahisa Kojima Thanks, Masahisa Kojima

[PATCH] efi_loader: build warning in efi_tcg2.c

2021-05-27 Thread Masahisa Kojima
953 | ret = tcg2_hash_pe_image((void *)data_to_hash, data_to_hash_len, |^ Signed-off-by: Masahisa Kojima --- lib/efi_loader/efi_tcg2.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_t

Re: [PATCH v9 1/1] efi_loader: add PE/COFF image measurement

2021-05-26 Thread Masahisa Kojima
On Thu, 27 May 2021 at 01:28, Alex G. wrote: > > On 5/25/21 10:09 PM, Masahisa Kojima wrote: > > "TCG PC Client Platform Firmware Profile Specification" > > requires to measure every attempt to load and execute > > a OS Loader(a UEFI application) into PCR[4]

Re: [PATCH RFC 0/2] lib: Remove the need for a HASH_CALCULATE config

2021-05-26 Thread Masahisa Kojima
Hi Alexandru, I agree with this series. Use CONFIG_HASH is more general than adding new CONFIG_HASH_CALCULATE. Thanks, Masahisa Kojima On Tue, 25 May 2021 at 04:28, Alexandru Gagniuc wrote: > > I had accidentally noticed commit 87316da05f2f ("lib: introduce > HASH_CALCULATE

Re: [PATCH v8 3/3] efi_loader: add PE/COFF image measurement

2021-05-25 Thread Masahisa Kojima
; > Why don't you unconditionally copy to a new buffer? Then the caller can > > free the return value unconditionally. I sent out v9 just now. I don't include unconditionally copy to a new buffer, because new version increases the readability I think. If you still prefer to copy, I will do so. T

[PATCH v9 1/1] efi_loader: add PE/COFF image measurement

2021-05-25 Thread Masahisa Kojima
as Tested-by: Ilias Apalodimas Signed-off-by: Masahisa Kojima --- Changes in v9: - use original return code from __get_active_pcr_banks() - return EFI_UNSUPPORTED instead of EFI_INVALID_PARAMETER if efi_image_parse() fails, it complies with TCG spec - remove **new_efi parameter from efi_prepare_ali

[PATCH v9 0/1] PE/COFF measurement support

2021-05-25 Thread Masahisa Kojima
one remaining commit from v9. Masahisa Kojima (1): efi_loader: add PE/COFF image measurement include/efi_loader.h | 6 + include/efi_tcg2.h| 9 ++ include/tpm-v2.h | 18 +++ lib/efi_loader/Kconfig| 1 + lib/efi_loader

Re: [PATCH v8 3/3] efi_loader: add PE/COFF image measurement

2021-05-25 Thread Masahisa Kojima
On Tue, 25 May 2021 at 21:57, Heinrich Schuchardt wrote: > > On 14.05.21 02:53, Masahisa Kojima wrote: > > "TCG PC Client Platform Firmware Profile Specification" > > requires to measure every attempt to load and execute > > a OS Loader(a UEFI application) into P

Re: [PATCH v8 3/3] efi_loader: add PE/COFF image measurement

2021-05-24 Thread Masahisa Kojima
r will need new_efi to free the newly allocated buffer. > > > + > > [...] > > > + ret = __get_active_pcr_banks(); > > + if (ret != EFI_SUCCESS) { > > + ret = EFI_DEVICE_ERROR; > > __get_active_pcr_banks is supposed to return the correct efi_status_t code. > I don't think we need EFI_DEVICE_ERROR here. Thank you. I will just use return value of __get_active_pcr_banks(). > + if (!efi_image_parse(efi, efi_size, , , > +_len)) { > + log_err("Parsing PE executable image failed\n"); > + ret = EFI_INVALID_PARAMETER; > + goto out; I re-checked TCG spec, if PE/COFF image is corrupted or not understood, the function shall return EFI_UNSUPPORTED. I will also update. Thanks, Masahisa Kojima > > > Thanks! > /Ilias

[PATCH v8 3/3] efi_loader: add PE/COFF image measurement

2021-05-13 Thread Masahisa Kojima
as Tested-by: Ilias Apalodimas Signed-off-by: Masahisa Kojima --- (no changes since v7) Changes in v7: - include hash-checksum.h instead of rsa.h - select HASH_CALCULATE in Kconfig, not to update lib/Makefile - rebased the base code Changes in v6: - update lib/Makefile to add hash-checksum.c as a c

[PATCH v8 2/3] efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled

2021-05-13 Thread Masahisa Kojima
. This commit also adds the EFI_SIGNATURE_SUPPORT option to decide if efi_signature.c shall be compiled. Signed-off-by: Masahisa Kojima --- Changes in v8: - remove superfluous "depends on" in Kconfig (no changes since v4) Changes in v4: - revert #ifdef instead of using "if (!IS_ENABLE

[PATCH v8 1/3] lib: introduce HASH_CALCULATE option

2021-05-13 Thread Masahisa Kojima
option to decide if hash-checksum.c shall be compiled. Signed-off-by: Masahisa Kojima --- (no changes since v7) Changes in v7: - newly introduce HASH_CALCULATE option Changes in v6: - update lib/Makefile to compile hash-checksum.c, instead of selecting FIT_SIGNATURE in secure boot and capsule

[PATCH v8 0/3] PE/COFF measurement support

2021-05-13 Thread Masahisa Kojima
This patch series add the PE/COFF measurement support. Extending PCR and Event Log is tested with fTPM running as a OP-TEE TA. Unit test will be added in the separate series. Masahisa Kojima (3): lib: introduce HASH_CALCULATE option efi_loader: expose efi_image_parse() even if UEFI Secure

Re: [PATCH v7 2/3] efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled

2021-05-13 Thread Masahisa Kojima
On Fri, 14 May 2021 at 00:33, Heinrich Schuchardt wrote: > > On 5/13/21 4:48 PM, Masahisa Kojima wrote: > > This is preparation for PE/COFF measurement support. > > PE/COFF image hash calculation is same in both > > UEFI Secure Boot image verification and measurement in &g

[PATCH v7 3/3] efi_loader: add PE/COFF image measurement

2021-05-13 Thread Masahisa Kojima
as Tested-by: Ilias Apalodimas Signed-off-by: Masahisa Kojima --- Changes in v7: - include hash-checksum.h instead of rsa.h - select HASH_CALCULATE in Kconfig, not to update lib/Makefile - rebased the base code Changes in v6: - update lib/Makefile to add hash-checksum.c as a compilation target (

[PATCH v7 2/3] efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled

2021-05-13 Thread Masahisa Kojima
. This commit also adds the EFI_SIGNATURE_SUPPORT option to decide if efi_signature.c shall be compiled. Signed-off-by: Masahisa Kojima --- (no changes since v4) Changes in v4: - revert #ifdef instead of using "if (!IS_ENABLED())" statement, not to rely on the compiler optimization. Cha

[PATCH v7 1/3] lib: introduce HASH_CALCULATE option

2021-05-13 Thread Masahisa Kojima
option to decide if hash-checksum.c shall be compiled. Signed-off-by: Masahisa Kojima --- Changes in v7: - newly introduce HASH_CALCULATE option Changes in v6: - update lib/Makefile to compile hash-checksum.c, instead of selecting FIT_SIGNATURE in secure boot and capsule authentication. Changes

[PATCH v7 0/3] PE/COFF measurement support

2021-05-13 Thread Masahisa Kojima
This patch series add the PE/COFF measurement support. Extending PCR and Event Log is tested with fTPM running as a OP-TEE TA. Unit test will be added in the separate series. Masahisa Kojima (3): lib: introduce HASH_CALCULATE option efi_loader: expose efi_image_parse() even if UEFI Secure

Re: [PATCH v6 1/3] lib: fix build error for secure boot and capsule authentication

2021-05-13 Thread Masahisa Kojima
On Thu, 13 May 2021 at 16:52, Takahiro Akashi wrote: > > On Thu, May 13, 2021 at 04:18:29PM +0900, Masahisa Kojima wrote: > > Build error occurs when CONFIG_EFI_SECURE_BOOT or > > CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled, > > because hash-checksum.c is not compiled.

[PATCH v6 3/3] efi_loader: add PE/COFF image measurement

2021-05-13 Thread Masahisa Kojima
as Tested-by: Ilias Apalodimas Signed-off-by: Masahisa Kojima --- Changes in v6: - update lib/Makefile to add hash-checksum.c as a compilation target (no changes since v2) Changes in v2: - Remove duplicate include - Remove unnecessary __packed attribute - Add all EV_EFI_* event definition - Cre

[PATCH v6 2/3] efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled

2021-05-13 Thread Masahisa Kojima
. This commit also adds the EFI_SIGNATURE_SUPPORT option to decide if efi_signature.c shall be compiled. Signed-off-by: Masahisa Kojima --- (no changes since v4) Changes in v4: - revert #ifdef instead of using "if (!IS_ENABLED())" statement, not to rely on the compiler optimization. Cha

[PATCH v6 1/3] lib: fix build error for secure boot and capsule authentication

2021-05-13 Thread Masahisa Kojima
Build error occurs when CONFIG_EFI_SECURE_BOOT or CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled, because hash-checksum.c is not compiled. This commit adds hash-checksum.c as a compilation target if CONFIG_EFI_SECURE_BOOT or CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled. Signed-off-by: Masahisa Kojima

[PATCH v6 0/3] PE/COFF measurement support

2021-05-13 Thread Masahisa Kojima
This patch series add the PE/COFF measurement support. Extending PCR and Event Log is tested with fTPM running as a OP-TEE TA. Unit test will be added in the separate series. Masahisa Kojima (3): lib: fix build error for secure boot and capsule authentication efi_loader: expose

Re: [PATCH v5 1/3] efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled

2021-05-12 Thread Masahisa Kojima
On Thu, 13 May 2021 at 13:35, Heinrich Schuchardt wrote: > > On 5/12/21 1:32 PM, Masahisa Kojima wrote: > > This is preparation for PE/COFF measurement support. > > PE/COFF image hash calculation is same in both > > UEFI Secure Boot image verification and measurement in &g

[PATCH v5 3/3] efi_loader: add FIT_SIGNATURE option to use hash_calculate()

2021-05-12 Thread Masahisa Kojima
s required to use hash_calculate() function. This commit selects FIT_SIGNATURE option in Kconfig. Signed-off-by: Masahisa Kojima --- Changes in v5: - Missing option for EFI_TCG2_PROTOROL already added in different commit. This commit adds FIT_SIGNATRE only. Changes in v4: - newly added in

[PATCH v5 2/3] efi_loader: add PE/COFF image measurement

2021-05-12 Thread Masahisa Kojima
as Tested-by: Ilias Apalodimas Signed-off-by: Masahisa Kojima --- (no changes since v2) Changes in v2: - Remove duplicate include - Remove unnecessary __packed attribute - Add all EV_EFI_* event definition - Create common function to prepare 8-byte aligned image - Add m

[PATCH v5 1/3] efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled

2021-05-12 Thread Masahisa Kojima
. This commit also adds the EFI_SIGNATURE_SUPPORT option to decide if efi_signature.c shall be compiled. Signed-off-by: Masahisa Kojima --- (no changes since v4) Changes in v4: - revert #ifdef instead of using "if (!IS_ENABLED())" statement, not to rely on the compiler optimization. Cha

[PATCH v5 0/3] PE/COFF measurement support

2021-05-12 Thread Masahisa Kojima
This patch series add the PE/COFF measurement support. Extending PCR and Event Log is tested with fTPM running as a OP-TEE TA. Unit test will be added in the separate series. Masahisa Kojima (3): efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled efi_loader: add PE

Re: [PATCH v4 3/3] efi_loader: add required option to use hash_calculate()

2021-05-12 Thread Masahisa Kojima
On Wed, 12 May 2021 at 17:32, Ilias Apalodimas wrote: > > On Wed, May 12, 2021 at 03:59:47PM +0900, Masahisa Kojima wrote: > > Build error occurs when CONFIG_EFI_SECURE_BOOT/ > > CONFIG_EFI_CAPSULE_AUTHENTICATE/CONFIG_EFI_TCG2_PROTOCOL > > is enabled, because hash-ch

[PATCH v4 3/3] efi_loader: add required option to use hash_calculate()

2021-05-12 Thread Masahisa Kojima
s required to use hash_calculate() function. This commit adds CONFIG_FIT_SIGNATURE option in Kconfig, and missing required options for CONFIG_EFI_TCG2_PROTOCOL. Signed-off-by: Masahisa Kojima --- Changes in v4: - newly added in this patch series, due to rebasing the base code. lib/efi_loader/K

[PATCH v4 2/3] efi_loader: add PE/COFF image measurement

2021-05-12 Thread Masahisa Kojima
"TCG PC Client Platform Firmware Profile Specification" requires to measure every attempt to load and execute a OS Loader(a UEFI application) into PCR[4]. This commit adds the PE/COFF image measurement, extends PCR, and appends measurement into Event Log. Signed-off-by: Masah

[PATCH v4 1/3] efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled

2021-05-12 Thread Masahisa Kojima
. This commit also adds the EFI_SIGNATURE_SUPPORT option to decide if efi_signature.c shall be compiled. Signed-off-by: Masahisa Kojima --- Changes in v4: - revert #ifdef instead of using "if (!IS_ENABLED())" statement, not to rely on the compiler optimization. Changes in

[PATCH v4 0/3] PE/COFF measurement support

2021-05-12 Thread Masahisa Kojima
This patch series add the PE/COFF measurement support. Extending PCR and Event Log is tested with fTPM running as a OP-TEE TA. Unit test will be added in the separate series. Masahisa Kojima (3): efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled efi_loader: add PE

Re: [PATCH v3 1/2] efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled

2021-05-12 Thread Masahisa Kojima
s, Masahisa On Tue, 11 May 2021 at 07:06, Masahisa Kojima wrote: > > On Mon, 10 May 2021 at 11:07, Takahiro Akashi > wrote: > > > > On Mon, May 10, 2021 at 09:49:03AM +0900, Masahisa Kojima wrote: > > > Hi Heinrich, > > > > > > Sorry for the late

Re: [PATCH v3 1/2] efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled

2021-05-10 Thread Masahisa Kojima
On Mon, 10 May 2021 at 11:07, Takahiro Akashi wrote: > > On Mon, May 10, 2021 at 09:49:03AM +0900, Masahisa Kojima wrote: > > Hi Heinrich, > > > > Sorry for the late reply. > > > > On Sat, 8 May 2021 at 23:08, Heinrich Schuchardt wrote: > > > > &

Re: [PATCH v3 1/2] efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled

2021-05-09 Thread Masahisa Kojima
Hi Heinrich, Sorry for the late reply. On Sat, 8 May 2021 at 23:08, Heinrich Schuchardt wrote: > > On 4/28/21 3:16 PM, Heinrich Schuchardt wrote: > > On 28.04.21 14:19, Masahisa Kojima wrote: > > >> /** > >>* cmp_pe_section() - compare virtual a

[PATCH v3 2/2] efi_loader: add PE/COFF image measurement

2021-04-28 Thread Masahisa Kojima
"TCG PC Client Platform Firmware Profile Specification" requires to measure every attempt to load and execute a OS Loader(a UEFI application) into PCR[4]. This commit adds the PE/COFF image measurement, extends PCR, and appends measurement into Event Log. Signed-off-by: Masah

[PATCH v3 0/2] PE/COFF measurement support

2021-04-28 Thread Masahisa Kojima
This patch series add the PE/COFF measurement support. Extending PCR and Event Log is tested with fTPM running as a OP-TEE TA. Unit test will be added in the separate series. Masahisa Kojima (2): efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled efi_loader: add PE

[PATCH v3 1/2] efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled

2021-04-28 Thread Masahisa Kojima
. This commit also adds the EFI_SIGNATURE_SUPPORT option to decide if efi_signature.c shall be compiled. Signed-off-by: Masahisa Kojima --- Changes in v3: - hide EFI_SIGNATURE_SUPPORT option Changes in v2: - Remove all #ifdef from efi_image_loader.c and efi_signature.c - Add EFI_SIGNATURE_SUPPORT

Re: [PATCH v2 1/2] efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled

2021-04-27 Thread Masahisa Kojima
On Wed, 28 Apr 2021 at 11:35, Heinrich Schuchardt wrote: > > Am 28. April 2021 03:06:15 MESZ schrieb Masahisa Kojima > : > >On Tue, 27 Apr 2021 at 22:52, Heinrich Schuchardt > >wrote: > >> > >> On 27.04.21 15:08, Masahisa Kojima wrote: > >> >

Re: [PATCH v2 1/2] efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled

2021-04-27 Thread Masahisa Kojima
On Tue, 27 Apr 2021 at 22:52, Heinrich Schuchardt wrote: > > On 27.04.21 15:08, Masahisa Kojima wrote: > > This is preparation for PE/COFF measurement support. > > PE/COFF image hash calculation is same in both > > UEFI Secure Boot image verification and measurement in &g

Re: [PATCH 2/2] efi_loader: add PE/COFF image measurement

2021-04-27 Thread Masahisa Kojima
ashing algorithms of Masahisa's patch, see chapter 6.4.3, "Related > Definitions". > > So let's support them. > > Best regards > > Heinrich > > > > >> For other comments, I will modify the code and send v2 patch. > >> > >> Thanks, &

[PATCH v2 2/2] efi_loader: add PE/COFF image measurement

2021-04-27 Thread Masahisa Kojima
"TCG PC Client Platform Firmware Profile Specification" requires to measure every attempt to load and execute a OS Loader(a UEFI application) into PCR[4]. This commit adds the PE/COFF image measurement, extends PCR, and appends measurement into Event Log. Signed-off-by: Masah

<    5   6   7   8   9   10   11   >