DPE: Invalidate child context handle once used
Signed-off-by: Maulik Patel <maulik.patel@arm.com>
Change-Id: I0106ec07500bf8ae86ad5a125b7adc39e0278bfd
diff --git a/partitions/dice_protection_environment/dpe_context_mngr.c b/partitions/dice_protection_environment/dpe_context_mngr.c
index 3f00963..6823fd5 100644
--- a/partitions/dice_protection_environment/dpe_context_mngr.c
+++ b/partitions/dice_protection_environment/dpe_context_mngr.c
@@ -547,6 +547,9 @@
}
}
+ /* Renew nonce of child context so it cannot be used again */
+ child_ctx->nonce = INVALID_NONCE_VALUE;
+
if (allow_child_to_derive) {
/* Generate new handle for child for subsequent requests */
if (generate_new_handle(new_child_ctx_handle) != DPE_NO_ERROR) {
@@ -569,8 +572,6 @@
/* Tag this component as a leaf */
child_ctx->is_leaf = true;
invalidate_handle(new_child_ctx_handle);
- /* Renew nonce of child context so it cannot be used again */
- child_ctx->nonce = INVALID_NONCE_VALUE;
}
if (retain_parent_context) {