crypto/dpaa2_sec: fix to check next null for auth only case
PATCH 1/5 crypto/dpaa2_sec: fix to check next null for auth only case
This patch fixes the issue to check for next pointer as null in the integrity only case in pdcp-security context.
--- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 25 +++++++++++---------- 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +13 -12
@@ -3102,7 +3102,7 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev,struct rte_security_pdcp_xform *pdcp_xform = &conf->pdcp;struct rte_crypto_sym_xform *xform = conf->crypto_xform;struct rte_crypto_auth_xform *auth_xform =NULL ; -struct rte_crypto_cipher_xform *cipher_xform; +struct rte_crypto_cipher_xform *cipher_xform =NULL ;dpaa2_sec_session *session = (dpaa2_sec_session *)sess;struct ctxt_priv *priv;struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private;
@@ -3134,18 +3134,18 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, flc = &priv->flc_desc[0 ].flc;/* find xfrm types */ -if (xform->type ==RTE_CRYPTO_SYM_XFORM_CIPHER && xform->next ==NULL ) { - cipher_xform = &xform->cipher; - }else if (xform->type ==RTE_CRYPTO_SYM_XFORM_CIPHER && - xform->next->type ==RTE_CRYPTO_SYM_XFORM_AUTH ) { - session->ext_params.aead_ctxt.auth_cipher_text = true; +if (xform->type ==RTE_CRYPTO_SYM_XFORM_CIPHER ) { cipher_xform = &xform->cipher; - auth_xform = &xform->next->auth; - }else if (xform->type ==RTE_CRYPTO_SYM_XFORM_AUTH && - xform->next->type ==RTE_CRYPTO_SYM_XFORM_CIPHER ) { - session->ext_params.aead_ctxt.auth_cipher_text = false; - cipher_xform = &xform->next->cipher; +if (xform->next !=NULL ) { + session->ext_params.aead_ctxt.auth_cipher_text = true; + auth_xform = &xform->next->auth; + } + }else if (xform->type ==RTE_CRYPTO_SYM_XFORM_AUTH ) { auth_xform = &xform->auth; +if (xform->next !=NULL ) { + session->ext_params.aead_ctxt.auth_cipher_text = false; + cipher_xform = &xform->next->cipher; + } }else {DPAA2_SEC_ERR ("Invalid crypto type" );return -EINVAL ;
@@ -3184,7 +3184,8 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, session->pdcp.hfn_threshold = pdcp_xform->hfn_threshold; session->pdcp.hfn_ovd = pdcp_xform->hfn_ovrd;/* hfv ovd offset location is stored in iv.offset value*/ - session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset; +if (cipher_xform) + session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset; cipherdata.key = (size_t )session->cipher_key.data; cipherdata.keylen = session->cipher_key.length;
Signature · 1 line
2.17.1
PATCH 2/5 crypto/dpaa_sec: support DES-CBC
From: Gagandeep Singh <[email protected]>
add DES-CBC support and enable available cipher-only test cases.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 1 + drivers/crypto/dpaa_sec/dpaa_sec.c | 13 +++++++++++++ drivers/crypto/dpaa_sec/dpaa_sec.h | 20 ++++++++++++++++++++ 3 files changed, 34 insertions(+)
doc/guides/cryptodevs/features/dpaa_sec.ini +1 -0
@@ -24,6 +24,7 @@ AES CBC (256) = Y AES CTR (128) = Y AES CTR (192) = Y AES CTR (256) = Y +DES CBC = Y 3DES CBC = Y SNOW3G UEA2 = Y ZUC EEA3 = Y
drivers/crypto/dpaa_sec/dpaa_sec.c +13 -0
@@ -454,6 +454,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses)switch (ses->cipher_alg) {case RTE_CRYPTO_CIPHER_AES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_AES_CTR :case RTE_CRYPTO_CIPHER_3DES_CTR : shared_desc_len = cnstr_shdsc_blkcipher(
@@ -2043,6 +2044,10 @@ dpaa_sec_cipher_init(struct rte_cryptodev *dev __rte_unused, session->cipher_key.alg =OP_ALG_ALGSEL_AES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;break ; +case RTE_CRYPTO_CIPHER_DES_CBC : + session->cipher_key.alg =OP_ALG_ALGSEL_DES ; + session->cipher_key.algmode =OP_ALG_AAI_CBC ; +break ;case RTE_CRYPTO_CIPHER_3DES_CBC : session->cipher_key.alg =OP_ALG_ALGSEL_3DES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;
@@ -2218,6 +2223,10 @@ dpaa_sec_chain_init(struct rte_cryptodev *dev __rte_unused, session->cipher_key.alg =OP_ALG_ALGSEL_AES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;break ; +case RTE_CRYPTO_CIPHER_DES_CBC : + session->cipher_key.alg =OP_ALG_ALGSEL_DES ; + session->cipher_key.algmode =OP_ALG_AAI_CBC ; +break ;case RTE_CRYPTO_CIPHER_3DES_CBC : session->cipher_key.alg =OP_ALG_ALGSEL_3DES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;
@@ -2667,6 +2676,10 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform, session->cipher_key.alg =OP_PCL_IPSEC_AES_CBC ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;break ; +case RTE_CRYPTO_CIPHER_DES_CBC : + session->cipher_key.alg =OP_PCL_IPSEC_DES ; + session->cipher_key.algmode =OP_ALG_AAI_CBC ; +break ;case RTE_CRYPTO_CIPHER_3DES_CBC : session->cipher_key.alg =OP_PCL_IPSEC_3DES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;
drivers/crypto/dpaa_sec/dpaa_sec.h +20 -0
@@ -456,6 +456,26 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = { }, } }, } }, + {/* DES CBC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type =RTE_CRYPTO_SYM_XFORM_CIPHER , + {.cipher = { + .algo =RTE_CRYPTO_CIPHER_DES_CBC , + .block_size = 8, + .key_size = { + .min =8 , + .max = 8, + .increment = 0 + }, + .iv_size = { + .min =8 , + .max = 8, + .increment = 0 + } + }, } + }, } + }, { /* 3DES CBC */ .op =RTE_CRYPTO_OP_TYPE_SYMMETRIC , {.sym = {
Signature · 1 line
2.17.1
PATCH 3/5 crypto/dpaa_sec: support non-HMAC auth algos
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
This patch add support for non-HMAC, md5, shax algos.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 8 +- drivers/crypto/dpaa_sec/dpaa_sec.c | 55 +++++++-- drivers/crypto/dpaa_sec/dpaa_sec.h | 126 ++++++++++++++++++++ 3 files changed, 180 insertions(+), 9 deletions(-)
doc/guides/cryptodevs/features/dpaa_sec.ini +7 -1
@@ -33,11 +33,17 @@ ZUC EEA3 = Y ; Supported authentication algorithms of the 'dpaa_sec' crypto driver. ; [Auth] +MD5 = Y MD5 HMAC = Y +SHA1 = Y SHA1 HMAC = Y +SHA224 = Y SHA224 HMAC = Y +SHA256 = Y SHA256 HMAC = Y +SHA384 = Y SHA384 HMAC = Y +SHA512 = Y SHA512 HMAC = Y SNOW3G UIA2 = Y ZUC EIA3 = Y
@@ -53,4 +59,4 @@ AES GCM (256) = Y ; ; Supported Asymmetric algorithms of the 'dpaa_sec' crypto driver. ; -[Asymmetric] +[Asymmetric]
drivers/crypto/dpaa_sec/dpaa_sec.c +47 -8
96 lines not on this page · raw message
drivers/crypto/dpaa_sec/dpaa_sec.h +126 -0
162 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 4/5 crypto/dpaa_sec: support AES-XCBC-MAC
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
This patch adds support for AES-XCBC-MAC algo.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 1 + drivers/crypto/dpaa_sec/dpaa_sec.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-)
doc/guides/cryptodevs/features/dpaa_sec.ini +1 -0
@@ -47,6 +47,7 @@ SHA512 = Y SHA512 HMAC = Y SNOW3G UIA2 = Y ZUC EIA3 = Y +AES XCBC MAC = Y ; ; Supported AEAD algorithms of the 'dpaa_sec' crypto driver.
drivers/crypto/dpaa_sec/dpaa_sec.c +20 -1
@@ -527,6 +527,14 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) !ses->dir, ses->digest_length);break ; +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + shared_desc_len =cnstr_shdsc_aes_mac ( + cdb->sh_desc, + true, swap,SHR_NEVER , + &alginfo_a, + !ses->dir, + ses->digest_length); +break ;default :DPAA_SEC_ERR ("unsupported auth alg %u" , ses->auth_alg); }
@@ -2168,6 +2176,10 @@ dpaa_sec_auth_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_ZUCA ; session->auth_key.algmode =OP_ALG_AAI_F9 ;break ; +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , xform->auth.algo);
@@ -2249,6 +2261,10 @@ dpaa_sec_chain_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_SHA512 ; session->auth_key.algmode =OP_ALG_AAI_HMAC ;break ; +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , auth_xform->algo);
@@ -2688,8 +2704,11 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform,case RTE_CRYPTO_AUTH_NULL : session->auth_key.alg =OP_PCL_IPSEC_HMAC_NULL ;break ; -case RTE_CRYPTO_AUTH_SHA224_HMAC :case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + session->auth_key.alg =OP_PCL_IPSEC_AES_XCBC_MAC_96 ; + session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ; +break ; +case RTE_CRYPTO_AUTH_SHA224_HMAC :case RTE_CRYPTO_AUTH_SNOW3G_UIA2 :case RTE_CRYPTO_AUTH_SHA1 :case RTE_CRYPTO_AUTH_SHA256 :
Signature · 1 line
2.17.1
PATCH 5/5 crypto/dpaa_sec: add support for AES CMAC integrity check
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
This patch adds support for AES_CMAC integrity in non-security mode. This patch modifies the camm flib to handles the AES CMAC without conflicting the proto ALG operations. i.e. by creating another ALG operation routine.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 1 + drivers/crypto/dpaa_sec/dpaa_sec.c | 10 +++++ drivers/crypto/dpaa_sec/dpaa_sec.h | 43 +++++++++++++++++++++ 3 files changed, 54 insertions(+)
doc/guides/cryptodevs/features/dpaa_sec.ini +1 -0
@@ -48,6 +48,7 @@ SHA512 HMAC = Y SNOW3G UIA2 = Y ZUC EIA3 = Y AES XCBC MAC = Y +AES CMAC (128) = Y ; ; Supported AEAD algorithms of the 'dpaa_sec' crypto driver.
drivers/crypto/dpaa_sec/dpaa_sec.c +10 -0
@@ -528,6 +528,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) ses->digest_length);break ;case RTE_CRYPTO_AUTH_AES_XCBC_MAC : +case RTE_CRYPTO_AUTH_AES_CMAC : shared_desc_len = cnstr_shdsc_aes_mac( cdb->sh_desc, true, swap, SHR_NEVER,
@@ -2180,6 +2181,10 @@ dpaa_sec_auth_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_AES ; session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ;break ; +case RTE_CRYPTO_AUTH_AES_CMAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , xform->auth.algo);
@@ -2265,6 +2270,10 @@ dpaa_sec_chain_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_AES ; session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ;break ; +case RTE_CRYPTO_AUTH_AES_CMAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , auth_xform->algo);
@@ -2700,6 +2709,7 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform,break ;case RTE_CRYPTO_AUTH_AES_CMAC : session->auth_key.alg =OP_PCL_IPSEC_AES_CMAC_96 ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ;break ;case RTE_CRYPTO_AUTH_NULL : session->auth_key.alg =OP_PCL_IPSEC_HMAC_NULL ;
drivers/crypto/dpaa_sec/dpaa_sec.h +43 -0
49 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 1/11 crypto/dpaa2_sec: fix to check next null for auth only case
In reply to Hemant AgrawalThis patch fixes the issue to check for next pointer as null in the integrity only case in pdcp-security context.
--- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 25 +++++++++++---------- 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +13 -12
@@ -3095,7 +3095,7 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev,struct rte_security_pdcp_xform *pdcp_xform = &conf->pdcp;struct rte_crypto_sym_xform *xform = conf->crypto_xform;struct rte_crypto_auth_xform *auth_xform =NULL ; -struct rte_crypto_cipher_xform *cipher_xform; +struct rte_crypto_cipher_xform *cipher_xform =NULL ;dpaa2_sec_session *session = (dpaa2_sec_session *)sess;struct ctxt_priv *priv;struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private;
@@ -3127,18 +3127,18 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, flc = &priv->flc_desc[0 ].flc;/* find xfrm types */ -if (xform->type ==RTE_CRYPTO_SYM_XFORM_CIPHER && xform->next ==NULL ) { - cipher_xform = &xform->cipher; - }else if (xform->type ==RTE_CRYPTO_SYM_XFORM_CIPHER && - xform->next->type ==RTE_CRYPTO_SYM_XFORM_AUTH ) { - session->ext_params.aead_ctxt.auth_cipher_text = true; +if (xform->type ==RTE_CRYPTO_SYM_XFORM_CIPHER ) { cipher_xform = &xform->cipher; - auth_xform = &xform->next->auth; - }else if (xform->type ==RTE_CRYPTO_SYM_XFORM_AUTH && - xform->next->type ==RTE_CRYPTO_SYM_XFORM_CIPHER ) { - session->ext_params.aead_ctxt.auth_cipher_text = false; - cipher_xform = &xform->next->cipher; +if (xform->next !=NULL ) { + session->ext_params.aead_ctxt.auth_cipher_text = true; + auth_xform = &xform->next->auth; + } + }else if (xform->type ==RTE_CRYPTO_SYM_XFORM_AUTH ) { auth_xform = &xform->auth; +if (xform->next !=NULL ) { + session->ext_params.aead_ctxt.auth_cipher_text = false; + cipher_xform = &xform->next->cipher; + } }else {DPAA2_SEC_ERR ("Invalid crypto type" );return -EINVAL ;
@@ -3177,7 +3177,8 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, session->pdcp.hfn_threshold = pdcp_xform->hfn_threshold; session->pdcp.hfn_ovd = pdcp_xform->hfn_ovrd;/* hfv ovd offset location is stored in iv.offset value*/ - session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset; +if (cipher_xform) + session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset; cipherdata.key = (size_t )session->cipher_key.data; cipherdata.keylen = session->cipher_key.length;
Signature · 1 line
2.17.1
PATCH v2 2/11 crypto/dpaa_sec: support DES-CBC
From: Gagandeep Singh <[email protected]>
add DES-CBC support and enable available cipher-only test cases.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 1 + drivers/crypto/dpaa_sec/dpaa_sec.c | 13 +++++++++++++ drivers/crypto/dpaa_sec/dpaa_sec.h | 20 ++++++++++++++++++++ 3 files changed, 34 insertions(+)
doc/guides/cryptodevs/features/dpaa_sec.ini +1 -0
@@ -24,6 +24,7 @@ AES CBC (256) = Y AES CTR (128) = Y AES CTR (192) = Y AES CTR (256) = Y +DES CBC = Y 3DES CBC = Y SNOW3G UEA2 = Y ZUC EEA3 = Y
drivers/crypto/dpaa_sec/dpaa_sec.c +13 -0
@@ -451,6 +451,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses)switch (ses->cipher_alg) {case RTE_CRYPTO_CIPHER_AES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_AES_CTR :case RTE_CRYPTO_CIPHER_3DES_CTR : shared_desc_len = cnstr_shdsc_blkcipher(
@@ -2040,6 +2041,10 @@ dpaa_sec_cipher_init(struct rte_cryptodev *dev __rte_unused, session->cipher_key.alg =OP_ALG_ALGSEL_AES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;break ; +case RTE_CRYPTO_CIPHER_DES_CBC : + session->cipher_key.alg =OP_ALG_ALGSEL_DES ; + session->cipher_key.algmode =OP_ALG_AAI_CBC ; +break ;case RTE_CRYPTO_CIPHER_3DES_CBC : session->cipher_key.alg =OP_ALG_ALGSEL_3DES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;
@@ -2215,6 +2220,10 @@ dpaa_sec_chain_init(struct rte_cryptodev *dev __rte_unused, session->cipher_key.alg =OP_ALG_ALGSEL_AES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;break ; +case RTE_CRYPTO_CIPHER_DES_CBC : + session->cipher_key.alg =OP_ALG_ALGSEL_DES ; + session->cipher_key.algmode =OP_ALG_AAI_CBC ; +break ;case RTE_CRYPTO_CIPHER_3DES_CBC : session->cipher_key.alg =OP_ALG_ALGSEL_3DES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;
@@ -2664,6 +2673,10 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform, session->cipher_key.alg =OP_PCL_IPSEC_AES_CBC ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;break ; +case RTE_CRYPTO_CIPHER_DES_CBC : + session->cipher_key.alg =OP_PCL_IPSEC_DES ; + session->cipher_key.algmode =OP_ALG_AAI_CBC ; +break ;case RTE_CRYPTO_CIPHER_3DES_CBC : session->cipher_key.alg =OP_PCL_IPSEC_3DES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;
drivers/crypto/dpaa_sec/dpaa_sec.h +20 -0
@@ -482,6 +482,26 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = { }, } }, } }, + {/* DES CBC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type =RTE_CRYPTO_SYM_XFORM_CIPHER , + {.cipher = { + .algo =RTE_CRYPTO_CIPHER_DES_CBC , + .block_size = 8, + .key_size = { + .min =8 , + .max = 8, + .increment = 0 + }, + .iv_size = { + .min =8 , + .max = 8, + .increment = 0 + } + }, } + }, } + }, { /* 3DES CBC */ .op =RTE_CRYPTO_OP_TYPE_SYMMETRIC , {.sym = {
Signature · 1 line
2.17.1
PATCH v2 3/11 crypto/dpaa_sec: support non-HMAC auth algos
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
This patch add support for non-HMAC, md5, shax algos.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 8 +- drivers/crypto/dpaa_sec/dpaa_sec.c | 55 +++++++-- drivers/crypto/dpaa_sec/dpaa_sec.h | 126 ++++++++++++++++++++ 3 files changed, 180 insertions(+), 9 deletions(-)
doc/guides/cryptodevs/features/dpaa_sec.ini +7 -1
@@ -33,11 +33,17 @@ ZUC EEA3 = Y ; Supported authentication algorithms of the 'dpaa_sec' crypto driver. ; [Auth] +MD5 = Y MD5 HMAC = Y +SHA1 = Y SHA1 HMAC = Y +SHA224 = Y SHA224 HMAC = Y +SHA256 = Y SHA256 HMAC = Y +SHA384 = Y SHA384 HMAC = Y +SHA512 = Y SHA512 HMAC = Y SNOW3G UIA2 = Y ZUC EIA3 = Y
@@ -53,4 +59,4 @@ AES GCM (256) = Y ; ; Supported Asymmetric algorithms of the 'dpaa_sec' crypto driver. ; -[Asymmetric] +[Asymmetric]
drivers/crypto/dpaa_sec/dpaa_sec.c +47 -8
96 lines not on this page · raw message
drivers/crypto/dpaa_sec/dpaa_sec.h +126 -0
162 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 4/11 crypto/dpaa_sec: support AES-XCBC-MAC
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
This patch adds support for AES-XCBC-MAC algo.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 1 + drivers/crypto/dpaa_sec/dpaa_sec.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-)
doc/guides/cryptodevs/features/dpaa_sec.ini +1 -0
@@ -47,6 +47,7 @@ SHA512 = Y SHA512 HMAC = Y SNOW3G UIA2 = Y ZUC EIA3 = Y +AES XCBC MAC = Y ; ; Supported AEAD algorithms of the 'dpaa_sec' crypto driver.
drivers/crypto/dpaa_sec/dpaa_sec.c +20 -1
@@ -524,6 +524,14 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) !ses->dir, ses->digest_length);break ; +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + shared_desc_len =cnstr_shdsc_aes_mac ( + cdb->sh_desc, + true, swap,SHR_NEVER , + &alginfo_a, + !ses->dir, + ses->digest_length); +break ;default :DPAA_SEC_ERR ("unsupported auth alg %u" , ses->auth_alg); }
@@ -2165,6 +2173,10 @@ dpaa_sec_auth_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_ZUCA ; session->auth_key.algmode =OP_ALG_AAI_F9 ;break ; +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , xform->auth.algo);
@@ -2246,6 +2258,10 @@ dpaa_sec_chain_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_SHA512 ; session->auth_key.algmode =OP_ALG_AAI_HMAC ;break ; +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , auth_xform->algo);
@@ -2685,8 +2701,11 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform,case RTE_CRYPTO_AUTH_NULL : session->auth_key.alg =OP_PCL_IPSEC_HMAC_NULL ;break ; -case RTE_CRYPTO_AUTH_SHA224_HMAC :case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + session->auth_key.alg =OP_PCL_IPSEC_AES_XCBC_MAC_96 ; + session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ; +break ; +case RTE_CRYPTO_AUTH_SHA224_HMAC :case RTE_CRYPTO_AUTH_SNOW3G_UIA2 :case RTE_CRYPTO_AUTH_SHA1 :case RTE_CRYPTO_AUTH_SHA256 :
Signature · 1 line
2.17.1
PATCH v2 5/11 crypto/dpaa_sec: add support for AES CMAC integrity check
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
This patch adds support for AES_CMAC integrity in non-security mode. This patch modifies the camm flib to handles the AES CMAC without conflicting the proto ALG operations. i.e. by creating another ALG operation routine.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 1 + drivers/crypto/dpaa_sec/dpaa_sec.c | 10 +++++ drivers/crypto/dpaa_sec/dpaa_sec.h | 43 +++++++++++++++++++++ 3 files changed, 54 insertions(+)
doc/guides/cryptodevs/features/dpaa_sec.ini +1 -0
@@ -48,6 +48,7 @@ SHA512 HMAC = Y SNOW3G UIA2 = Y ZUC EIA3 = Y AES XCBC MAC = Y +AES CMAC (128) = Y ; ; Supported AEAD algorithms of the 'dpaa_sec' crypto driver.
drivers/crypto/dpaa_sec/dpaa_sec.c +10 -0
@@ -525,6 +525,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) ses->digest_length);break ;case RTE_CRYPTO_AUTH_AES_XCBC_MAC : +case RTE_CRYPTO_AUTH_AES_CMAC : shared_desc_len = cnstr_shdsc_aes_mac( cdb->sh_desc, true, swap, SHR_NEVER,
@@ -2177,6 +2178,10 @@ dpaa_sec_auth_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_AES ; session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ;break ; +case RTE_CRYPTO_AUTH_AES_CMAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , xform->auth.algo);
@@ -2262,6 +2267,10 @@ dpaa_sec_chain_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_AES ; session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ;break ; +case RTE_CRYPTO_AUTH_AES_CMAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , auth_xform->algo);
@@ -2697,6 +2706,7 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform,break ;case RTE_CRYPTO_AUTH_AES_CMAC : session->auth_key.alg =OP_PCL_IPSEC_AES_CMAC_96 ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ;break ;case RTE_CRYPTO_AUTH_NULL : session->auth_key.alg =OP_PCL_IPSEC_HMAC_NULL ;
drivers/crypto/dpaa_sec/dpaa_sec.h +43 -0
49 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [dpdk-dev] [EXT] [PATCH v2 05/11] crypto/dpaa_sec: add support for AES CMAC integrity check
Quoted 6 lines
From: Gagandeep Singh <[email protected]>
This patch adds support for
AES_CMACintegrity in non-security mode. This patch modifies the camm flib to handles the AES CMAC without conflicting the proto ALG operations. i.e. by creating another ALG operation routine.
Description do not match with the patch.
Camm flib is not updated in this patch.
Quoted 125 lines
Signed-off-by Gagandeep Singh <[email protected]>--- doc/guides/cryptodevs/features/dpaa_sec.ini | 1 + drivers/crypto/dpaa_sec/dpaa_sec.c | 10 +++++ drivers/crypto/dpaa_sec/dpaa_sec.h | 43 +++++++++++++++++++++ 3 files changed, 54 insertions(+)doc/guides/cryptodevs/features/dpaa_sec.ini +1
-0@@ -48,6 +48,7 @@ SHA512 HMAC = Y SNOW3G UIA2 = Y ZUC EIA3 = Y AES XCBC MAC = Y +AES CMAC (128) = Y ; ; Supported AEAD algorithms of the 'dpaa_sec' crypto driver.drivers/crypto/dpaa_sec/dpaa_sec.c +5
-0@@ -525,6 +525,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) ses->digest_length);break ;case RTE_CRYPTO_AUTH_AES_XCBC_MAC : +case RTE_CRYPTO_AUTH_AES_CMAC : shared_desc_len = cnstr_shdsc_aes_mac( cdb->sh_desc, true, swap, SHR_NEVER,@@ -2177,6 +2178,10 @@ dpaa_sec_auth_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_AES ; session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ;break ; +case RTE_CRYPTO_AUTH_AES_CMAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ; +break ;default : DPAA_SEC_ERR("Crypto: Unsupported Auth specified %u",drivers/crypto/dpaa_sec/dpaa_sec.c +4
-0xform->auth.algo);@@ -2262,6 +2267,10 @@ dpaa_sec_chain_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_AES ; session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ;break ; +case RTE_CRYPTO_AUTH_AES_CMAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ; +break ;default : DPAA_SEC_ERR("Crypto: Unsupported Auth specified %u",drivers/crypto/dpaa_sec/dpaa_sec.c +1
-0auth_xform->algo);@@ -2697,6 +2706,7 @@ dpaa_sec_ipsec_proto_init(structrte_crypto_cipher_xform *cipher_xform, break;case RTE_CRYPTO_AUTH_AES_CMAC : session->auth_key.alg =OP_PCL_IPSEC_AES_CMAC_96 ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ;break ;case RTE_CRYPTO_AUTH_NULL :drivers/crypto/dpaa_sec/dpaa_sec.c +0
-0session->auth_key.alg =OP_PCL_IPSEC_HMAC_NULL ;drivers/crypto/dpaa_sec/dpaa_sec.h +43
-1@@ -738,6 +738,49 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = { }, } }, } }, + {/* AES CMAC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type =RTE_CRYPTO_SYM_XFORM_AUTH , + {.auth = { + .algo =RTE_CRYPTO_AUTH_AES_CMAC , + .block_size = 16, + .key_size = { + .min =1 , + .max = 16, + .increment = 1 + }, + .digest_size = { + .min =12 , + .max = 16, + .increment = 4 + }, + .iv_size = { 0 } + }, } + }, } + }, + { /* AES XCBC HMAC */ + .op =RTE_CRYPTO_OP_TYPE_SYMMETRIC , + {.sym = { + .xform_type =RTE_CRYPTO_SYM_XFORM_AUTH , + {.auth = { + .algo =RTE_CRYPTO_AUTH_AES_XCBC_MAC , + .block_size = 16, + .key_size = { + .min =1 , + .max = 16, + .increment = 1 + }, + .digest_size = { + .min =12 , + .max = 16, + .increment = 4 + }, + .aad_size = { 0 }, + .iv_size = { 0 } + }, } + }, } + },RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST () }; --2.17.1
PATCH v2 6/11 common/dpaax: caamflib load correct HFN from DESCBUF
In reply to Hemant AgrawalFrom: Franck LENORMAND <[email protected]>
The offset of the HFn word and Bearer/Dir word is different depending on type of PDB.
The wrong value was used.
This patch address this issue
--- drivers/common/dpaax/caamflib/desc/pdcp.h | 7 +- drivers/common/dpaax/caamflib/desc/sdap.h | 96 ++++++++++++++++++----- 2 files changed, 80 insertions(+), 23 deletions(-)
drivers/common/dpaax/caamflib/desc/pdcp.h +5 -2
@@ -270,6 +270,9 @@ enum pdb_type_e { PDCP_PDB_TYPE_INVALID }; +#define REDUCED_PDB_DESCBUF_HFN_BEARER_DIR_OFFSET 4 +#define FULL_PDB_DESCBUF_HFN_BEARER_DIR_OFFSET 8 +/** * rta_inline_pdcp_query() - Provide indications if a key can be passed as * immediate data or shall be referenced in a
@@ -2564,11 +2567,11 @@ insert_hfn_ov_op(struct program *p,return 0 ;case PDCP_PDB_TYPE_REDUCED_PDB : - hfn_pdb_offset =4 ; + hfn_pdb_offset =REDUCED_PDB_DESCBUF_HFN_BEARER_DIR_OFFSET ;break ;case PDCP_PDB_TYPE_FULL_PDB : - hfn_pdb_offset =8 ; + hfn_pdb_offset =FULL_PDB_DESCBUF_HFN_BEARER_DIR_OFFSET ;break ;default :
drivers/common/dpaax/caamflib/desc/sdap.h +75 -21
200 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 7/11 common/dpaax: caamflib do not clear DPOVRD
In reply to Hemant AgrawalFrom: Franck LENORMAND <[email protected]>
For SDAP, we are not using the protocol operation to perform 4G/LTE operation so the DPOVRD option is not used.
Removing it save some space in the descriptor buffer and execution time.
--- drivers/common/dpaax/caamflib/desc/pdcp.h | 14 ++++++++------ drivers/common/dpaax/caamflib/desc/sdap.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-)
drivers/common/dpaax/caamflib/desc/pdcp.h +8 -6
@@ -2546,7 +2546,8 @@ static inline int insert_hfn_ov_op(struct program *p, uint32_t shift, enum pdb_type_e pdb_type, - unsigned char era_2_sw_hfn_ovrd) + unsigned char era_2_sw_hfn_ovrd, + bool clear_dpovrd_at_end) { uint32_t imm = PDCP_DPOVRD_HFN_OV_EN;uint16_t hfn_pdb_offset;
@@ -2597,13 +2598,14 @@ insert_hfn_ov_op(struct program *p,MATHB (p,MATH0 ,SHLD ,MATH0 ,MATH0 ,8 ,0 );MOVE (p,MATH0 ,0 ,DESCBUF , hfn_pdb_offset,4 ,IMMED ); -if (rta_sec_era >=RTA_SEC_ERA_8 ) +if (clear_dpovrd_at_end && (rta_sec_era >=RTA_SEC_ERA_8 )) {/* * For ERA8, DPOVRD could be handled by the PROTOCOL command * itself. For now, this is not done. Thus, clear DPOVRD here * to alleviate any side-effects. */ MATHB (p,DPOVRD ,AND ,ZERO ,DPOVRD ,4 ,STL ); + }SET_LABEL (p, keyjump);PATCH_JUMP (p, pkeyjump, keyjump);
@@ -2989,7 +2991,7 @@ cnstr_shdsc_pdcp_c_plane_encap(uint32_t *descbuf,SET_LABEL (p, pdb_end); err =insert_hfn_ov_op (p, sn_size, pdb_type, - era_2_sw_hfn_ovrd); + era_2_sw_hfn_ovrd, true);if (err)return err;
@@ -3143,7 +3145,7 @@ cnstr_shdsc_pdcp_c_plane_decap(uint32_t *descbuf,SET_LABEL (p, pdb_end); err =insert_hfn_ov_op (p, sn_size, pdb_type, - era_2_sw_hfn_ovrd); + era_2_sw_hfn_ovrd, true);if (err)return err;
@@ -3319,7 +3321,7 @@ cnstr_shdsc_pdcp_u_plane_encap(uint32_t *descbuf, }SET_LABEL (p, pdb_end); - err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd); + err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd, true);if (err)return err;
@@ -3523,7 +3525,7 @@ cnstr_shdsc_pdcp_u_plane_decap(uint32_t *descbuf, }SET_LABEL (p, pdb_end); - err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd); + err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd, true);if (err)return err;
drivers/common/dpaax/caamflib/desc/sdap.h +1 -1
@@ -990,7 +990,7 @@ cnstr_shdsc_pdcp_sdap_u_plane(uint32_t *descbuf,SET_LABEL (p, pdb_end);/* Inser the HFN override operation */ - err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd); + err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd, false);if (err)return err;
Signature · 1 line
2.17.1
PATCH v2 8/11 common/dpaax: enhance caamflib with inline keys
In reply to Hemant AgrawalFrom: Franck LENORMAND <[email protected]>
The space in descriptor buffer is scarce as it is limited to 64 words for platforms except ERA10 (which has 128).
As the descriptors are processed with QI, it adds some words to the descriptor which is passed.
Some descriptors used for SDAP were using too much words reaching the limit.
This patch reduces the number of words used by removing the inlining of some keys (done for performance) in order to have working descriptors.
--- drivers/common/dpaax/caamflib/desc/sdap.h | 61 ++++++++++++++++++++- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 28 ++++++++-- 2 files changed, 81 insertions(+), 8 deletions(-)
drivers/common/dpaax/caamflib/desc/sdap.h +59 -2
@@ -20,6 +20,63 @@#define SDAP_BITS_SIZE (SDAP_BYTE_SIZE * 8)#endif +/** +* rta_inline_pdcp_query() - Provide indications if a key can be passed as +* immediate data or shall be referenced in a +* shared descriptor. +* Return: 0 if data can be inlined or 1 if referenced. +*/ +static inline int +rta_inline_pdcp_sdap_query (enum auth_type_pdcp auth_alg, +enum cipher_type_pdcp cipher_alg, +enum pdcp_sn_size sn_size, +int8_t hfn_ovd) +{ +int nb_key_to_inline =0 ; + +if ((cipher_alg !=PDCP_CIPHER_TYPE_NULL ) && + (auth_alg !=PDCP_AUTH_TYPE_NULL )) +return 2 ; +else +return 0 ; + +/** +* Shared Descriptors for some of the cases does not fit in the +* MAX_DESC_SIZE of the descriptor +* The cases which exceed are for RTA_SEC_ERA=8 and HFN override +* enabled and 12/18 bit uplane and either of following Algo combo. +* - AES-SNOW +* - AES-ZUC +* - SNOW-SNOW +* - SNOW-ZUC +* - ZUC-SNOW +* - ZUC-SNOW +* +* We cannot make inline for all cases, as this will impact performance +* due to extra memory accesses for the keys. +*/ + +/* Inline only the cipher key */ +if ((rta_sec_era ==RTA_SEC_ERA_8 ) && hfn_ovd && + ((sn_size ==PDCP_SN_SIZE_12 ) || + (sn_size ==PDCP_SN_SIZE_18 )) && + (cipher_alg !=PDCP_CIPHER_TYPE_NULL ) && + ((auth_alg ==PDCP_AUTH_TYPE_SNOW ) || + (auth_alg ==PDCP_AUTH_TYPE_ZUC ))) { + + nb_key_to_inline++; + +/* Sub case where inlining another key is required */ +if ((cipher_alg ==PDCP_CIPHER_TYPE_AES ) && + (auth_alg ==PDCP_AUTH_TYPE_SNOW )) + nb_key_to_inline++; + } + +/* Inline both keys */ + +return nb_key_to_inline; +} +static inline void key_loading_opti (struct program *p,struct alginfo *cipherdata,struct alginfo *authdata)
@@ -788,8 +845,8 @@ pdcp_sdap_insert_cplane_null_op(struct program *p,unsigned char era_2_sw_hfn_ovrd, enum pdb_type_e pdb_type __maybe_unused) { - return pdcp_insert_cplane_int_only_op(p, swap, cipherdata, authdata, -dir ,sn_size ,era_2_sw_hfn_ovrd ); + return pdcp_insert_cplane_null_op(p, swap, cipherdata, authdata, dir, +sn_size ,era_2_sw_hfn_ovrd ); } static inline int
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +22 -6
@@ -3255,12 +3255,28 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, goto out; } -if (rta_inline_pdcp_query (authdata.algtype, - cipherdata.algtype, - session->pdcp.sn_size, - session->pdcp.hfn_ovd)) { - cipherdata.key =DPAA2_VADDR_TO_IOVA (cipherdata.key); - cipherdata.key_type =RTA_DATA_PTR ; +if (pdcp_xform->sdap_enabled) { +int nb_keys_to_inline = +rta_inline_pdcp_sdap_query (authdata.algtype, + cipherdata.algtype, + session->pdcp.sn_size, + session->pdcp.hfn_ovd); +if (nb_keys_to_inline >=1 ) { + cipherdata.key =DPAA2_VADDR_TO_IOVA (cipherdata.key); + cipherdata.key_type =RTA_DATA_PTR ; + } +if (nb_keys_to_inline >=2 ) { + authdata.key =DPAA2_VADDR_TO_IOVA (authdata.key); + authdata.key_type =RTA_DATA_PTR ; + } + }else { +if (rta_inline_pdcp_query (authdata.algtype, + cipherdata.algtype, + session->pdcp.sn_size, + session->pdcp.hfn_ovd)) { + cipherdata.key =DPAA2_VADDR_TO_IOVA (cipherdata.key); + cipherdata.key_type =RTA_DATA_PTR ; + } }if (pdcp_xform->domain ==RTE_SECURITY_PDCP_MODE_CONTROL ) {
Signature · 1 line
2.17.1
PATCH v2 9/11 common/dpaax: fix IV value for shortMAC-I for SNOW algo
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
The logic was incorecly doing conditional swap. It need to be bit swap always.
--- drivers/common/dpaax/caamflib/desc/pdcp.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/common/dpaax/caamflib/desc/pdcp.h +4 -3
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: BSD-3-Clause or GPL-2.0+ * Copyright 2008-2013 Freescale Semiconductor, Inc. -* Copyright 2019-2020 NXP +* Copyright 2019-2021 NXP */ #ifndef __DESC_PDCP_H__
@@ -3715,9 +3715,10 @@ cnstr_shdsc_pdcp_short_mac(uint32_t *descbuf,break ;case PDCP_AUTH_TYPE_SNOW : +/* IV calculation based on 3GPP specs. 36331, section:5.3.7.4 */ iv[0 ] =0xFFFFFFFF ; - iv[1 ] = swap ?swab32 (0x04000000 ) :0x04000000 ; - iv[2 ] = swap ?swab32 (0xF8000000 ) :0xF8000000 ; + iv[1 ] =swab32 (0x04000000 ); + iv[2 ] =swab32 (0xF8000000 );KEY (p,KEY2 , authdata->key_enc_flags, authdata->key, authdata->keylen,INLINE_KEY (authdata));
Signature · 1 line
2.17.1
PATCH v2 10/11 crypto/dpaa_sec: force inline of the keys to save space
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
This patch improve storage and performance by force inline of the keys.
--- drivers/crypto/dpaa_sec/dpaa_sec.c | 35 ++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-)
drivers/crypto/dpaa_sec/dpaa_sec.c +26 -9
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. -* Copyright 2017-2019 NXP +* Copyright 2017-2021 NXP * */
@@ -260,14 +260,31 @@ dpaa_sec_prep_pdcp_cdb(dpaa_sec_session *ses) p_authdata = &authdata; } -if (rta_inline_pdcp_query (authdata.algtype, - cipherdata.algtype, - ses->pdcp.sn_size, - ses->pdcp.hfn_ovd)) { - cipherdata.key = - (size_t )rte_dpaa_mem_vtop ((void *) - (size_t )cipherdata.key); - cipherdata.key_type =RTA_DATA_PTR ; +if (ses->pdcp.sdap_enabled) { +int nb_keys_to_inline = +rta_inline_pdcp_sdap_query (authdata.algtype, + cipherdata.algtype, + ses->pdcp.sn_size, + ses->pdcp.hfn_ovd); +if (nb_keys_to_inline >=1 ) { + cipherdata.key = (size_t )rte_dpaa_mem_vtop ((void *) + (size_t )cipherdata.key); + cipherdata.key_type =RTA_DATA_PTR ; + } +if (nb_keys_to_inline >=2 ) { + authdata.key = (size_t )rte_dpaa_mem_vtop ((void *) + (size_t )authdata.key); + authdata.key_type =RTA_DATA_PTR ; + } + }else { +if (rta_inline_pdcp_query (authdata.algtype, + cipherdata.algtype, + ses->pdcp.sn_size, + ses->pdcp.hfn_ovd)) { + cipherdata.key = (size_t )rte_dpaa_mem_vtop ((void *) + (size_t )cipherdata.key); + cipherdata.key_type =RTA_DATA_PTR ; + } }if (ses->pdcp.domain ==RTE_SECURITY_PDCP_MODE_CONTROL ) {
Signature · 1 line
2.17.1
PATCH v2 11/11 crypto/dpaa2_sec: add error packet counters
In reply to Hemant AgrawalThis patch add support to also counter err pkt counter per queue. This also enhances few related debug prints.
--- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +4 -2
@@ -1702,8 +1702,9 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops,if (unlikely (fd->simple.frc)) {/* TODO Parse SEC errors */ -DPAA2_SEC_ERR ("SEC returned Error - %x" , +DPAA2_SEC_DP_ERR ("SEC returned Error - %x\n" , fd->simple.frc); + dpaa2_qp->rx_vq.err_pkts +=1 ; ops[num_rx]->status =RTE_CRYPTO_OP_STATUS_ERROR ; }else { ops[num_rx]->status =RTE_CRYPTO_OP_STATUS_SUCCESS ;
@@ -1715,7 +1716,8 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops, dpaa2_qp->rx_vq.rx_pkts += num_rx; -DPAA2_SEC_DP_DEBUG ("SEC Received %d Packets\n" , num_rx); +DPAA2_SEC_DP_DEBUG ("SEC RX pkts %d err pkts %" PRIu64"\n" , num_rx, + dpaa2_qp->rx_vq.err_pkts);/*Return the total number of packets received to DPAA2 app*/ return num_rx; }
Signature · 1 line
2.17.1
Quoted 5 lines
This patch fixes the issue to check for next pointer as null in the integrity only case in pdcp-security context.
Fixes bef594ec5cc8 ("crypto/dpaa2_sec: support PDCP offload")
This patch is not a fix and need not be backported, because integrity only case is not a valid case for PDCP before the introduction of short MAC. Since short MAC is supported here in this release only, this should be reworded as to support short MAC, integrity-only case is required to be supported for PDCP.
And this patch should be part of the short MAC-I series and not this one.
Quoted 67 lines
Signed-off-by Hemant Agrawal <[email protected]>--- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 25 +++++++++++---------- 1 file changed, 13 insertions(+), 12 deletions(-)drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +1
-1@@ -3095,7 +3095,7 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, struct rte_security_pdcp_xform *pdcp_xform = &conf->pdcp;struct rte_crypto_sym_xform *xform = conf->crypto_xform;struct rte_crypto_auth_xform *auth_xform =NULL ; -struct rte_crypto_cipher_xform *cipher_xform; +struct rte_crypto_cipher_xform *cipher_xform =NULL ;dpaa2_sec_session *session = (dpaa2_sec_session *)sess;struct ctxt_priv *priv;drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +8
-10struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private;@@ -3127,18 +3127,18 @@ dpaa2_sec_set_pdcp_session(structrte_cryptodev *dev, flc = &priv->flc_desc[0 ].flc;/* find xfrm types */ -if (xform->type ==RTE_CRYPTO_SYM_XFORM_CIPHER && xform- >next == NULL) { - cipher_xform = &xform->cipher; - }else if (xform->type ==RTE_CRYPTO_SYM_XFORM_CIPHER && - xform->next->type ==RTE_CRYPTO_SYM_XFORM_AUTH ) { - session->ext_params.aead_ctxt.auth_cipher_text = true; +if (xform->type ==RTE_CRYPTO_SYM_XFORM_CIPHER ) { cipher_xform = &xform->cipher; - auth_xform = &xform->next->auth; - }else if (xform->type ==RTE_CRYPTO_SYM_XFORM_AUTH && - xform->next->type ==RTE_CRYPTO_SYM_XFORM_CIPHER ) { - session->ext_params.aead_ctxt.auth_cipher_text = false; - cipher_xform = &xform->next->cipher; +if (xform->next !=NULL ) { + session->ext_params.aead_ctxt.auth_cipher_text = true; + auth_xform = &xform->next->auth; + } + }else if (xform->type ==RTE_CRYPTO_SYM_XFORM_AUTH ) { auth_xform = &xform->auth; +if (xform->next !=NULL ) { + session->ext_params.aead_ctxt.auth_cipher_text =false;
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +4
-1+ cipher_xform = &xform->next->cipher; + } }else {DPAA2_SEC_ERR ("Invalid crypto type" );return -EINVAL ;@@ -3177,7 +3177,8 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, session->pdcp.hfn_threshold = pdcp_xform->hfn_threshold; session->pdcp.hfn_ovd = pdcp_xform->hfn_ovrd;/* hfv ovd offset location is stored in iv.offset value*/ - session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset; +if (cipher_xform) + session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset; cipherdata.key = (size_t )session->cipher_key.data;cipherdata.keylen =
session->cipher_key.length;
--
2.17.1
Quoted 11 lines · Akhil Goyal
Quoted 5 lines
This patch fixes the issue to check for next pointer as null in the integrity only case in pdcp-security context.
Fixes bef594ec5cc8 ("crypto/dpaa2_sec: support PDCP offload")This patch is not a fix and need not be backported, because integrity only case is not a valid case for PDCP before the introduction of short MAC. Since short MAC is supported here in this release only, this should be reworded as to support short MAC, integrity-only case is required to be supported for PDCP.
And this patch should be part of the short MAC-I series and not this one.
Ok,
Quoted 66 lines
Quoted 66 lines
Signed-off-by Hemant Agrawal <[email protected]>--- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 25 +++++++++++---------- 1 file changed, 13 insertions(+), 12 deletions(-)drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +1
-1@@ -3095,7 +3095,7 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, struct rte_security_pdcp_xform *pdcp_xform = &conf->pdcp;struct rte_crypto_sym_xform *xform = conf->crypto_xform;struct rte_crypto_auth_xform *auth_xform =NULL ; -struct rte_crypto_cipher_xform *cipher_xform; +struct rte_crypto_cipher_xform *cipher_xform =NULL ;dpaa2_sec_session *session = (dpaa2_sec_session *)sess;struct ctxt_priv *priv;struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private;drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +8
-10@@ -3127,18 +3127,18 @@ dpaa2_sec_set_pdcp_session(structrte_cryptodev *dev, flc = &priv->flc_desc[0 ].flc;/* find xfrm types */ -if (xform->type ==RTE_CRYPTO_SYM_XFORM_CIPHER && xform- > next == NULL) { - cipher_xform = &xform->cipher; - }else if (xform->type ==RTE_CRYPTO_SYM_XFORM_CIPHER && - xform->next->type ==RTE_CRYPTO_SYM_XFORM_AUTH ) { - session->ext_params.aead_ctxt.auth_cipher_text = true; +if (xform->type ==RTE_CRYPTO_SYM_XFORM_CIPHER ) { cipher_xform = &xform->cipher; - auth_xform = &xform->next->auth; - }else if (xform->type ==RTE_CRYPTO_SYM_XFORM_AUTH && - xform->next->type ==RTE_CRYPTO_SYM_XFORM_CIPHER ) { - session->ext_params.aead_ctxt.auth_cipher_text = false; - cipher_xform = &xform->next->cipher; +if (xform->next !=NULL ) { + session->ext_params.aead_ctxt.auth_cipher_text = true; + auth_xform = &xform->next->auth; + } + }else if (xform->type ==RTE_CRYPTO_SYM_XFORM_AUTH ) { auth_xform = &xform->auth; +if (xform->next !=NULL ) { + session->ext_params.aead_ctxt.auth_cipher_text =false;
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +4
-1+ cipher_xform = &xform->next->cipher; + } }else {DPAA2_SEC_ERR ("Invalid crypto type" );return -EINVAL ;@@ -3177,7 +3177,8 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, session->pdcp.hfn_threshold = pdcp_xform->hfn_threshold; session->pdcp.hfn_ovd = pdcp_xform->hfn_ovrd;/* hfv ovd offset location is stored in iv.offset value*/ - session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset; +if (cipher_xform) + session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset; cipherdata.key = (size_t )session->cipher_key.data;cipherdata.keylen =
session->cipher_key.length;
--
2.17.1
PATCH v3 1/10 crypto/dpaa_sec: support DES-CBC
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
add DES-CBC support and enable available cipher-only test cases.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 1 + drivers/crypto/dpaa_sec/dpaa_sec.c | 13 +++++++++++++ drivers/crypto/dpaa_sec/dpaa_sec.h | 20 ++++++++++++++++++++ 3 files changed, 34 insertions(+)
doc/guides/cryptodevs/features/dpaa_sec.ini +1 -0
@@ -24,6 +24,7 @@ AES CBC (256) = Y AES CTR (128) = Y AES CTR (192) = Y AES CTR (256) = Y +DES CBC = Y 3DES CBC = Y SNOW3G UEA2 = Y ZUC EEA3 = Y
drivers/crypto/dpaa_sec/dpaa_sec.c +13 -0
@@ -451,6 +451,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses)switch (ses->cipher_alg) {case RTE_CRYPTO_CIPHER_AES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_AES_CTR :case RTE_CRYPTO_CIPHER_3DES_CTR : shared_desc_len = cnstr_shdsc_blkcipher(
@@ -2040,6 +2041,10 @@ dpaa_sec_cipher_init(struct rte_cryptodev *dev __rte_unused, session->cipher_key.alg =OP_ALG_ALGSEL_AES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;break ; +case RTE_CRYPTO_CIPHER_DES_CBC : + session->cipher_key.alg =OP_ALG_ALGSEL_DES ; + session->cipher_key.algmode =OP_ALG_AAI_CBC ; +break ;case RTE_CRYPTO_CIPHER_3DES_CBC : session->cipher_key.alg =OP_ALG_ALGSEL_3DES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;
@@ -2215,6 +2220,10 @@ dpaa_sec_chain_init(struct rte_cryptodev *dev __rte_unused, session->cipher_key.alg =OP_ALG_ALGSEL_AES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;break ; +case RTE_CRYPTO_CIPHER_DES_CBC : + session->cipher_key.alg =OP_ALG_ALGSEL_DES ; + session->cipher_key.algmode =OP_ALG_AAI_CBC ; +break ;case RTE_CRYPTO_CIPHER_3DES_CBC : session->cipher_key.alg =OP_ALG_ALGSEL_3DES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;
@@ -2664,6 +2673,10 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform, session->cipher_key.alg =OP_PCL_IPSEC_AES_CBC ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;break ; +case RTE_CRYPTO_CIPHER_DES_CBC : + session->cipher_key.alg =OP_PCL_IPSEC_DES ; + session->cipher_key.algmode =OP_ALG_AAI_CBC ; +break ;case RTE_CRYPTO_CIPHER_3DES_CBC : session->cipher_key.alg =OP_PCL_IPSEC_3DES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;
drivers/crypto/dpaa_sec/dpaa_sec.h +20 -0
@@ -482,6 +482,26 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = { }, } }, } }, + {/* DES CBC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type =RTE_CRYPTO_SYM_XFORM_CIPHER , + {.cipher = { + .algo =RTE_CRYPTO_CIPHER_DES_CBC , + .block_size = 8, + .key_size = { + .min =8 , + .max = 8, + .increment = 0 + }, + .iv_size = { + .min =8 , + .max = 8, + .increment = 0 + } + }, } + }, } + }, { /* 3DES CBC */ .op =RTE_CRYPTO_OP_TYPE_SYMMETRIC , {.sym = {
Signature · 1 line
2.17.1
PATCH v3 2/10 crypto/dpaa_sec: support non-HMAC auth algos
From: Gagandeep Singh <[email protected]>
This patch add support for non-HMAC, md5, shax algos.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 8 +- drivers/crypto/dpaa_sec/dpaa_sec.c | 55 +++++++-- drivers/crypto/dpaa_sec/dpaa_sec.h | 126 ++++++++++++++++++++ 3 files changed, 180 insertions(+), 9 deletions(-)
doc/guides/cryptodevs/features/dpaa_sec.ini +7 -1
@@ -33,11 +33,17 @@ ZUC EEA3 = Y ; Supported authentication algorithms of the 'dpaa_sec' crypto driver. ; [Auth] +MD5 = Y MD5 HMAC = Y +SHA1 = Y SHA1 HMAC = Y +SHA224 = Y SHA224 HMAC = Y +SHA256 = Y SHA256 HMAC = Y +SHA384 = Y SHA384 HMAC = Y +SHA512 = Y SHA512 HMAC = Y SNOW3G UIA2 = Y ZUC EIA3 = Y
@@ -53,4 +59,4 @@ AES GCM (256) = Y ; ; Supported Asymmetric algorithms of the 'dpaa_sec' crypto driver. ; -[Asymmetric] +[Asymmetric]
drivers/crypto/dpaa_sec/dpaa_sec.c +47 -8
96 lines not on this page · raw message
drivers/crypto/dpaa_sec/dpaa_sec.h +126 -0
162 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 3/10 crypto/dpaa_sec: support AES-XCBC-MAC
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
This patch adds support for AES-XCBC-MAC algo.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 1 + drivers/crypto/dpaa_sec/dpaa_sec.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-)
doc/guides/cryptodevs/features/dpaa_sec.ini +1 -0
@@ -47,6 +47,7 @@ SHA512 = Y SHA512 HMAC = Y SNOW3G UIA2 = Y ZUC EIA3 = Y +AES XCBC MAC = Y ; ; Supported AEAD algorithms of the 'dpaa_sec' crypto driver.
drivers/crypto/dpaa_sec/dpaa_sec.c +20 -1
@@ -524,6 +524,14 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) !ses->dir, ses->digest_length);break ; +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + shared_desc_len =cnstr_shdsc_aes_mac ( + cdb->sh_desc, + true, swap,SHR_NEVER , + &alginfo_a, + !ses->dir, + ses->digest_length); +break ;default :DPAA_SEC_ERR ("unsupported auth alg %u" , ses->auth_alg); }
@@ -2165,6 +2173,10 @@ dpaa_sec_auth_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_ZUCA ; session->auth_key.algmode =OP_ALG_AAI_F9 ;break ; +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , xform->auth.algo);
@@ -2246,6 +2258,10 @@ dpaa_sec_chain_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_SHA512 ; session->auth_key.algmode =OP_ALG_AAI_HMAC ;break ; +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , auth_xform->algo);
@@ -2685,8 +2701,11 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform,case RTE_CRYPTO_AUTH_NULL : session->auth_key.alg =OP_PCL_IPSEC_HMAC_NULL ;break ; -case RTE_CRYPTO_AUTH_SHA224_HMAC :case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + session->auth_key.alg =OP_PCL_IPSEC_AES_XCBC_MAC_96 ; + session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ; +break ; +case RTE_CRYPTO_AUTH_SHA224_HMAC :case RTE_CRYPTO_AUTH_SNOW3G_UIA2 :case RTE_CRYPTO_AUTH_SHA1 :case RTE_CRYPTO_AUTH_SHA256 :
Signature · 1 line
2.17.1
PATCH v3 4/10 crypto/dpaa_sec: add support for AES CMAC integrity check
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
This patch adds support for AES_CMAC integrity in non-security mode.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 1 + drivers/crypto/dpaa_sec/dpaa_sec.c | 10 +++++ drivers/crypto/dpaa_sec/dpaa_sec.h | 43 +++++++++++++++++++++ 3 files changed, 54 insertions(+)
doc/guides/cryptodevs/features/dpaa_sec.ini +1 -0
@@ -48,6 +48,7 @@ SHA512 HMAC = Y SNOW3G UIA2 = Y ZUC EIA3 = Y AES XCBC MAC = Y +AES CMAC (128) = Y ; ; Supported AEAD algorithms of the 'dpaa_sec' crypto driver.
drivers/crypto/dpaa_sec/dpaa_sec.c +10 -0
@@ -525,6 +525,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) ses->digest_length);break ;case RTE_CRYPTO_AUTH_AES_XCBC_MAC : +case RTE_CRYPTO_AUTH_AES_CMAC : shared_desc_len = cnstr_shdsc_aes_mac( cdb->sh_desc, true, swap, SHR_NEVER,
@@ -2177,6 +2178,10 @@ dpaa_sec_auth_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_AES ; session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ;break ; +case RTE_CRYPTO_AUTH_AES_CMAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , xform->auth.algo);
@@ -2262,6 +2267,10 @@ dpaa_sec_chain_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_AES ; session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ;break ; +case RTE_CRYPTO_AUTH_AES_CMAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , auth_xform->algo);
@@ -2697,6 +2706,7 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform,break ;case RTE_CRYPTO_AUTH_AES_CMAC : session->auth_key.alg =OP_PCL_IPSEC_AES_CMAC_96 ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ;break ;case RTE_CRYPTO_AUTH_NULL : session->auth_key.alg =OP_PCL_IPSEC_HMAC_NULL ;
drivers/crypto/dpaa_sec/dpaa_sec.h +43 -0
49 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 5/10 common/dpaax: caamflib load correct HFN from DESCBUF
In reply to Hemant AgrawalFrom: Franck LENORMAND <[email protected]>
The offset of the HFn word and Bearer/Dir word is different depending on type of PDB.
The wrong value was used.
This patch address this issue
--- drivers/common/dpaax/caamflib/desc/pdcp.h | 7 +- drivers/common/dpaax/caamflib/desc/sdap.h | 96 ++++++++++++++++++----- 2 files changed, 80 insertions(+), 23 deletions(-)
drivers/common/dpaax/caamflib/desc/pdcp.h +5 -2
@@ -270,6 +270,9 @@ enum pdb_type_e { PDCP_PDB_TYPE_INVALID }; +#define REDUCED_PDB_DESCBUF_HFN_BEARER_DIR_OFFSET 4 +#define FULL_PDB_DESCBUF_HFN_BEARER_DIR_OFFSET 8 +/** * rta_inline_pdcp_query() - Provide indications if a key can be passed as * immediate data or shall be referenced in a
@@ -2564,11 +2567,11 @@ insert_hfn_ov_op(struct program *p,return 0 ;case PDCP_PDB_TYPE_REDUCED_PDB : - hfn_pdb_offset =4 ; + hfn_pdb_offset =REDUCED_PDB_DESCBUF_HFN_BEARER_DIR_OFFSET ;break ;case PDCP_PDB_TYPE_FULL_PDB : - hfn_pdb_offset =8 ; + hfn_pdb_offset =FULL_PDB_DESCBUF_HFN_BEARER_DIR_OFFSET ;break ;default :
drivers/common/dpaax/caamflib/desc/sdap.h +75 -21
200 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 6/10 common/dpaax: caamflib do not clear DPOVRD
In reply to Hemant AgrawalFrom: Franck LENORMAND <[email protected]>
For SDAP, we are not using the protocol operation to perform 4G/LTE operation so the DPOVRD option is not used.
Removing it save some space in the descriptor buffer and execution time.
--- drivers/common/dpaax/caamflib/desc/pdcp.h | 14 ++++++++------ drivers/common/dpaax/caamflib/desc/sdap.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-)
drivers/common/dpaax/caamflib/desc/pdcp.h +8 -6
@@ -2546,7 +2546,8 @@ static inline int insert_hfn_ov_op(struct program *p, uint32_t shift, enum pdb_type_e pdb_type, - unsigned char era_2_sw_hfn_ovrd) + unsigned char era_2_sw_hfn_ovrd, + bool clear_dpovrd_at_end) { uint32_t imm = PDCP_DPOVRD_HFN_OV_EN;uint16_t hfn_pdb_offset;
@@ -2597,13 +2598,14 @@ insert_hfn_ov_op(struct program *p,MATHB (p,MATH0 ,SHLD ,MATH0 ,MATH0 ,8 ,0 );MOVE (p,MATH0 ,0 ,DESCBUF , hfn_pdb_offset,4 ,IMMED ); -if (rta_sec_era >=RTA_SEC_ERA_8 ) +if (clear_dpovrd_at_end && (rta_sec_era >=RTA_SEC_ERA_8 )) {/* * For ERA8, DPOVRD could be handled by the PROTOCOL command * itself. For now, this is not done. Thus, clear DPOVRD here * to alleviate any side-effects. */ MATHB (p,DPOVRD ,AND ,ZERO ,DPOVRD ,4 ,STL ); + }SET_LABEL (p, keyjump);PATCH_JUMP (p, pkeyjump, keyjump);
@@ -2989,7 +2991,7 @@ cnstr_shdsc_pdcp_c_plane_encap(uint32_t *descbuf,SET_LABEL (p, pdb_end); err =insert_hfn_ov_op (p, sn_size, pdb_type, - era_2_sw_hfn_ovrd); + era_2_sw_hfn_ovrd, true);if (err)return err;
@@ -3143,7 +3145,7 @@ cnstr_shdsc_pdcp_c_plane_decap(uint32_t *descbuf,SET_LABEL (p, pdb_end); err =insert_hfn_ov_op (p, sn_size, pdb_type, - era_2_sw_hfn_ovrd); + era_2_sw_hfn_ovrd, true);if (err)return err;
@@ -3319,7 +3321,7 @@ cnstr_shdsc_pdcp_u_plane_encap(uint32_t *descbuf, }SET_LABEL (p, pdb_end); - err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd); + err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd, true);if (err)return err;
@@ -3523,7 +3525,7 @@ cnstr_shdsc_pdcp_u_plane_decap(uint32_t *descbuf, }SET_LABEL (p, pdb_end); - err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd); + err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd, true);if (err)return err;
drivers/common/dpaax/caamflib/desc/sdap.h +1 -1
@@ -990,7 +990,7 @@ cnstr_shdsc_pdcp_sdap_u_plane(uint32_t *descbuf,SET_LABEL (p, pdb_end);/* Inser the HFN override operation */ - err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd); + err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd, false);if (err)return err;
Signature · 1 line
2.17.1
PATCH v3 7/10 common/dpaax: enhance caamflib with inline keys
In reply to Hemant AgrawalFrom: Franck LENORMAND <[email protected]>
The space in descriptor buffer is scarce as it is limited to 64 words for platforms except ERA10 (which has 128).
As the descriptors are processed with QI, it adds some words to the descriptor which is passed.
Some descriptors used for SDAP were using too much words reaching the limit.
This patch reduces the number of words used by removing the inlining of some keys (done for performance) in order to have working descriptors.
--- drivers/common/dpaax/caamflib/desc/sdap.h | 61 ++++++++++++++++++++- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 28 ++++++++-- 2 files changed, 81 insertions(+), 8 deletions(-)
drivers/common/dpaax/caamflib/desc/sdap.h +59 -2
@@ -20,6 +20,63 @@#define SDAP_BITS_SIZE (SDAP_BYTE_SIZE * 8)#endif +/** +* rta_inline_pdcp_query() - Provide indications if a key can be passed as +* immediate data or shall be referenced in a +* shared descriptor. +* Return: 0 if data can be inlined or 1 if referenced. +*/ +static inline int +rta_inline_pdcp_sdap_query (enum auth_type_pdcp auth_alg, +enum cipher_type_pdcp cipher_alg, +enum pdcp_sn_size sn_size, +int8_t hfn_ovd) +{ +int nb_key_to_inline =0 ; + +if ((cipher_alg !=PDCP_CIPHER_TYPE_NULL ) && + (auth_alg !=PDCP_AUTH_TYPE_NULL )) +return 2 ; +else +return 0 ; + +/** +* Shared Descriptors for some of the cases does not fit in the +* MAX_DESC_SIZE of the descriptor +* The cases which exceed are for RTA_SEC_ERA=8 and HFN override +* enabled and 12/18 bit uplane and either of following Algo combo. +* - AES-SNOW +* - AES-ZUC +* - SNOW-SNOW +* - SNOW-ZUC +* - ZUC-SNOW +* - ZUC-SNOW +* +* We cannot make inline for all cases, as this will impact performance +* due to extra memory accesses for the keys. +*/ + +/* Inline only the cipher key */ +if ((rta_sec_era ==RTA_SEC_ERA_8 ) && hfn_ovd && + ((sn_size ==PDCP_SN_SIZE_12 ) || + (sn_size ==PDCP_SN_SIZE_18 )) && + (cipher_alg !=PDCP_CIPHER_TYPE_NULL ) && + ((auth_alg ==PDCP_AUTH_TYPE_SNOW ) || + (auth_alg ==PDCP_AUTH_TYPE_ZUC ))) { + + nb_key_to_inline++; + +/* Sub case where inlining another key is required */ +if ((cipher_alg ==PDCP_CIPHER_TYPE_AES ) && + (auth_alg ==PDCP_AUTH_TYPE_SNOW )) + nb_key_to_inline++; + } + +/* Inline both keys */ + +return nb_key_to_inline; +} +static inline void key_loading_opti (struct program *p,struct alginfo *cipherdata,struct alginfo *authdata)
@@ -788,8 +845,8 @@ pdcp_sdap_insert_cplane_null_op(struct program *p,unsigned char era_2_sw_hfn_ovrd, enum pdb_type_e pdb_type __maybe_unused) { - return pdcp_insert_cplane_int_only_op(p, swap, cipherdata, authdata, -dir ,sn_size ,era_2_sw_hfn_ovrd ); + return pdcp_insert_cplane_null_op(p, swap, cipherdata, authdata, dir, +sn_size ,era_2_sw_hfn_ovrd ); } static inline int
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +22 -6
@@ -3254,12 +3254,28 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, goto out; } -if (rta_inline_pdcp_query (authdata.algtype, - cipherdata.algtype, - session->pdcp.sn_size, - session->pdcp.hfn_ovd)) { - cipherdata.key =DPAA2_VADDR_TO_IOVA (cipherdata.key); - cipherdata.key_type =RTA_DATA_PTR ; +if (pdcp_xform->sdap_enabled) { +int nb_keys_to_inline = +rta_inline_pdcp_sdap_query (authdata.algtype, + cipherdata.algtype, + session->pdcp.sn_size, + session->pdcp.hfn_ovd); +if (nb_keys_to_inline >=1 ) { + cipherdata.key =DPAA2_VADDR_TO_IOVA (cipherdata.key); + cipherdata.key_type =RTA_DATA_PTR ; + } +if (nb_keys_to_inline >=2 ) { + authdata.key =DPAA2_VADDR_TO_IOVA (authdata.key); + authdata.key_type =RTA_DATA_PTR ; + } + }else { +if (rta_inline_pdcp_query (authdata.algtype, + cipherdata.algtype, + session->pdcp.sn_size, + session->pdcp.hfn_ovd)) { + cipherdata.key =DPAA2_VADDR_TO_IOVA (cipherdata.key); + cipherdata.key_type =RTA_DATA_PTR ; + } }if (pdcp_xform->domain ==RTE_SECURITY_PDCP_MODE_CONTROL ) {
Signature · 1 line
2.17.1
PATCH v3 8/10 common/dpaax: fix IV value for shortMAC-I for SNOW algo
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
The logic was incorecly doing conditional swap. It need to be bit swap always.
--- drivers/common/dpaax/caamflib/desc/pdcp.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/common/dpaax/caamflib/desc/pdcp.h +4 -3
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: BSD-3-Clause or GPL-2.0+ * Copyright 2008-2013 Freescale Semiconductor, Inc. -* Copyright 2019-2020 NXP +* Copyright 2019-2021 NXP */ #ifndef __DESC_PDCP_H__
@@ -3715,9 +3715,10 @@ cnstr_shdsc_pdcp_short_mac(uint32_t *descbuf,break ;case PDCP_AUTH_TYPE_SNOW : +/* IV calculation based on 3GPP specs. 36331, section:5.3.7.4 */ iv[0 ] =0xFFFFFFFF ; - iv[1 ] = swap ?swab32 (0x04000000 ) :0x04000000 ; - iv[2 ] = swap ?swab32 (0xF8000000 ) :0xF8000000 ; + iv[1 ] =swab32 (0x04000000 ); + iv[2 ] =swab32 (0xF8000000 );KEY (p,KEY2 , authdata->key_enc_flags, authdata->key, authdata->keylen,INLINE_KEY (authdata));
Signature · 1 line
2.17.1
PATCH v3 9/10 crypto/dpaa_sec: force inline of the keys to save space
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
This patch improve storage and performance by force inline of the keys.
--- drivers/crypto/dpaa_sec/dpaa_sec.c | 35 ++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-)
drivers/crypto/dpaa_sec/dpaa_sec.c +26 -9
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. -* Copyright 2017-2019 NXP +* Copyright 2017-2021 NXP * */
@@ -260,14 +260,31 @@ dpaa_sec_prep_pdcp_cdb(dpaa_sec_session *ses) p_authdata = &authdata; } -if (rta_inline_pdcp_query (authdata.algtype, - cipherdata.algtype, - ses->pdcp.sn_size, - ses->pdcp.hfn_ovd)) { - cipherdata.key = - (size_t )rte_dpaa_mem_vtop ((void *) - (size_t )cipherdata.key); - cipherdata.key_type =RTA_DATA_PTR ; +if (ses->pdcp.sdap_enabled) { +int nb_keys_to_inline = +rta_inline_pdcp_sdap_query (authdata.algtype, + cipherdata.algtype, + ses->pdcp.sn_size, + ses->pdcp.hfn_ovd); +if (nb_keys_to_inline >=1 ) { + cipherdata.key = (size_t )rte_dpaa_mem_vtop ((void *) + (size_t )cipherdata.key); + cipherdata.key_type =RTA_DATA_PTR ; + } +if (nb_keys_to_inline >=2 ) { + authdata.key = (size_t )rte_dpaa_mem_vtop ((void *) + (size_t )authdata.key); + authdata.key_type =RTA_DATA_PTR ; + } + }else { +if (rta_inline_pdcp_query (authdata.algtype, + cipherdata.algtype, + ses->pdcp.sn_size, + ses->pdcp.hfn_ovd)) { + cipherdata.key = (size_t )rte_dpaa_mem_vtop ((void *) + (size_t )cipherdata.key); + cipherdata.key_type =RTA_DATA_PTR ; + } }if (ses->pdcp.domain ==RTE_SECURITY_PDCP_MODE_CONTROL ) {
Signature · 1 line
2.17.1
PATCH v3 10/10 crypto/dpaa2_sec: add error packet counters
In reply to Hemant AgrawalThis patch add support to also counter err pkt counter per queue. This also enhances few related debug prints.
--- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +4 -2
@@ -1702,8 +1702,9 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops,if (unlikely (fd->simple.frc)) {/* TODO Parse SEC errors */ -DPAA2_SEC_ERR ("SEC returned Error - %x" , +DPAA2_SEC_DP_ERR ("SEC returned Error - %x\n" , fd->simple.frc); + dpaa2_qp->rx_vq.err_pkts +=1 ; ops[num_rx]->status =RTE_CRYPTO_OP_STATUS_ERROR ; }else { ops[num_rx]->status =RTE_CRYPTO_OP_STATUS_SUCCESS ;
@@ -1715,7 +1716,8 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops, dpaa2_qp->rx_vq.rx_pkts += num_rx; -DPAA2_SEC_DP_DEBUG ("SEC Received %d Packets\n" , num_rx); +DPAA2_SEC_DP_DEBUG ("SEC RX pkts %d err pkts %" PRIu64"\n" , num_rx, + dpaa2_qp->rx_vq.err_pkts);/*Return the total number of packets received to DPAA2 app*/ return num_rx; }
Signature · 1 line
2.17.1
Re: [dpdk-dev] [EXT] [PATCH v3 01/10] crypto/dpaa_sec: support DES-CBC
In reply to Hemant AgrawalQuoted 8 lines
From: Gagandeep Singh <[email protected]>
add DES-CBC support and enable available cipher-only test cases.
Signed-off-by Gagandeep Singh <[email protected]>---
Release notes missing for the new features added in PMDs. Please update sequentially in each of the patches.
PATCH v4 1/10 crypto/dpaa_sec: support DES-CBC
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
add DES-CBC support and enable available cipher-only test cases.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 1 + doc/guides/rel_notes/release_21_11.rst | 3 +++ drivers/crypto/dpaa_sec/dpaa_sec.c | 13 +++++++++++++ drivers/crypto/dpaa_sec/dpaa_sec.h | 20 ++++++++++++++++++++ 4 files changed, 37 insertions(+)
doc/guides/cryptodevs/features/dpaa_sec.ini +1 -0
@@ -24,6 +24,7 @@ AES CBC (256) = Y AES CTR (128) = Y AES CTR (192) = Y AES CTR (256) = Y +DES CBC = Y 3DES CBC = Y SNOW3G UEA2 = Y ZUC EEA3 = Y
doc/guides/rel_notes/release_21_11.rst +3 -0
@@ -73,6 +73,9 @@ New Features * Added event crypto adapter OP_FORWARD mode support. +* **Updated NXP dpaa_sec crypto PMD.** + + * Added DES-CBC algo support Removed Items -------------
drivers/crypto/dpaa_sec/dpaa_sec.c +13 -0
@@ -454,6 +454,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses)switch (ses->cipher_alg) {case RTE_CRYPTO_CIPHER_AES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_AES_CTR :case RTE_CRYPTO_CIPHER_3DES_CTR : shared_desc_len = cnstr_shdsc_blkcipher(
@@ -2043,6 +2044,10 @@ dpaa_sec_cipher_init(struct rte_cryptodev *dev __rte_unused, session->cipher_key.alg =OP_ALG_ALGSEL_AES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;break ; +case RTE_CRYPTO_CIPHER_DES_CBC : + session->cipher_key.alg =OP_ALG_ALGSEL_DES ; + session->cipher_key.algmode =OP_ALG_AAI_CBC ; +break ;case RTE_CRYPTO_CIPHER_3DES_CBC : session->cipher_key.alg =OP_ALG_ALGSEL_3DES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;
@@ -2218,6 +2223,10 @@ dpaa_sec_chain_init(struct rte_cryptodev *dev __rte_unused, session->cipher_key.alg =OP_ALG_ALGSEL_AES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;break ; +case RTE_CRYPTO_CIPHER_DES_CBC : + session->cipher_key.alg =OP_ALG_ALGSEL_DES ; + session->cipher_key.algmode =OP_ALG_AAI_CBC ; +break ;case RTE_CRYPTO_CIPHER_3DES_CBC : session->cipher_key.alg =OP_ALG_ALGSEL_3DES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;
@@ -2667,6 +2676,10 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform, session->cipher_key.alg =OP_PCL_IPSEC_AES_CBC ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;break ; +case RTE_CRYPTO_CIPHER_DES_CBC : + session->cipher_key.alg =OP_PCL_IPSEC_DES ; + session->cipher_key.algmode =OP_ALG_AAI_CBC ; +break ;case RTE_CRYPTO_CIPHER_3DES_CBC : session->cipher_key.alg =OP_PCL_IPSEC_3DES ; session->cipher_key.algmode =OP_ALG_AAI_CBC ;
drivers/crypto/dpaa_sec/dpaa_sec.h +20 -0
@@ -456,6 +456,26 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = { }, } }, } }, + {/* DES CBC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type =RTE_CRYPTO_SYM_XFORM_CIPHER , + {.cipher = { + .algo =RTE_CRYPTO_CIPHER_DES_CBC , + .block_size = 8, + .key_size = { + .min =8 , + .max = 8, + .increment = 0 + }, + .iv_size = { + .min =8 , + .max = 8, + .increment = 0 + } + }, } + }, } + }, { /* 3DES CBC */ .op =RTE_CRYPTO_OP_TYPE_SYMMETRIC , {.sym = {
Signature · 1 line
2.17.1
PATCH v4 2/10 crypto/dpaa_sec: support non-HMAC auth algos
From: Gagandeep Singh <[email protected]>
This patch add support for non-HMAC, md5, shax algos.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 8 +- doc/guides/rel_notes/release_21_11.rst | 2 +- drivers/crypto/dpaa_sec/dpaa_sec.c | 55 +++++++-- drivers/crypto/dpaa_sec/dpaa_sec.h | 126 ++++++++++++++++++++ 4 files changed, 181 insertions(+), 10 deletions(-)
doc/guides/cryptodevs/features/dpaa_sec.ini +7 -1
@@ -33,11 +33,17 @@ ZUC EEA3 = Y ; Supported authentication algorithms of the 'dpaa_sec' crypto driver. ; [Auth] +MD5 = Y MD5 HMAC = Y +SHA1 = Y SHA1 HMAC = Y +SHA224 = Y SHA224 HMAC = Y +SHA256 = Y SHA256 HMAC = Y +SHA384 = Y SHA384 HMAC = Y +SHA512 = Y SHA512 HMAC = Y SNOW3G UIA2 = Y ZUC EIA3 = Y
@@ -53,4 +59,4 @@ AES GCM (256) = Y ; ; Supported Asymmetric algorithms of the 'dpaa_sec' crypto driver. ; -[Asymmetric] +[Asymmetric]
doc/guides/rel_notes/release_21_11.rst +1 -1
@@ -75,7 +75,7 @@ New Features * **Updated NXP dpaa_sec crypto PMD.** - * Added DES-CBC algo support + * Added DES-CBC and non-HMAC algo support Removed Items -------------
drivers/crypto/dpaa_sec/dpaa_sec.c +47 -8
96 lines not on this page · raw message
drivers/crypto/dpaa_sec/dpaa_sec.h +126 -0
162 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v4 3/10 crypto/dpaa_sec: support AES-XCBC-MAC
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
This patch adds support for AES-XCBC-MAC algo.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 1 + doc/guides/rel_notes/release_21_11.rst | 2 +- drivers/crypto/dpaa_sec/dpaa_sec.c | 21 ++++++++++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-)
doc/guides/cryptodevs/features/dpaa_sec.ini +1 -0
@@ -47,6 +47,7 @@ SHA512 = Y SHA512 HMAC = Y SNOW3G UIA2 = Y ZUC EIA3 = Y +AES XCBC MAC = Y ; ; Supported AEAD algorithms of the 'dpaa_sec' crypto driver.
doc/guides/rel_notes/release_21_11.rst +1 -1
@@ -75,7 +75,7 @@ New Features * **Updated NXP dpaa_sec crypto PMD.** - * Added DES-CBC and non-HMAC algo support + * Added DES-CBC, AES-XCBC-MAC and non-HMAC algo support Removed Items -------------
drivers/crypto/dpaa_sec/dpaa_sec.c +20 -1
@@ -527,6 +527,14 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) !ses->dir, ses->digest_length);break ; +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + shared_desc_len =cnstr_shdsc_aes_mac ( + cdb->sh_desc, + true, swap,SHR_NEVER , + &alginfo_a, + !ses->dir, + ses->digest_length); +break ;default :DPAA_SEC_ERR ("unsupported auth alg %u" , ses->auth_alg); }
@@ -2168,6 +2176,10 @@ dpaa_sec_auth_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_ZUCA ; session->auth_key.algmode =OP_ALG_AAI_F9 ;break ; +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , xform->auth.algo);
@@ -2249,6 +2261,10 @@ dpaa_sec_chain_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_SHA512 ; session->auth_key.algmode =OP_ALG_AAI_HMAC ;break ; +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , auth_xform->algo);
@@ -2688,8 +2704,11 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform,case RTE_CRYPTO_AUTH_NULL : session->auth_key.alg =OP_PCL_IPSEC_HMAC_NULL ;break ; -case RTE_CRYPTO_AUTH_SHA224_HMAC :case RTE_CRYPTO_AUTH_AES_XCBC_MAC : + session->auth_key.alg =OP_PCL_IPSEC_AES_XCBC_MAC_96 ; + session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ; +break ; +case RTE_CRYPTO_AUTH_SHA224_HMAC :case RTE_CRYPTO_AUTH_SNOW3G_UIA2 :case RTE_CRYPTO_AUTH_SHA1 :case RTE_CRYPTO_AUTH_SHA256 :
Signature · 1 line
2.17.1
PATCH v4 4/10 crypto/dpaa_sec: add support for AES CMAC integrity check
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
This patch adds support for AES_CMAC integrity in non-security mode.
--- doc/guides/cryptodevs/features/dpaa_sec.ini | 1 + doc/guides/rel_notes/release_21_11.rst | 2 +- drivers/crypto/dpaa_sec/dpaa_sec.c | 10 +++++ drivers/crypto/dpaa_sec/dpaa_sec.h | 43 +++++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-)
doc/guides/cryptodevs/features/dpaa_sec.ini +1 -0
@@ -48,6 +48,7 @@ SHA512 HMAC = Y SNOW3G UIA2 = Y ZUC EIA3 = Y AES XCBC MAC = Y +AES CMAC (128) = Y ; ; Supported AEAD algorithms of the 'dpaa_sec' crypto driver.
doc/guides/rel_notes/release_21_11.rst +1 -1
@@ -75,7 +75,7 @@ New Features * **Updated NXP dpaa_sec crypto PMD.** - * Added DES-CBC, AES-XCBC-MAC and non-HMAC algo support + * Added DES-CBC, AES-XCBC-MAC, AES-CMAC and non-HMAC algo support Removed Items -------------
drivers/crypto/dpaa_sec/dpaa_sec.c +10 -0
@@ -528,6 +528,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) ses->digest_length);break ;case RTE_CRYPTO_AUTH_AES_XCBC_MAC : +case RTE_CRYPTO_AUTH_AES_CMAC : shared_desc_len = cnstr_shdsc_aes_mac( cdb->sh_desc, true, swap, SHR_NEVER,
@@ -2180,6 +2181,10 @@ dpaa_sec_auth_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_AES ; session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ;break ; +case RTE_CRYPTO_AUTH_AES_CMAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , xform->auth.algo);
@@ -2265,6 +2270,10 @@ dpaa_sec_chain_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg =OP_ALG_ALGSEL_AES ; session->auth_key.algmode =OP_ALG_AAI_XCBC_MAC ;break ; +case RTE_CRYPTO_AUTH_AES_CMAC : + session->auth_key.alg =OP_ALG_ALGSEL_AES ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ; +break ;default :DPAA_SEC_ERR ("Crypto: Unsupported Auth specified %u" , auth_xform->algo);
@@ -2700,6 +2709,7 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform,break ;case RTE_CRYPTO_AUTH_AES_CMAC : session->auth_key.alg =OP_PCL_IPSEC_AES_CMAC_96 ; + session->auth_key.algmode =OP_ALG_AAI_CMAC ;break ;case RTE_CRYPTO_AUTH_NULL : session->auth_key.alg =OP_PCL_IPSEC_HMAC_NULL ;
drivers/crypto/dpaa_sec/dpaa_sec.h +43 -0
49 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v4 5/10 common/dpaax: caamflib load correct HFN from DESCBUF
In reply to Hemant AgrawalFrom: Franck LENORMAND <[email protected]>
The offset of the HFn word and Bearer/Dir word is different depending on type of PDB.
The wrong value was used.
This patch address this issue
--- drivers/common/dpaax/caamflib/desc/pdcp.h | 7 +- drivers/common/dpaax/caamflib/desc/sdap.h | 96 ++++++++++++++++++----- 2 files changed, 80 insertions(+), 23 deletions(-)
drivers/common/dpaax/caamflib/desc/pdcp.h +5 -2
@@ -270,6 +270,9 @@ enum pdb_type_e { PDCP_PDB_TYPE_INVALID }; +#define REDUCED_PDB_DESCBUF_HFN_BEARER_DIR_OFFSET 4 +#define FULL_PDB_DESCBUF_HFN_BEARER_DIR_OFFSET 8 +/** * rta_inline_pdcp_query() - Provide indications if a key can be passed as * immediate data or shall be referenced in a
@@ -2564,11 +2567,11 @@ insert_hfn_ov_op(struct program *p,return 0 ;case PDCP_PDB_TYPE_REDUCED_PDB : - hfn_pdb_offset =4 ; + hfn_pdb_offset =REDUCED_PDB_DESCBUF_HFN_BEARER_DIR_OFFSET ;break ;case PDCP_PDB_TYPE_FULL_PDB : - hfn_pdb_offset =8 ; + hfn_pdb_offset =FULL_PDB_DESCBUF_HFN_BEARER_DIR_OFFSET ;break ;default :
drivers/common/dpaax/caamflib/desc/sdap.h +75 -21
200 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v4 6/10 common/dpaax: caamflib do not clear DPOVRD
In reply to Hemant AgrawalFrom: Franck LENORMAND <[email protected]>
For SDAP, we are not using the protocol operation to perform 4G/LTE operation so the DPOVRD option is not used.
Removing it save some space in the descriptor buffer and execution time.
--- drivers/common/dpaax/caamflib/desc/pdcp.h | 14 ++++++++------ drivers/common/dpaax/caamflib/desc/sdap.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-)
drivers/common/dpaax/caamflib/desc/pdcp.h +8 -6
@@ -2546,7 +2546,8 @@ static inline int insert_hfn_ov_op(struct program *p, uint32_t shift, enum pdb_type_e pdb_type, - unsigned char era_2_sw_hfn_ovrd) + unsigned char era_2_sw_hfn_ovrd, + bool clear_dpovrd_at_end) { uint32_t imm = PDCP_DPOVRD_HFN_OV_EN;uint16_t hfn_pdb_offset;
@@ -2597,13 +2598,14 @@ insert_hfn_ov_op(struct program *p,MATHB (p,MATH0 ,SHLD ,MATH0 ,MATH0 ,8 ,0 );MOVE (p,MATH0 ,0 ,DESCBUF , hfn_pdb_offset,4 ,IMMED ); -if (rta_sec_era >=RTA_SEC_ERA_8 ) +if (clear_dpovrd_at_end && (rta_sec_era >=RTA_SEC_ERA_8 )) {/* * For ERA8, DPOVRD could be handled by the PROTOCOL command * itself. For now, this is not done. Thus, clear DPOVRD here * to alleviate any side-effects. */ MATHB (p,DPOVRD ,AND ,ZERO ,DPOVRD ,4 ,STL ); + }SET_LABEL (p, keyjump);PATCH_JUMP (p, pkeyjump, keyjump);
@@ -2989,7 +2991,7 @@ cnstr_shdsc_pdcp_c_plane_encap(uint32_t *descbuf,SET_LABEL (p, pdb_end); err =insert_hfn_ov_op (p, sn_size, pdb_type, - era_2_sw_hfn_ovrd); + era_2_sw_hfn_ovrd, true);if (err)return err;
@@ -3143,7 +3145,7 @@ cnstr_shdsc_pdcp_c_plane_decap(uint32_t *descbuf,SET_LABEL (p, pdb_end); err =insert_hfn_ov_op (p, sn_size, pdb_type, - era_2_sw_hfn_ovrd); + era_2_sw_hfn_ovrd, true);if (err)return err;
@@ -3319,7 +3321,7 @@ cnstr_shdsc_pdcp_u_plane_encap(uint32_t *descbuf, }SET_LABEL (p, pdb_end); - err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd); + err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd, true);if (err)return err;
@@ -3523,7 +3525,7 @@ cnstr_shdsc_pdcp_u_plane_decap(uint32_t *descbuf, }SET_LABEL (p, pdb_end); - err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd); + err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd, true);if (err)return err;
drivers/common/dpaax/caamflib/desc/sdap.h +1 -1
@@ -990,7 +990,7 @@ cnstr_shdsc_pdcp_sdap_u_plane(uint32_t *descbuf,SET_LABEL (p, pdb_end);/* Inser the HFN override operation */ - err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd); + err =insert_hfn_ov_op (p, sn_size, pdb_type, era_2_sw_hfn_ovrd, false);if (err)return err;
Signature · 1 line
2.17.1
PATCH v4 7/10 common/dpaax: enhance caamflib with inline keys
In reply to Hemant AgrawalFrom: Franck LENORMAND <[email protected]>
The space in descriptor buffer is scarce as it is limited to 64 words for platforms except ERA10 (which has 128).
As the descriptors are processed with QI, it adds some words to the descriptor which is passed.
Some descriptors used for SDAP were using too much words reaching the limit.
This patch reduces the number of words used by removing the inlining of some keys (done for performance) in order to have working descriptors.
--- drivers/common/dpaax/caamflib/desc/sdap.h | 61 ++++++++++++++++++++- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 28 ++++++++-- 2 files changed, 81 insertions(+), 8 deletions(-)
drivers/common/dpaax/caamflib/desc/sdap.h +59 -2
@@ -20,6 +20,63 @@#define SDAP_BITS_SIZE (SDAP_BYTE_SIZE * 8)#endif +/** +* rta_inline_pdcp_query() - Provide indications if a key can be passed as +* immediate data or shall be referenced in a +* shared descriptor. +* Return: 0 if data can be inlined or 1 if referenced. +*/ +static inline int +rta_inline_pdcp_sdap_query (enum auth_type_pdcp auth_alg, +enum cipher_type_pdcp cipher_alg, +enum pdcp_sn_size sn_size, +int8_t hfn_ovd) +{ +int nb_key_to_inline =0 ; + +if ((cipher_alg !=PDCP_CIPHER_TYPE_NULL ) && + (auth_alg !=PDCP_AUTH_TYPE_NULL )) +return 2 ; +else +return 0 ; + +/** +* Shared Descriptors for some of the cases does not fit in the +* MAX_DESC_SIZE of the descriptor +* The cases which exceed are for RTA_SEC_ERA=8 and HFN override +* enabled and 12/18 bit uplane and either of following Algo combo. +* - AES-SNOW +* - AES-ZUC +* - SNOW-SNOW +* - SNOW-ZUC +* - ZUC-SNOW +* - ZUC-SNOW +* +* We cannot make inline for all cases, as this will impact performance +* due to extra memory accesses for the keys. +*/ + +/* Inline only the cipher key */ +if ((rta_sec_era ==RTA_SEC_ERA_8 ) && hfn_ovd && + ((sn_size ==PDCP_SN_SIZE_12 ) || + (sn_size ==PDCP_SN_SIZE_18 )) && + (cipher_alg !=PDCP_CIPHER_TYPE_NULL ) && + ((auth_alg ==PDCP_AUTH_TYPE_SNOW ) || + (auth_alg ==PDCP_AUTH_TYPE_ZUC ))) { + + nb_key_to_inline++; + +/* Sub case where inlining another key is required */ +if ((cipher_alg ==PDCP_CIPHER_TYPE_AES ) && + (auth_alg ==PDCP_AUTH_TYPE_SNOW )) + nb_key_to_inline++; + } + +/* Inline both keys */ + +return nb_key_to_inline; +} +static inline void key_loading_opti (struct program *p,struct alginfo *cipherdata,struct alginfo *authdata)
@@ -788,8 +845,8 @@ pdcp_sdap_insert_cplane_null_op(struct program *p,unsigned char era_2_sw_hfn_ovrd, enum pdb_type_e pdb_type __maybe_unused) { - return pdcp_insert_cplane_int_only_op(p, swap, cipherdata, authdata, -dir ,sn_size ,era_2_sw_hfn_ovrd ); + return pdcp_insert_cplane_null_op(p, swap, cipherdata, authdata, dir, +sn_size ,era_2_sw_hfn_ovrd ); } static inline int
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +22 -6
@@ -3261,12 +3261,28 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, goto out; } -if (rta_inline_pdcp_query (authdata.algtype, - cipherdata.algtype, - session->pdcp.sn_size, - session->pdcp.hfn_ovd)) { - cipherdata.key =DPAA2_VADDR_TO_IOVA (cipherdata.key); - cipherdata.key_type =RTA_DATA_PTR ; +if (pdcp_xform->sdap_enabled) { +int nb_keys_to_inline = +rta_inline_pdcp_sdap_query (authdata.algtype, + cipherdata.algtype, + session->pdcp.sn_size, + session->pdcp.hfn_ovd); +if (nb_keys_to_inline >=1 ) { + cipherdata.key =DPAA2_VADDR_TO_IOVA (cipherdata.key); + cipherdata.key_type =RTA_DATA_PTR ; + } +if (nb_keys_to_inline >=2 ) { + authdata.key =DPAA2_VADDR_TO_IOVA (authdata.key); + authdata.key_type =RTA_DATA_PTR ; + } + }else { +if (rta_inline_pdcp_query (authdata.algtype, + cipherdata.algtype, + session->pdcp.sn_size, + session->pdcp.hfn_ovd)) { + cipherdata.key =DPAA2_VADDR_TO_IOVA (cipherdata.key); + cipherdata.key_type =RTA_DATA_PTR ; + } }if (pdcp_xform->domain ==RTE_SECURITY_PDCP_MODE_CONTROL ) {
Signature · 1 line
2.17.1
PATCH v4 8/10 common/dpaax: fix IV value for shortMAC-I for SNOW algo
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
The logic was incorecly doing conditional swap. It need to be bit swap always.
--- drivers/common/dpaax/caamflib/desc/pdcp.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/common/dpaax/caamflib/desc/pdcp.h +4 -3
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: BSD-3-Clause or GPL-2.0+ * Copyright 2008-2013 Freescale Semiconductor, Inc. -* Copyright 2019-2020 NXP +* Copyright 2019-2021 NXP */ #ifndef __DESC_PDCP_H__
@@ -3715,9 +3715,10 @@ cnstr_shdsc_pdcp_short_mac(uint32_t *descbuf,break ;case PDCP_AUTH_TYPE_SNOW : +/* IV calculation based on 3GPP specs. 36331, section:5.3.7.4 */ iv[0 ] =0xFFFFFFFF ; - iv[1 ] = swap ?swab32 (0x04000000 ) :0x04000000 ; - iv[2 ] = swap ?swab32 (0xF8000000 ) :0xF8000000 ; + iv[1 ] =swab32 (0x04000000 ); + iv[2 ] =swab32 (0xF8000000 );KEY (p,KEY2 , authdata->key_enc_flags, authdata->key, authdata->keylen,INLINE_KEY (authdata));
Signature · 1 line
2.17.1
PATCH v4 9/10 crypto/dpaa_sec: force inline of the keys to save space
In reply to Hemant AgrawalFrom: Gagandeep Singh <[email protected]>
This patch improve storage and performance by force inline of the keys.
--- drivers/crypto/dpaa_sec/dpaa_sec.c | 35 ++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-)
drivers/crypto/dpaa_sec/dpaa_sec.c +26 -9
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. -* Copyright 2017-2019 NXP +* Copyright 2017-2021 NXP * */
@@ -263,14 +263,31 @@ dpaa_sec_prep_pdcp_cdb(dpaa_sec_session *ses) p_authdata = &authdata; } -if (rta_inline_pdcp_query (authdata.algtype, - cipherdata.algtype, - ses->pdcp.sn_size, - ses->pdcp.hfn_ovd)) { - cipherdata.key = - (size_t )rte_dpaa_mem_vtop ((void *) - (size_t )cipherdata.key); - cipherdata.key_type =RTA_DATA_PTR ; +if (ses->pdcp.sdap_enabled) { +int nb_keys_to_inline = +rta_inline_pdcp_sdap_query (authdata.algtype, + cipherdata.algtype, + ses->pdcp.sn_size, + ses->pdcp.hfn_ovd); +if (nb_keys_to_inline >=1 ) { + cipherdata.key = (size_t )rte_dpaa_mem_vtop ((void *) + (size_t )cipherdata.key); + cipherdata.key_type =RTA_DATA_PTR ; + } +if (nb_keys_to_inline >=2 ) { + authdata.key = (size_t )rte_dpaa_mem_vtop ((void *) + (size_t )authdata.key); + authdata.key_type =RTA_DATA_PTR ; + } + }else { +if (rta_inline_pdcp_query (authdata.algtype, + cipherdata.algtype, + ses->pdcp.sn_size, + ses->pdcp.hfn_ovd)) { + cipherdata.key = (size_t )rte_dpaa_mem_vtop ((void *) + (size_t )cipherdata.key); + cipherdata.key_type =RTA_DATA_PTR ; + } }if (ses->pdcp.domain ==RTE_SECURITY_PDCP_MODE_CONTROL ) {
Signature · 1 line
2.17.1
PATCH v4 10/10 crypto/dpaa2_sec: add error packet counters
In reply to Hemant AgrawalThis patch add support to also counter err pkt counter per queue. This also enhances few related debug prints.
--- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +4 -2
@@ -1709,8 +1709,9 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops,if (unlikely (fd->simple.frc)) {/* TODO Parse SEC errors */ -DPAA2_SEC_ERR ("SEC returned Error - %x" , +DPAA2_SEC_DP_ERR ("SEC returned Error - %x\n" , fd->simple.frc); + dpaa2_qp->rx_vq.err_pkts +=1 ; ops[num_rx]->status =RTE_CRYPTO_OP_STATUS_ERROR ; }else { ops[num_rx]->status =RTE_CRYPTO_OP_STATUS_SUCCESS ;
@@ -1722,7 +1723,8 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops, dpaa2_qp->rx_vq.rx_pkts += num_rx; -DPAA2_SEC_DP_DEBUG ("SEC Received %d Packets\n" , num_rx); +DPAA2_SEC_DP_DEBUG ("SEC RX pkts %d err pkts %" PRIu64"\n" , num_rx, + dpaa2_qp->rx_vq.err_pkts);/*Return the total number of packets received to DPAA2 app*/ return num_rx; }
Signature · 1 line
2.17.1
Akhil Goyal
AppliedRe: [dpdk-dev] [EXT] [PATCH v4 01/10] crypto/dpaa_sec: support DES-CBC
In reply to Hemant AgrawalQuoted 7 lines
From: Gagandeep Singh <[email protected]>
add DES-CBC support and enable available cipher-only test cases.
Signed-off-by Gagandeep Singh <[email protected]>---
Series Acked-by: Akhil Goyal <[email protected]>
Applied to dpdk-next-crypto
Thanks.