summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-09-26 14:15:14 -0400
committerTom Rini <trini@konsulko.com>2021-09-26 14:15:14 -0400
commit76ad0246834e2c57974b3a472fdc7c5584964caa (patch)
treeef6420bf3394a1114afe8c40fd31c646d1376a57
parent8284d6f838684cfa6e3303a447deb38027c5d7f0 (diff)
parent346cee3ac5782fefeaeda2b54914b029547adf52 (diff)
downloadu-boot-WIP/26Sep2021.tar.gz
Merge tag 'efi-2021-10-rc5' of https://source.denx.de/u-boot/custodians/u-boot-efiWIP/26Sep2021
Pull request for efi-2021-10-rc5 Documentation: * add /config bindings to HTML documentation UEFI * Fix number_of_algorithms field in TCG EFI Protocol
-rw-r--r--doc/develop/config_binding.rst10
-rw-r--r--doc/develop/index.rst1
-rw-r--r--include/efi_tcg2.h7
-rw-r--r--lib/efi_loader/efi_tcg2.c40
4 files changed, 35 insertions, 23 deletions
diff --git a/doc/develop/config_binding.rst b/doc/develop/config_binding.rst
new file mode 100644
index 0000000000..c90e99c7ba
--- /dev/null
+++ b/doc/develop/config_binding.rst
@@ -0,0 +1,10 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot configuration node
+=========================
+
+U-Boot supports a number of runtime configuration options which can be selected
+in the devicetree.
+
+These are documented in
+:download:`The /config node <../../doc/device-tree-bindings/config.txt>`.
diff --git a/doc/develop/index.rst b/doc/develop/index.rst
index 2a32645cfd..24056b10fd 100644
--- a/doc/develop/index.rst
+++ b/doc/develop/index.rst
@@ -12,6 +12,7 @@ Implementation
bloblist
ci_testing
commands
+ config_binding
devicetree/index
driver-model/index
global_data
diff --git a/include/efi_tcg2.h b/include/efi_tcg2.h
index 5a1a36212e..8f02d4fb0b 100644
--- a/include/efi_tcg2.h
+++ b/include/efi_tcg2.h
@@ -165,8 +165,6 @@ struct tcg_efi_spec_id_event_algorithm_size {
* @digest_sizes: array of number_of_algorithms pairs
* 1st member defines the algorithm id
* 2nd member defines the algorithm size
- * @vendor_info_size: size in bytes for vendor specific info
- * @vendor_info: vendor specific info
*/
struct tcg_efi_spec_id_event {
u8 signature[16];
@@ -176,10 +174,7 @@ struct tcg_efi_spec_id_event {
u8 spec_errata;
u8 uintn_size;
u32 number_of_algorithms;
- struct tcg_efi_spec_id_event_algorithm_size digest_sizes[TPM2_NUM_PCR_BANKS];
- u8 vendor_info_size;
- /* U-Boot does not provide any vendor info */
- u8 vendor_info[];
+ struct tcg_efi_spec_id_event_algorithm_size digest_sizes[];
} __packed;
/**
diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
index cb48919223..d3b8f93f14 100644
--- a/lib/efi_loader/efi_tcg2.c
+++ b/lib/efi_loader/efi_tcg2.c
@@ -575,9 +575,10 @@ static efi_status_t tcg2_create_digest(const u8 *input, u32 length,
EFI_PRINT("Unsupported algorithm %x\n", hash_alg);
return EFI_INVALID_PARAMETER;
}
+ digest_list->digests[digest_list->count].hash_alg = hash_alg;
+ memcpy(&digest_list->digests[digest_list->count].digest, final,
+ (u32)alg_to_len(hash_alg));
digest_list->count++;
- digest_list->digests[i].hash_alg = hash_alg;
- memcpy(&digest_list->digests[i].digest, final, (u32)alg_to_len(hash_alg));
}
return EFI_SUCCESS;
@@ -798,8 +799,9 @@ static efi_status_t tcg2_hash_pe_image(void *efi, u64 efi_size,
EFI_PRINT("Unsupported algorithm %x\n", hash_alg);
return EFI_INVALID_PARAMETER;
}
- digest_list->digests[i].hash_alg = hash_alg;
- memcpy(&digest_list->digests[i].digest, hash, (u32)alg_to_len(hash_alg));
+ digest_list->digests[digest_list->count].hash_alg = hash_alg;
+ memcpy(&digest_list->digests[digest_list->count].digest, hash,
+ (u32)alg_to_len(hash_alg));
digest_list->count++;
}
@@ -1120,7 +1122,7 @@ static efi_status_t create_specid_event(struct udevice *dev, void *buffer,
struct tcg_efi_spec_id_event *spec_event;
size_t spec_event_size;
efi_status_t ret = EFI_DEVICE_ERROR;
- u32 active = 0, supported = 0;
+ u32 active = 0, supported = 0, pcr_count = 0, alg_count = 0;
int err;
size_t i;
@@ -1142,25 +1144,29 @@ static efi_status_t create_specid_event(struct udevice *dev, void *buffer,
TCG_EFI_SPEC_ID_EVENT_SPEC_VERSION_ERRATA_TPM2;
spec_event->uintn_size = sizeof(efi_uintn_t) / sizeof(u32);
- err = tpm2_get_pcr_info(dev, &supported, &active,
- &spec_event->number_of_algorithms);
+ err = tpm2_get_pcr_info(dev, &supported, &active, &pcr_count);
+
if (err)
goto out;
- if (spec_event->number_of_algorithms > MAX_HASH_COUNT ||
- spec_event->number_of_algorithms < 1)
- goto out;
- for (i = 0; i < spec_event->number_of_algorithms; i++) {
+ for (i = 0; i < pcr_count; i++) {
u16 hash_alg = hash_algo_list[i].hash_alg;
u16 hash_len = hash_algo_list[i].hash_len;
- if (active && alg_to_mask(hash_alg)) {
+ if (active & alg_to_mask(hash_alg)) {
put_unaligned_le16(hash_alg,
- &spec_event->digest_sizes[i].algorithm_id);
+ &spec_event->digest_sizes[alg_count].algorithm_id);
put_unaligned_le16(hash_len,
- &spec_event->digest_sizes[i].digest_size);
+ &spec_event->digest_sizes[alg_count].digest_size);
+ alg_count++;
}
}
+
+ spec_event->number_of_algorithms = alg_count;
+ if (spec_event->number_of_algorithms > MAX_HASH_COUNT ||
+ spec_event->number_of_algorithms < 1)
+ goto out;
+
/*
* the size of the spec event and placement of vendor_info_size
* depends on supported algoriths
@@ -1169,9 +1175,9 @@ static efi_status_t create_specid_event(struct udevice *dev, void *buffer,
offsetof(struct tcg_efi_spec_id_event, digest_sizes) +
spec_event->number_of_algorithms * sizeof(spec_event->digest_sizes[0]);
/* no vendor info for us */
- memset(buffer + spec_event_size, 0,
- sizeof(spec_event->vendor_info_size));
- spec_event_size += sizeof(spec_event->vendor_info_size);
+ memset(buffer + spec_event_size, 0, 1);
+ /* add a byte for vendor_info_size in the spec event */
+ spec_event_size += 1;
*event_size = spec_event_size;
return EFI_SUCCESS;