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

Reply via email to