Skip to content

Commit 1f25755

Browse files
committed
CRACEN: Avoid possible race-condition on exit_ikg
-This commit changes the previous behavior of release/acquire for exit_ikg by relying on recursive locking, which avoid touching the CRACEN ENABLE registers for asymmetric operations. ref: NCSDK-36349 Signed-off-by: Frank Audun Kvamtrø <[email protected]>
1 parent 92c43d7 commit 1f25755

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

subsys/nrf_security/src/drivers/cracen/cracenpsa/src/ikg_signature.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,15 @@ static int exit_ikg(struct sx_pk_acq_req *pkreq)
6363
{
6464

6565
int status;
66+
struct sx_pk_acq_req oldreq = *pkreq;
6667

67-
sx_pk_release_req(pkreq->req);
68+
/* Acquiring just before releasing ensures that there is at least one user
69+
* requesting asymmetric engine support. This is done to avoid powering
70+
* down CRACEN before ongoing operations have finalized. This relies on
71+
* recursive mutex locking.
72+
*/
6873
*pkreq = sx_pk_acquire_req(SX_PK_CMD_IK_EXIT);
74+
sx_pk_release_req(oldreq.req);
6975
pkreq->status = sx_pk_list_ik_inslots(pkreq->req, 0, NULL);
7076
if (pkreq->status) {
7177
return pkreq->status;

0 commit comments

Comments
 (0)