]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: refactor efi_append_scrtm_version()
authorMasahisa Kojima <masahisa.kojima@linaro.org>
Fri, 13 Aug 2021 07:12:42 +0000 (16:12 +0900)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 14 Aug 2021 18:54:41 +0000 (20:54 +0200)
Refactor efi_append_scrtm_version() to use common
function for adding eventlog and extending PCR.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
lib/efi_loader/efi_tcg2.c

index c6f2e4810659e4908bd3cd81452d68da01bfdc16..35e69b911290aea8995d826fae54c48a108f9e58 100644 (file)
@@ -1321,23 +1321,11 @@ out:
  */
 static efi_status_t efi_append_scrtm_version(struct udevice *dev)
 {
-       struct tpml_digest_values digest_list;
        u8 ver[] = U_BOOT_VERSION_STRING;
-       const int pcr_index = 0;
        efi_status_t ret;
 
-       ret = tcg2_create_digest(ver, sizeof(ver), &digest_list);
-       if (ret != EFI_SUCCESS)
-               goto out;
+       ret = tcg2_measure_event(dev, 0, EV_S_CRTM_VERSION, sizeof(ver), ver);
 
-       ret = tcg2_pcr_extend(dev, pcr_index, &digest_list);
-       if (ret != EFI_SUCCESS)
-               goto out;
-
-       ret = tcg2_agile_log_append(pcr_index, EV_S_CRTM_VERSION, &digest_list,
-                                   sizeof(ver), ver);
-
-out:
        return ret;
 }