[v2,3/8] crypto/octeontx: set session private data

Message ID 1593754904-1264-3-git-send-email-adwivedi@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series [v2,1/8] common/cpt: fix encryption offset |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Ankur Dwivedi July 3, 2020, 5:41 a.m. UTC
  This patch sets the first 32 bytes of session private data
to zero. This prevents garbage data to be used in code logic.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 drivers/crypto/octeontx/otx_cryptodev_ops.c | 3 +++
 1 file changed, 3 insertions(+)
  

Patch

diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 265e10e..8f58fe2 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -252,6 +252,9 @@ 
 		return -ENOMEM;
 	}
 
+	memset(priv, 0, sizeof(struct cpt_sess_misc) +
+			offsetof(struct cpt_ctx, fctx));
+
 	misc = priv;
 
 	for ( ; xform != NULL; xform = xform->next) {