* [dpdk-dev] [PATCH v1] crypto/qat: add support for 8 byte 3DES
@ 2018-06-12 10:39 Kovacevic, Marko
2018-06-13 16:15 ` Trahe, Fiona
2018-07-04 10:20 ` [dpdk-dev] [PATCH v2] " Kovacevic, Marko
0 siblings, 2 replies; 6+ messages in thread
From: Kovacevic, Marko @ 2018-06-12 10:39 UTC (permalink / raw)
To: dev; +Cc: pablo.de.lara.guarch, deepak.k.jain, Kovacevic, Marko, Marko
Added extra case to support 8 byte key size
for 3DES CBC. Also changed capabilities to reflect
the change.
Signed-off-by: Marko, Kovacevic <marko.kovacevic@intel.com>
---
drivers/crypto/qat/qat_adf/qat_algs.h | 1 +
drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 1 +
drivers/crypto/qat/qat_crypto_capabilities.h | 2 +-
test/test/test_cryptodev_des_test_vectors.h | 6 ++++--
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h
index 88bd5f00e..a3a3545ef 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs.h
+++ b/drivers/crypto/qat/qat_adf/qat_algs.h
@@ -21,6 +21,7 @@
/* 3DES key sizes */
#define QAT_3DES_KEY_SZ_OPT1 24 /* Keys are independent */
#define QAT_3DES_KEY_SZ_OPT2 16 /* K3=K1 */
+#define QAT_3DES_KEY_SZ_OPT3 8 /* K1=K2=K3 */
#define QAT_AES_HW_CONFIG_CBC_ENC(alg) \
ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_CBC_MODE, alg, \
diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
index c87ed40fe..e89858d22 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
+++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
@@ -994,6 +994,7 @@ int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
switch (key_len) {
case QAT_3DES_KEY_SZ_OPT1:
case QAT_3DES_KEY_SZ_OPT2:
+ case QAT_3DES_KEY_SZ_OPT3:
*alg = ICP_QAT_HW_CIPHER_ALGO_3DES;
break;
default:
diff --git a/drivers/crypto/qat/qat_crypto_capabilities.h b/drivers/crypto/qat/qat_crypto_capabilities.h
index 001c32c5d..1d6110970 100644
--- a/drivers/crypto/qat/qat_crypto_capabilities.h
+++ b/drivers/crypto/qat/qat_crypto_capabilities.h
@@ -434,7 +434,7 @@
.algo = RTE_CRYPTO_CIPHER_3DES_CBC, \
.block_size = 8, \
.key_size = { \
- .min = 16, \
+ .min = 8, \
.max = 24, \
.increment = 8 \
}, \
diff --git a/test/test/test_cryptodev_des_test_vectors.h b/test/test/test_cryptodev_des_test_vectors.h
index 7479e70f0..103345605 100644
--- a/test/test/test_cryptodev_des_test_vectors.h
+++ b/test/test/test_cryptodev_des_test_vectors.h
@@ -1233,14 +1233,16 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = {
.test_data = &triple_des64cbc_test_vector,
.op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
+ BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "3DES-64-CBC Decryption",
.test_data = &triple_des64cbc_test_vector,
.op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
+ BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "3DES-128-CBC Encryption",
--
2.13.6
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v1] crypto/qat: add support for 8 byte 3DES
2018-06-12 10:39 [dpdk-dev] [PATCH v1] crypto/qat: add support for 8 byte 3DES Kovacevic, Marko
@ 2018-06-13 16:15 ` Trahe, Fiona
2018-07-04 10:20 ` [dpdk-dev] [PATCH v2] " Kovacevic, Marko
1 sibling, 0 replies; 6+ messages in thread
From: Trahe, Fiona @ 2018-06-13 16:15 UTC (permalink / raw)
To: Kovacevic, Marko, dev; +Cc: De Lara Guarch, Pablo, Jain, Deepak K, Trahe, Fiona
Hi Marko,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Kovacevic, Marko
> Sent: Tuesday, June 12, 2018 11:40 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Jain, Deepak K
> <deepak.k.jain@intel.com>; Kovacevic, Marko <marko.kovacevic@intel.com>; Marko@dpdk.org
> Subject: [dpdk-dev] [PATCH v1] crypto/qat: add support for 8 byte 3DES
>
> Added extra case to support 8 byte key size
> for 3DES CBC. Also changed capabilities to reflect
> the change.
>
> Signed-off-by: Marko, Kovacevic <marko.kovacevic@intel.com>
> ---
> drivers/crypto/qat/qat_adf/qat_algs.h | 1 +
> drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 1 +
> drivers/crypto/qat/qat_crypto_capabilities.h | 2 +-
> test/test/test_cryptodev_des_test_vectors.h | 6 ++++--
> 4 files changed, 7 insertions(+), 3 deletions(-)
This piece of QAT code should also be modified to copy K1 to K2 and K3:
if ((cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES)
&& (cipherkeylen == QAT_3DES_KEY_SZ_OPT2))
/* K3 not provided so use K1 = K3*/
memcpy(cdesc->cd_cur_ptr, cipherkey, padding_size);
else
memset(cdesc->cd_cur_ptr, 0, padding_size);
cdesc->cd_cur_ptr += padding_size;
I can see from the testcode added in the aesni_mb patch, that the test vector output
(ciphertext512_des) is the same as for plain DES. So as QAT would pad with 0s, this probably
explains why the tests are passing. But I can't see how the test can pass on aesni_mb
as K1 is being correctly copied there. I must be missing something?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v2] crypto/qat: add support for 8 byte 3DES
2018-06-12 10:39 [dpdk-dev] [PATCH v1] crypto/qat: add support for 8 byte 3DES Kovacevic, Marko
2018-06-13 16:15 ` Trahe, Fiona
@ 2018-07-04 10:20 ` Kovacevic, Marko
2018-07-20 18:49 ` [dpdk-dev] [PATCH v3] " Fiona Trahe
1 sibling, 1 reply; 6+ messages in thread
From: Kovacevic, Marko @ 2018-07-04 10:20 UTC (permalink / raw)
To: dev; +Cc: fiona.trahe, pablo.de.lara.guarch, Kovacevic, Marko
Added extra case to support 8 byte key size
for 3DES CBC. Also changed capabilities to reflect
the change.
Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
---
V2: Fixed implementation (Fiona)
---
drivers/crypto/qat/qat_adf/qat_algs.h | 1 +
drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 15 ++++++++++++---
drivers/crypto/qat/qat_crypto_capabilities.h | 2 +-
test/test/test_cryptodev_des_test_vectors.h | 6 ++++--
4 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h
index 88bd5f0..a3a3545 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs.h
+++ b/drivers/crypto/qat/qat_adf/qat_algs.h
@@ -21,6 +21,7 @@
/* 3DES key sizes */
#define QAT_3DES_KEY_SZ_OPT1 24 /* Keys are independent */
#define QAT_3DES_KEY_SZ_OPT2 16 /* K3=K1 */
+#define QAT_3DES_KEY_SZ_OPT3 8 /* K1=K2=K3 */
#define QAT_AES_HW_CONFIG_CBC_ENC(alg) \
ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_CBC_MODE, alg, \
diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
index c87ed40..f8b3ec7 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
+++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
@@ -8,7 +8,6 @@
#include <rte_log.h>
#include <rte_malloc.h>
#include <rte_crypto_sym.h>
-
#include "../qat_logs.h"
#include <openssl/sha.h> /* Needed to calculate pre-compute values */
@@ -618,11 +617,20 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc,
if (total_key_size > cipherkeylen) {
uint32_t padding_size = total_key_size-cipherkeylen;
if ((cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES)
- && (cipherkeylen == QAT_3DES_KEY_SZ_OPT2))
+ && (cipherkeylen == QAT_3DES_KEY_SZ_OPT2)) {
/* K3 not provided so use K1 = K3*/
memcpy(cdesc->cd_cur_ptr, cipherkey, padding_size);
- else
+
+ } else if ((cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES)
+ && (cipherkeylen == QAT_3DES_KEY_SZ_OPT3)) {
+ /* K2 and K3 not provided so use K1 = K2 = K3*/
+ memcpy(cdesc->cd_cur_ptr, cipherkey,
+ cipherkeylen);
+ memcpy(cdesc->cd_cur_ptr+cipherkeylen,
+ cipherkey, cipherkeylen);
+ } else
memset(cdesc->cd_cur_ptr, 0, padding_size);
+
cdesc->cd_cur_ptr += padding_size;
}
cd_size = cdesc->cd_cur_ptr-(uint8_t *)&cdesc->cd;
@@ -994,6 +1002,7 @@ int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
switch (key_len) {
case QAT_3DES_KEY_SZ_OPT1:
case QAT_3DES_KEY_SZ_OPT2:
+ case QAT_3DES_KEY_SZ_OPT3:
*alg = ICP_QAT_HW_CIPHER_ALGO_3DES;
break;
default:
diff --git a/drivers/crypto/qat/qat_crypto_capabilities.h b/drivers/crypto/qat/qat_crypto_capabilities.h
index 001c32c..1d61109 100644
--- a/drivers/crypto/qat/qat_crypto_capabilities.h
+++ b/drivers/crypto/qat/qat_crypto_capabilities.h
@@ -434,7 +434,7 @@
.algo = RTE_CRYPTO_CIPHER_3DES_CBC, \
.block_size = 8, \
.key_size = { \
- .min = 16, \
+ .min = 8, \
.max = 24, \
.increment = 8 \
}, \
diff --git a/test/test/test_cryptodev_des_test_vectors.h b/test/test/test_cryptodev_des_test_vectors.h
index 7479e70..1033456 100644
--- a/test/test/test_cryptodev_des_test_vectors.h
+++ b/test/test/test_cryptodev_des_test_vectors.h
@@ -1233,14 +1233,16 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = {
.test_data = &triple_des64cbc_test_vector,
.op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
+ BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "3DES-64-CBC Decryption",
.test_data = &triple_des64cbc_test_vector,
.op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
+ BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "3DES-128-CBC Encryption",
--
2.9.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v3] crypto/qat: add support for 8 byte 3DES
2018-07-04 10:20 ` [dpdk-dev] [PATCH v2] " Kovacevic, Marko
@ 2018-07-20 18:49 ` Fiona Trahe
2018-07-23 8:55 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 6+ messages in thread
From: Fiona Trahe @ 2018-07-20 18:49 UTC (permalink / raw)
To: dev; +Cc: pablo.de.lara.guarch, fiona.trahe, marko.kovacevic
Added extra case to support 8 byte key size
for 3DES CBC. Also changed capabilities to reflect
the change.
Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
---
v3: rebased against QAT refactored code.
v2: Fixed implementation (Fiona)
drivers/crypto/qat/qat_sym_capabilities.h | 2 +-
drivers/crypto/qat/qat_sym_session.c | 13 +++++++++++--
drivers/crypto/qat/qat_sym_session.h | 2 ++
test/test/test_cryptodev_des_test_vectors.h | 6 ++++--
4 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/drivers/crypto/qat/qat_sym_capabilities.h b/drivers/crypto/qat/qat_sym_capabilities.h
index d10a95e..eea08bc 100644
--- a/drivers/crypto/qat/qat_sym_capabilities.h
+++ b/drivers/crypto/qat/qat_sym_capabilities.h
@@ -434,7 +434,7 @@
.algo = RTE_CRYPTO_CIPHER_3DES_CBC, \
.block_size = 8, \
.key_size = { \
- .min = 16, \
+ .min = 8, \
.max = 24, \
.increment = 8 \
}, \
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index 4d975ae..1d58220 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -1322,11 +1322,19 @@ int qat_sym_session_aead_create_cd_cipher(struct qat_sym_session *cdesc,
if (total_key_size > cipherkeylen) {
uint32_t padding_size = total_key_size-cipherkeylen;
if ((cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES)
- && (cipherkeylen == QAT_3DES_KEY_SZ_OPT2))
+ && (cipherkeylen == QAT_3DES_KEY_SZ_OPT2)) {
/* K3 not provided so use K1 = K3*/
memcpy(cdesc->cd_cur_ptr, cipherkey, padding_size);
- else
+ } else if ((cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES)
+ && (cipherkeylen == QAT_3DES_KEY_SZ_OPT3)) {
+ /* K2 and K3 not provided so use K1 = K2 = K3*/
+ memcpy(cdesc->cd_cur_ptr, cipherkey,
+ cipherkeylen);
+ memcpy(cdesc->cd_cur_ptr+cipherkeylen,
+ cipherkey, cipherkeylen);
+ } else
memset(cdesc->cd_cur_ptr, 0, padding_size);
+
cdesc->cd_cur_ptr += padding_size;
}
cd_size = cdesc->cd_cur_ptr-(uint8_t *)&cdesc->cd;
@@ -1695,6 +1703,7 @@ int qat_sym_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
switch (key_len) {
case QAT_3DES_KEY_SZ_OPT1:
case QAT_3DES_KEY_SZ_OPT2:
+ case QAT_3DES_KEY_SZ_OPT3:
*alg = ICP_QAT_HW_CIPHER_ALGO_3DES;
break;
default:
diff --git a/drivers/crypto/qat/qat_sym_session.h b/drivers/crypto/qat/qat_sym_session.h
index 18d77e9..e8f51e5 100644
--- a/drivers/crypto/qat/qat_sym_session.h
+++ b/drivers/crypto/qat/qat_sym_session.h
@@ -23,6 +23,8 @@
/* 3DES key sizes */
#define QAT_3DES_KEY_SZ_OPT1 24 /* Keys are independent */
#define QAT_3DES_KEY_SZ_OPT2 16 /* K3=K1 */
+#define QAT_3DES_KEY_SZ_OPT3 8 /* K1=K2=K3 */
+
#define QAT_AES_HW_CONFIG_CBC_ENC(alg) \
ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_CBC_MODE, alg, \
diff --git a/test/test/test_cryptodev_des_test_vectors.h b/test/test/test_cryptodev_des_test_vectors.h
index 7479e70..1033456 100644
--- a/test/test/test_cryptodev_des_test_vectors.h
+++ b/test/test/test_cryptodev_des_test_vectors.h
@@ -1233,14 +1233,16 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = {
.test_data = &triple_des64cbc_test_vector,
.op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
+ BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "3DES-64-CBC Decryption",
.test_data = &triple_des64cbc_test_vector,
.op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
- BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
+ BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
},
{
.test_descr = "3DES-128-CBC Encryption",
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v3] crypto/qat: add support for 8 byte 3DES
2018-07-20 18:49 ` [dpdk-dev] [PATCH v3] " Fiona Trahe
@ 2018-07-23 8:55 ` De Lara Guarch, Pablo
2018-07-23 8:56 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 6+ messages in thread
From: De Lara Guarch, Pablo @ 2018-07-23 8:55 UTC (permalink / raw)
To: Trahe, Fiona, dev; +Cc: Kovacevic, Marko
> -----Original Message-----
> From: Trahe, Fiona
> Sent: Friday, July 20, 2018 7:49 PM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Trahe, Fiona
> <fiona.trahe@intel.com>; Kovacevic, Marko <marko.kovacevic@intel.com>
> Subject: [PATCH v3] crypto/qat: add support for 8 byte 3DES
>
> Added extra case to support 8 byte key size for 3DES CBC. Also changed
> capabilities to reflect the change.
>
> Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
> Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v3] crypto/qat: add support for 8 byte 3DES
2018-07-23 8:55 ` De Lara Guarch, Pablo
@ 2018-07-23 8:56 ` De Lara Guarch, Pablo
0 siblings, 0 replies; 6+ messages in thread
From: De Lara Guarch, Pablo @ 2018-07-23 8:56 UTC (permalink / raw)
To: De Lara Guarch, Pablo, Trahe, Fiona, dev; +Cc: Kovacevic, Marko
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of De Lara Guarch, Pablo
> Sent: Monday, July 23, 2018 9:55 AM
> To: Trahe, Fiona <fiona.trahe@intel.com>; dev@dpdk.org
> Cc: Kovacevic, Marko <marko.kovacevic@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v3] crypto/qat: add support for 8 byte 3DES
>
>
>
> > -----Original Message-----
> > From: Trahe, Fiona
> > Sent: Friday, July 20, 2018 7:49 PM
> > To: dev@dpdk.org
> > Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Trahe,
> > Fiona <fiona.trahe@intel.com>; Kovacevic, Marko
> > <marko.kovacevic@intel.com>
> > Subject: [PATCH v3] crypto/qat: add support for 8 byte 3DES
> >
> > Added extra case to support 8 byte key size for 3DES CBC. Also changed
> > capabilities to reflect the change.
> >
> > Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
> > Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
>
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Applied to dpdk-next-crypto.
Thanks,
Pablo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-07-23 8:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-12 10:39 [dpdk-dev] [PATCH v1] crypto/qat: add support for 8 byte 3DES Kovacevic, Marko
2018-06-13 16:15 ` Trahe, Fiona
2018-07-04 10:20 ` [dpdk-dev] [PATCH v2] " Kovacevic, Marko
2018-07-20 18:49 ` [dpdk-dev] [PATCH v3] " Fiona Trahe
2018-07-23 8:55 ` De Lara Guarch, Pablo
2018-07-23 8:56 ` De Lara Guarch, Pablo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).