[PATCH v1 2/3] crypto/nitrox: use timing-safe salt comparison
Rupesh Chiluka <[email protected]> Mon, 3 Aug 2026 11:54:14 +0530
| Newsgroups | org.dpdk.dev |
|---|---|
| Message-ID | <ebf11972bee0d90f39191c8c8578a108cce75f43.1785737875.git.rchiluka@marvell.com> |
softreq_copy_salt() compared the session salt with the IV salt using memcmp(), which returns early on the first differing byte and can leak timing information about the salt value. Use rte_memeq_timingsafe() for the salt comparison. Bugzilla ID: 1773 Signed-off-by: Rupesh Chiluka <[email protected]> --- drivers/crypto/nitrox/nitrox_sym_reqmgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/nitrox/nitrox_sym_reqmgr.c b/drivers/crypto/nitrox/nitrox_sym_reqmgr.c index 7751c1a9fc..728c80b84f 100644 --- a/drivers/crypto/nitrox/nitrox_sym_reqmgr.c +++ b/drivers/crypto/nitrox/nitrox_sym_reqmgr.c @@ -684,7 +684,7 @@ softreq_copy_salt(struct nitrox_softreq *sr) } addr = rte_crypto_op_ctod_offset(sr->op, uint8_t *, ctx->iv.offset); - if (!memcmp(ctx->salt, addr, AES_GCM_SALT_SIZE)) + if (rte_memeq_timingsafe(ctx->salt, addr, AES_GCM_SALT_SIZE)) return 0; memcpy(ctx->salt, addr, AES_GCM_SALT_SIZE); -- 2.48.1