AES GCM, AES CMAC fixes and addition of GCM tests for QAT.
cover AES GCM, AES CMAC fixes and addition of GCM tests for QAT.
This patchset solves an issue in QAT driver, that was giving invalid AES GCM results, due to incorrect IV setting.
It adds unit tests to validate AES GCM in QAT.
It also fixes the premature addition of AES CMAC support which was added to the code in error. AES CMAC will be added in a subsequent release when testing completes.
AES CMAC was not advertised in the qat documentation.
This patchset depends on patches:
- aesni_gcm: PMD to support AES_GCM crypto operations
(http://dpdk.org/dev/patchwork/patch/11201/)
John Griffin (3):
qat: fix AES GCM decryption
app/test: add AES GCM tests for QAT
qat: fixes premature addition of AES_CMAC in session
app/test/test_cryptodev.c | 34 +++++++++++++++++++++++++++++++++- doc/guides/cryptodevs/qat.rst | 1 + doc/guides/rel_notes/release_16_04.rst | 5 +++++ drivers/crypto/qat/qat_crypto.c | 24 ++++++++++++++++++++---- 4 files changed, 59 insertions(+), 5 deletions(-)
Signature · 1 line
2.1.0
PATCH 1/3 qat: fix AES GCM decryption
AES GCM on the cryptodev API was giving invalid results in some cases, due to an incorrect IV setting.
Added AES GCM in the QAT supported algorithms,
as encryption/decryption is fully functional.
--- doc/guides/cryptodevs/qat.rst | 1 + doc/guides/rel_notes/release_16_04.rst | 5 +++++ drivers/crypto/qat/qat_crypto.c | 22 +++++++++++++++++++--- 3 files changed, 25 insertions(+), 3 deletions(-)
doc/guides/cryptodevs/qat.rst +1 -0
@@ -48,6 +48,7 @@ Cipher algorithms: * ``RTE_CRYPTO_SYM_CIPHER_AES192_CBC`` * ``RTE_CRYPTO_SYM_CIPHER_AES256_CBC`` * ``RTE_CRYPTO_SYM_CIPHER_SNOW3G_UEA2`` +* ``RTE_CRYPTO_CIPHER_AES_GCM`` Hash algorithms:
doc/guides/rel_notes/release_16_04.rst +5 -0
@@ -99,6 +99,11 @@ Drivers This made impossible the creation of more than one aesni_mb device from command line. +* **qat: Fixed AES GCM decryption.** + + Allowed AES GCM on the cryptodev API, but in some cases gave invalid results + due to incorrect IV setting. + Libraries ~~~~~~~~~
drivers/crypto/qat/qat_crypto.c +19 -3
@@ -529,11 +529,27 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) auth_param->u1.aad_adr = op->sym->auth.aad.phys_addr;/* (GCM) aad length(240 max) will be at this location after precompute */ if (ctx->qat_hash_alg ==ICP_QAT_HW_AUTH_ALGO_GALOIS_128 || - ctx->qat_hash_alg ==ICP_QAT_HW_AUTH_ALGO_GALOIS_64 ) { - auth_param->u2.aad_sz = -ALIGN_POW2_ROUNDUP (ctx->cd.hash.sha.state1[ + ctx->qat_hash_alg ==ICP_QAT_HW_AUTH_ALGO_GALOIS_64 ) { +struct icp_qat_hw_auth_algo_blk *hash; + +if (ctx->qat_cmd ==ICP_QAT_FW_LA_CMD_HASH_CIPHER ) + hash = (struct icp_qat_hw_auth_algo_blk *)((char *)&ctx->cd); +else + hash = (struct icp_qat_hw_auth_algo_blk *)((char *)&ctx->cd + +sizeof (struct icp_qat_hw_cipher_algo_blk )); + + auth_param->u2.aad_sz =ALIGN_POW2_ROUNDUP (hash->sha.state1[ICP_QAT_HW_GALOIS_128_STATE1_SZ +ICP_QAT_HW_GALOIS_H_SZ +3 ],16 ); +if (op->sym->cipher.iv.length ==12 ) { +/* +* For GCM a 12 bit IV is allowed, +* but we need to inform the f/w +*/ +ICP_QAT_FW_LA_GCM_IV_LEN_FLAG_SET ( + qat_req->comn_hdr.serv_specif_flags, +ICP_QAT_FW_LA_GCM_IV_LEN_12_OCTETS ); + } } auth_param->hash_state_sz = (auth_param->u2.aad_sz) >>3 ;
Signature · 1 line
2.1.0
PATCH 2/3 app/test: add AES GCM tests for QAT
In reply to John Griffin--- app/test/test_cryptodev.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
app/test/test_cryptodev.c +33 -1
@@ -3420,6 +3420,39 @@ static struct unit_test_suite cryptodev_qat_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_AES_CBC_HMAC_AES_XCBC_decrypt_digest_verify),TEST_CASE_ST (ut_setup, ut_teardown, test_stats), + +/** AES GCM Authenticated Encryption */ +TEST_CASE_ST (ut_setup, ut_teardown, + test_mb_AES_GCM_authenticated_encryption_test_case_1), +TEST_CASE_ST (ut_setup, ut_teardown, + test_mb_AES_GCM_authenticated_encryption_test_case_2), +TEST_CASE_ST (ut_setup, ut_teardown, + test_mb_AES_GCM_authenticated_encryption_test_case_3), +TEST_CASE_ST (ut_setup, ut_teardown, + test_mb_AES_GCM_authenticated_encryption_test_case_4), +TEST_CASE_ST (ut_setup, ut_teardown, + test_mb_AES_GCM_authenticated_encryption_test_case_5), +TEST_CASE_ST (ut_setup, ut_teardown, + test_mb_AES_GCM_authenticated_encryption_test_case_6), +TEST_CASE_ST (ut_setup, ut_teardown, + test_mb_AES_GCM_authenticated_encryption_test_case_7), + +/** AES GCM Authenticated Decryption */ +TEST_CASE_ST (ut_setup, ut_teardown, + test_mb_AES_GCM_authenticated_decryption_test_case_1), +TEST_CASE_ST (ut_setup, ut_teardown, + test_mb_AES_GCM_authenticated_decryption_test_case_2), +TEST_CASE_ST (ut_setup, ut_teardown, + test_mb_AES_GCM_authenticated_decryption_test_case_3), +TEST_CASE_ST (ut_setup, ut_teardown, + test_mb_AES_GCM_authenticated_decryption_test_case_4), +TEST_CASE_ST (ut_setup, ut_teardown, + test_mb_AES_GCM_authenticated_decryption_test_case_5), +TEST_CASE_ST (ut_setup, ut_teardown, + test_mb_AES_GCM_authenticated_decryption_test_case_6), +TEST_CASE_ST (ut_setup, ut_teardown, + test_mb_AES_GCM_authenticated_decryption_test_case_7), +/** Snow3G encrypt only (UEA2) */ TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_encryption_test_case_1),
@@ -3432,7 +3465,6 @@ static struct unit_test_suite cryptodev_qat_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_encryption_test_case_5), -/** Snow3G decrypt only (UEA2) */ TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_decryption_test_case_1),
Signature · 1 line
2.1.0
PATCH 3/3 qat: fixes premature addition of AES_CMAC in session creation
In reply to John GriffinRemove support for AES CMAC support for which was added to the code in error. AES CMAC will be added in a subsequent release when testing completes.
--- drivers/crypto/qat/qat_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qat/qat_crypto.c +1 -1
@@ -295,7 +295,6 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev, session->qat_hash_alg =ICP_QAT_HW_AUTH_ALGO_AES_XCBC_MAC ;break ;case RTE_CRYPTO_AUTH_AES_GCM : -case RTE_CRYPTO_AUTH_AES_GMAC : session->qat_hash_alg =ICP_QAT_HW_AUTH_ALGO_GALOIS_128 ;break ;case RTE_CRYPTO_AUTH_SNOW3G_UIA2 :
@@ -312,6 +311,7 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,case RTE_CRYPTO_AUTH_MD5 :case RTE_CRYPTO_AUTH_MD5_HMAC :case RTE_CRYPTO_AUTH_AES_CCM : +case RTE_CRYPTO_AUTH_AES_GMAC :case RTE_CRYPTO_AUTH_KASUMI_F9 :case RTE_CRYPTO_AUTH_AES_CMAC :case RTE_CRYPTO_AUTH_AES_CBC_MAC :
Signature · 1 line
2.1.0
Re: [PATCH 3/3] qat: fixes premature addition of AES_CMAC in session creation
2016-03-08 16:22, John Griffin:
Quoted 3 lines
Remove support for AES CMAC support for which was added to the code in error. AES CMAC will be added in a subsequent release when testing completes.
[...]
drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev, · line 298
Quoted 2 lines
drivers/crypto/qat/qat_crypto.c +0
-1case RTE_CRYPTO_AUTH_AES_GCM : -case RTE_CRYPTO_AUTH_AES_GMAC :
CMAC or GMAC?
drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev, · line 314
Quoted 8 lines
drivers/crypto/qat/qat_crypto.c +1
-0session->qat_hash_alg =ICP_QAT_HW_AUTH_ALGO_GALOIS_128 ;break ;case RTE_CRYPTO_AUTH_SNOW3G_UIA2 :@@ -312,6 +311,7 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,case RTE_CRYPTO_AUTH_MD5 :case RTE_CRYPTO_AUTH_MD5_HMAC :case RTE_CRYPTO_AUTH_AES_CCM : +case RTE_CRYPTO_AUTH_AES_GMAC :
So it is added? What should we have later?
Re: [PATCH 3/3] qat: fixes premature addition of AES_CMAC in session creation
Quoted 11 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Friday, March 11, 2016 12:17 AM
To: Griffin, John
Cc: [email protected]; De Lara Guarch, Pablo
Subject: Re: [dpdk-dev] [PATCH 3/3] qat: fixes premature addition ofAES_CMACin session creation2016-03-08 16:22, John Griffin:
Quoted 8 lines
Quoted 3 lines
Remove support for AES CMAC support for which was added to the code in error. AES CMAC will be added in a subsequent release when testing completes.
[...]
drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev, · line 298
Quoted 2 lines
drivers/crypto/qat/qat_crypto.c +0
-1case RTE_CRYPTO_AUTH_AES_GCM : -case RTE_CRYPTO_AUTH_AES_GMAC :CMAC or GMAC?
It is AES_GMAC, I commented that title was wrong.
Quoted 13 lines
Quoted 2 lines
session->qat_hash_alg=
ICP_QAT_HW_AUTH_ALGO_GALOIS_128;drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session_auth(struct
Quoted 3 lines
drivers/crypto/qat/qat_crypto.c +0
-0break ;case RTE_CRYPTO_AUTH_SNOW3G_UIA2 :@@ -312,6 +311,7 @@ qat_crypto_sym_configure_session_auth(struct
rte_cryptodev*dev,drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev, · line 314
Quoted 4 lines
drivers/crypto/qat/qat_crypto.c +1
-0case RTE_CRYPTO_AUTH_MD5 :case RTE_CRYPTO_AUTH_MD5_HMAC :case RTE_CRYPTO_AUTH_AES_CCM : +case RTE_CRYPTO_AUTH_AES_GMAC :So it is added? What should we have later?
Re: [PATCH 3/3] qat: fixes premature addition of AES_CMAC in session creation
In reply to Thomas MonjalonQuoted 9 lines · Thomas Monjalon
2016-03-08 16:22, John Griffin:
Quoted 3 lines
Remove support for AES CMAC support for which was added to the code in error. AES CMAC will be added in a subsequent release when testing completes.
[...]
drivers/crypto/qat/qat_crypto.c qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev, · line 298
Quoted 2 lines
case
RTE_CRYPTO_AUTH_AES_GCM:drivers/crypto/qat/qat_crypto.c +0
-1-case RTE_CRYPTO_AUTH_AES_GMAC :CMAC or GMAC?
Yes GMAC - thanks Pablo and Thomas.
Quoted 36 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of John Griffin
Sent: Tuesday, March 08, 2016 4:22 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH 0/3] AES GCM, AES CMAC fixes and addition of GCM tests for QAT.This patchset solves an issue in QAT driver, that was giving invalid AES GCM results, due to incorrect IV setting.
It adds unit tests to validate AES GCM in QAT.
It also fixes the premature addition of AES CMAC support which was added to
the code in error. AES CMAC will be added in a subsequent release when testing completes.
AES CMAC was not advertised in the qat documentation.This patchset depends on patches:
-aesni_gcm: PMD to supportAES_GCMcrypto operations
(http://dpdk.org/dev/patchwork/patch/11201/)John Griffin (3):
qat: fix AES GCM decryption
app/test: add AES GCM tests for QAT
qat: fixes premature addition ofAES_CMACin sessionapp/test/test_cryptodev.c | 34 +++++++++++++++++++++++++++++++++- doc/guides/cryptodevs/qat.rst | 1 + doc/guides/rel_notes/release_16_04.rst | 5 +++++ drivers/crypto/qat/qat_crypto.c | 24 ++++++++++++++++++++---- 4 files changed, 59 insertions(+), 5 deletions(-)
Quoted 2 lines
--
2.1.0
Just a small comment: there is a type in the title of last patch, It should be "premature addition of AES_GMAC in session"
Thomas Monjalon
AppliedQuoted 9 lines
Quoted 4 lines
John Griffin (3):
qat: fix AES GCM decryption
app/test: add AES GCM tests for QAT
qat: fixes premature addition ofAES_CMACin sessionSeries-acked-by Pablo de Lara <[email protected]>Just a small comment: there is a type in the title of last patch, It should be "premature addition of
AES_GMACin session"
Applied, thanks