[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/20] hw/virtio/virtio-nsm: Support string data for extendPCR
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 03/20] hw/virtio/virtio-nsm: Support string data for extendPCR |
Date: |
Sat, 14 Dec 2024 00:30:38 +0100 |
From: Dorjoy Chowdhury <dorjoychy111@gmail.com>
NSM device in AWS Nitro Enclaves supports extending with both
bytestring and string data.
Signed-off-by: Dorjoy Chowdhury <dorjoychy111@gmail.com>
Reviewed-by: Alexander Graf <graf@amazon.com>
Message-ID: <20241109123208.24281-1-dorjoychy111@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/virtio/virtio-nsm.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/hw/virtio/virtio-nsm.c b/hw/virtio/virtio-nsm.c
index a3db8eef3e4..6830fcfe17b 100644
--- a/hw/virtio/virtio-nsm.c
+++ b/hw/virtio/virtio-nsm.c
@@ -444,7 +444,7 @@ static bool handle_describe_pcr(VirtIONSM *vnsm, struct
iovec *request,
* key = String("index"),
* value = Uint8(pcr),
* key = String("data"),
- * value = Byte_String(data),
+ * value = Byte_String(data) || String(data),
* }
* }
* }
@@ -504,14 +504,21 @@ static enum NSMResponseTypes
get_nsm_extend_pcr_req(uint8_t *req, size_t len,
if (cbor_string_length(pair[i].key) == 4 &&
memcmp(str, "data", 4) == 0) {
- if (!cbor_isa_bytestring(pair[i].value)) {
+ if (cbor_isa_bytestring(pair[i].value)) {
+ str = cbor_bytestring_handle(pair[i].value);
+ if (!str) {
+ goto cleanup;
+ }
+ nsm_req->data_len = cbor_bytestring_length(pair[i].value);
+ } else if (cbor_isa_string(pair[i].value)) {
+ str = cbor_string_handle(pair[i].value);
+ if (!str) {
+ goto cleanup;
+ }
+ nsm_req->data_len = cbor_string_length(pair[i].value);
+ } else {
goto cleanup;
}
- str = cbor_bytestring_handle(pair[i].value);
- if (!str) {
- goto cleanup;
- }
- nsm_req->data_len = cbor_bytestring_length(pair[i].value);
/*
* nsm_req->data_len will be smaller than NSM_REQUEST_MAX_SIZE as
* we already check for the max request size before processing
--
2.45.2
- [PULL 00/20] Misc HW patches for 2024-12-14, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 01/20] docs/nitro-enclave: Fix terminal commands formatting, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 02/20] hw/core/eif: Use stateful qcrypto apis, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 03/20] hw/virtio/virtio-nsm: Support string data for extendPCR,
Philippe Mathieu-Daudé <=
- [PULL 04/20] hw/riscv/virt: Remove pointless GPEX_HOST() cast, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 06/20] hw/nvram/fw_cfg: Pass QOM parent to fw_cfg_add_file_from_generator(), Philippe Mathieu-Daudé, 2024/12/13
- [PULL 07/20] hw/nvram/fw_cfg: Skip FW_CFG_DATA_GENERATOR when no data to generate, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 05/20] hw/nvram/fw_cfg: Rename fw_cfg_add_[file]_from_generator(), Philippe Mathieu-Daudé, 2024/12/13
- [PULL 08/20] hw/pci: Have PCI_BUS implement TYPE_FW_CFG_DATA_GENERATOR_INTERFACE, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 10/20] hw: Use pci_bus_add_fw_cfg_extra_pci_roots(), Philippe Mathieu-Daudé, 2024/12/13
- [PULL 09/20] hw/pci: Add pci_bus_add_fw_cfg_extra_pci_roots() helper, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 12/20] hw/net/can: clean-up unnecessary includes, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 15/20] hw/usb/hcd-xhci-pci: Indentation fix, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 11/20] hw/nvram/fw_cfg: Remove fw_cfg_add_extra_pci_roots(), Philippe Mathieu-Daudé, 2024/12/13