Skip to contentSkip to conversation

crypto/mvsam: set session params for AES-GCM mode

PATCH Applied [email protected] 2 participants 2 messages Jul 1, 2021 – Jul 7, 2021 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto/mvsam: set session params for AES-GCM mode

From: Dana Vardi <[email protected]>

For AEAD session and AES-GCM mode, IV offset will set to include the Nonce.
In addition, the following operations order will define:
first encryption and then authentication.

Fixes 8a61c83af2fa ("crypto/mrvl: add mrvl crypto driver")
---
 drivers/crypto/mvsam/rte_mrvl_pmd.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/crypto/mvsam/rte_mrvl_pmd.c +8 -0
index 9054210ce..d8e07e9c1 100644
@@ -361,6 +361,14 @@ mrvl_crypto_set_aead_session_parameters(struct mrvl_crypto_session *sess,
 	sess->sam_sess_params.cipher_mode =
 		aead_map[aead_xform->aead.algo].cipher_mode;
 
+	if (sess->sam_sess_params.cipher_mode == SAM_CIPHER_GCM) {
+		/* IV must include nonce for all counter modes */
+		sess->cipher_iv_offset = aead_xform->cipher.iv.offset;
+
+		/* Set order of authentication then encryption to 0 in GCM */
+		sess->sam_sess_params.u.basic.auth_then_encrypt = 0;
+	}
+
 	/* Assume IV will be passed together with data. */
 	sess->sam_sess_params.cipher_iv = NULL;
 
Signature · 1 line
2.17.1
Applied
#1 lore raw
Quoted 5 lines

For AEAD session and AES-GCM mode, IV offset will set to include the Nonce.
In addition, the following operations order will define:
first encryption and then authentication.

Quoted 7 lines
Fixes 8a61c83af2fa ("crypto/mrvl: add mrvl crypto driver")

---

Applied to dpdk-next-crypto

Thanks.