[dpdk-dev] [PATCH 1/3] crypto/aesni_gcm: move pre-counter block to GCM driver

Arek Kusztal arkadiuszx.kusztal at intel.com
Thu Aug 25 14:02:41 CEST 2016


This patch moves computing of pre-counter block into the AESNI-GCM
driver so it can be moved from test files.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal at intel.com>
---
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index dc0b033..d8b6287 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -230,11 +230,16 @@ process_gcm_crypto_op(struct aesni_gcm_qp *qp, struct rte_crypto_sym_op *op,
 					op->cipher.data.offset);
 
 	/* sanity checks */
-	if (op->cipher.iv.length != 16 && op->cipher.iv.length != 0) {
+	if (op->cipher.iv.length != 16 && op->cipher.iv.length != 12 &&
+			op->cipher.iv.length != 0) {
 		GCM_LOG_ERR("iv");
 		return -1;
 	}
 
+	if (op->cipher.iv.length == 12) {
+		op->cipher.iv.data[15] = 1;
+	}
+
 	if (op->auth.aad.length != 12 && op->auth.aad.length != 8 &&
 			op->auth.aad.length != 0) {
 		GCM_LOG_ERR("iv");
-- 
2.1.0



More information about the dev mailing list