From 471c9895a630560561717067113e4c4d7127bb9f Mon Sep 17 00:00:00 2001 From: Tamas Ban Date: Mon, 3 Oct 2022 13:06:53 +0200 Subject: [PATCH] fix(psa): align with original API in tf-m-extras The measured boot API is available in the tf-m-extras repo: partitions/measured_boot/interface/src/measured_boot_api.c This change make the API behavior align with the original implementation. Signed-off-by: Tamas Ban Change-Id: Ie4af38b859f942b2ef090e92da64d75811b5b49b --- lib/psa/measured_boot.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/psa/measured_boot.c b/lib/psa/measured_boot.c index 90e4ef39d..3c54f4750 100644 --- a/lib/psa/measured_boot.c +++ b/lib/psa/measured_boot.c @@ -87,12 +87,11 @@ rss_measured_boot_extend_measurement(uint8_t index, {.base = measurement_value, .len = measurement_value_size} }; - uint32_t sw_type_size_limited; - if (sw_type != NULL) { - sw_type_size_limited = (sw_type_size < SW_TYPE_MAX_SIZE) ? - sw_type_size : SW_TYPE_MAX_SIZE; - memcpy(extend_iov.sw_type, sw_type, sw_type_size_limited); + if (sw_type_size > SW_TYPE_MAX_SIZE) { + return PSA_ERROR_INVALID_ARGUMENT; + } + memcpy(extend_iov.sw_type, sw_type, sw_type_size); } log_measurement(index, signer_id, signer_id_size, -- 2.39.5