mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
hw/virtio/virtio-nsm: Support string data for extendPCR
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>
This commit is contained in:
parent
5b86ddd83d
commit
d4ee9a113e
1 changed files with 14 additions and 7 deletions
|
@ -444,7 +444,7 @@ static bool handle_describe_pcr(VirtIONSM *vnsm, struct iovec *request,
|
||||||
* key = String("index"),
|
* key = String("index"),
|
||||||
* value = Uint8(pcr),
|
* value = Uint8(pcr),
|
||||||
* key = String("data"),
|
* 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 &&
|
if (cbor_string_length(pair[i].key) == 4 &&
|
||||||
memcmp(str, "data", 4) == 0) {
|
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;
|
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
|
* nsm_req->data_len will be smaller than NSM_REQUEST_MAX_SIZE as
|
||||||
* we already check for the max request size before processing
|
* we already check for the max request size before processing
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue