Skip to content

Commit

Permalink
crypto/ipsec_mb: fix incorrectly setting cipher keys
Browse files Browse the repository at this point in the history
The encryption and decryption keys were incorrectly being reset based on
authentication algorithm after already being set earlier in the code
based on cipher algorithm.
In cases when 3DES was used, the keys were being
incorrectly overwritten.

For CPU path, there is no need to have the keys set for XCBC and CMAC
cases.

Fixes: 010230a ("crypto/aesni_mb: support Chacha20-Poly1305")
Fixes: b0a37e8 ("crypto/ipsec_mb: fix cipher key setting")
Fixes: a2c6d3f ("crypto/aesni_mb: support CPU crypto")

Signed-off-by: Ciara Power <[email protected]>
Acked-by: Luca Boccassi <[email protected]>
  • Loading branch information
ciarapow authored and bluca committed Apr 10, 2024
1 parent 28d7ed2 commit 83a31ef
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions drivers/crypto/ipsec_mb/pmd_aesni_mb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,9 +1017,6 @@ set_cpu_mb_job_params(IMB_JOB *job, struct aesni_mb_session *session,
job->u.XCBC._k1_expanded = session->auth.xcbc.k1_expanded;
job->u.XCBC._k2 = session->auth.xcbc.k2;
job->u.XCBC._k3 = session->auth.xcbc.k3;

job->enc_keys = session->cipher.expanded_aes_keys.encode;
job->dec_keys = session->cipher.expanded_aes_keys.decode;
break;

case IMB_AUTH_AES_CCM:
Expand All @@ -1034,8 +1031,6 @@ set_cpu_mb_job_params(IMB_JOB *job, struct aesni_mb_session *session,
job->u.CMAC._key_expanded = session->auth.cmac.expkey;
job->u.CMAC._skey1 = session->auth.cmac.skey1;
job->u.CMAC._skey2 = session->auth.cmac.skey2;
job->enc_keys = session->cipher.expanded_aes_keys.encode;
job->dec_keys = session->cipher.expanded_aes_keys.decode;
break;

case IMB_AUTH_AES_GMAC:
Expand Down Expand Up @@ -1331,24 +1326,17 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp,
job->u.XCBC._k1_expanded = session->auth.xcbc.k1_expanded;
job->u.XCBC._k2 = session->auth.xcbc.k2;
job->u.XCBC._k3 = session->auth.xcbc.k3;

job->enc_keys = session->cipher.expanded_aes_keys.encode;
job->dec_keys = session->cipher.expanded_aes_keys.decode;
break;

case IMB_AUTH_AES_CCM:
job->u.CCM.aad = op->sym->aead.aad.data + 18;
job->u.CCM.aad_len_in_bytes = session->aead.aad_len;
job->enc_keys = session->cipher.expanded_aes_keys.encode;
job->dec_keys = session->cipher.expanded_aes_keys.decode;
break;

case IMB_AUTH_AES_CMAC:
job->u.CMAC._key_expanded = session->auth.cmac.expkey;
job->u.CMAC._skey1 = session->auth.cmac.skey1;
job->u.CMAC._skey2 = session->auth.cmac.skey2;
job->enc_keys = session->cipher.expanded_aes_keys.encode;
job->dec_keys = session->cipher.expanded_aes_keys.decode;
break;

case IMB_AUTH_AES_GMAC:
Expand Down Expand Up @@ -1396,8 +1384,6 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp,
job->cipher_mode = IMB_CIPHER_CHACHA20_POLY1305_SGL;
job->hash_alg = IMB_AUTH_CHACHA20_POLY1305_SGL;
}
job->enc_keys = session->cipher.expanded_aes_keys.encode;
job->dec_keys = session->cipher.expanded_aes_keys.encode;
break;
default:
job->u.HMAC._hashed_auth_key_xor_ipad =
Expand Down

0 comments on commit 83a31ef

Please sign in to comment.