support of MAC-I
cover support of MAC-I
This series add support of Message Authentication Code
- Integrity on DPAAX platforms.
Gagandeep Singh (4):
common/dpaax: fix IV value for shortMAC-I for SNOW algo test/crypto: add pdcp security short MAC-I support crypto/dpaa2_sec: add PDCP short MAC-I support crypto/dpaa_sec: add pdcp short MAC-I support
Hemant Agrawal (1):
security: add pdcp short MAC-I support
app/test-crypto-perf/cperf_options_parsing.c | 8 +- app/test/test_cryptodev.c | 48 ++++++++ ...est_cryptodev_security_pdcp_test_vectors.h | 105 +++++++++++++++++- doc/guides/prog_guide/rte_security.rst | 11 +- doc/guides/tools/cryptoperf.rst | 2 +- drivers/common/dpaax/caamflib/desc/pdcp.h | 7 +- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 4 + drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 9 ++ drivers/crypto/dpaa_sec/dpaa_sec.c | 3 + drivers/crypto/dpaa_sec/dpaa_sec.h | 11 +- lib/security/rte_security.h | 1 + 11 files changed, 201 insertions(+), 8 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/5 common/dpaax: fix IV value for shortMAC-I for SNOW algo
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__
@@ -3710,9 +3710,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.25.1
Re: [dpdk-dev] [EXT] [PATCH 1/5] common/dpaax: fix IV value for shortMAC-I for SNOW algo
Quoted 2 lines
The logic was incorecly doing conditional swap. It need to be bit swap always.
Spell check " incorrectly"
Quoted 6 lines
Fixes 73a24060cd70 ("crypto/dpaa2_sec: add sample PDCP descriptor APIs")Signed-off-by Gagandeep Singh <[email protected]>---
Move this patch as 3rd patch of your series.
PATCH 2/5 security: add pdcp short MAC-I support
In reply to Gagandeep SinghFrom: Hemant Agrawal <[email protected]>
This patch add support to handle PDCP short MAC-I domain along with standard control and data domains as it has to be treaty as special case with PDCP protocol offload support.
ShortMAC-I is the 16 least significant bits of calculated MAC-I. Usually when a RRC message is exchanged between UE and eNodeB it is integrity & ciphered protected.
MAC-I = f(key, varShortMAC-I, count, bearer, direction).
Here varShortMAC-I is prepared by using (current cellId, pci of source cell and C-RNTI of old cell). Other parameters like count, bearer and direction set to all 1.
--- app/test-crypto-perf/cperf_options_parsing.c | 8 +++++++- doc/guides/prog_guide/rte_security.rst | 11 ++++++++++- doc/guides/tools/cryptoperf.rst | 2 +- lib/security/rte_security.h | 1 + 4 files changed, 19 insertions(+), 3 deletions(-)
app/test-crypto-perf/cperf_options_parsing.c +7 -1
@@ -662,7 +662,8 @@ parse_pdcp_sn_sz(struct cperf_options *opts, const char *arg)const char *cperf_pdcp_domain_strs[] = { [RTE_SECURITY_PDCP_MODE_CONTROL ] ="control" , - [RTE_SECURITY_PDCP_MODE_DATA ] ="data" + [RTE_SECURITY_PDCP_MODE_DATA ] ="data" , + [RTE_SECURITY_PDCP_MODE_SHORT_MAC ] ="short_mac" }; static int
@@ -677,6 +678,11 @@ parse_pdcp_domain(struct cperf_options *opts, const char *arg) cperf_pdcp_domain_strs [RTE_SECURITY_PDCP_MODE_DATA ],RTE_SECURITY_PDCP_MODE_DATA + }, + { + cperf_pdcp_domain_strs + [RTE_SECURITY_PDCP_MODE_SHORT_MAC ], + RTE_SECURITY_PDCP_MODE_SHORT_MAC } };
doc/guides/prog_guide/rte_security.rst +10 -1
@@ -1,5 +1,5 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright 2017,2020 NXP + Copyright 2017,2020-2021 NXP
@@ -408,6 +408,15 @@ PMD which supports the IPsec and PDCP protocol. }, .crypto_capabilities = pmd_capabilities }, + { /* PDCP Lookaside Protocol offload short MAC-I */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags = 0 + }, + .crypto_capabilities = pmd_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }
doc/guides/tools/cryptoperf.rst +1 -1
@@ -318,7 +318,7 @@ The following are the application command-line options: * ``--pdcp-domain <control/user>`` - Set PDCP domain to specify Control/user plane. + Set PDCP domain to specify short_mac/control/user plane. * ``--docsis-hdr-sz <n>``
lib/security/rte_security.h +1 -0
@@ -233,6 +233,7 @@ struct rte_security_macsec_xform {enum rte_security_pdcp_domain {RTE_SECURITY_PDCP_MODE_CONTROL ,/**< PDCP control plane */ RTE_SECURITY_PDCP_MODE_DATA ,/**< PDCP data plane */ +RTE_SECURITY_PDCP_MODE_SHORT_MAC ,/**< PDCP short mac */ };/** PDCP Frame direction */
Signature · 1 line
2.25.1
Re: [dpdk-dev] [EXT] [PATCH 2/5] security: add pdcp short MAC-I support
Quoted 2 lines
From: Hemant Agrawal <[email protected]>
Title should be "security: support PDCP short MAC-I"
Quoted 3 lines
This patch add support to handle PDCP short MAC-I domain along with standard control and data domains as it has to be treaty as special case with PDCP protocol offload support.
Spell check treated.
Quoted 83 lines
ShortMAC-I is the 16 least significant bits of calculated MAC-I. Usually when a RRC message is exchanged between UE and eNodeB it is integrity & ciphered protected.
MAC-I =
f(key, varShortMAC-I, count, bearer, direction).
Here varShortMAC-I is prepared by using (current cellId, pci of source cell and C-RNTI of old cell). Other parameters like count, bearer and direction set to all 1.Signed-off-by Gagandeep Singh <[email protected]>Signed-off-by Hemant Agrawal <[email protected]>--- app/test-crypto-perf/cperf_options_parsing.c | 8 +++++++- doc/guides/prog_guide/rte_security.rst | 11 ++++++++++- doc/guides/tools/cryptoperf.rst | 2 +- lib/security/rte_security.h | 1 + 4 files changed, 19 insertions(+), 3 deletions(-)app/test-crypto- renamed from app/test-crypto-perf/cperf_options_parsing.c +0
-0
perf/cperf_options_parsing.c
indexe84f56cfaa..0348972c85100644app/test-crypto-perf/cperf_options_parsing.c +2
-1@@ -662,7 +662,8 @@ parse_pdcp_sn_sz(struct cperf_options *opts, const char *arg)const char *cperf_pdcp_domain_strs[] = { [RTE_SECURITY_PDCP_MODE_CONTROL ] ="control" , - [RTE_SECURITY_PDCP_MODE_DATA ] ="data" + [RTE_SECURITY_PDCP_MODE_DATA ] ="data" , + [RTE_SECURITY_PDCP_MODE_SHORT_MAC ] ="short_mac" };static int
app/test-crypto-perf/cperf_options_parsing.c +5
-0@@ -677,6 +678,11 @@ parse_pdcp_domain(struct cperf_options *opts, const char *arg) cperf_pdcp_domain_strs [RTE_SECURITY_PDCP_MODE_DATA ],RTE_SECURITY_PDCP_MODE_DATA + }, + { + cperf_pdcp_domain_strs + [RTE_SECURITY_PDCP_MODE_SHORT_MAC ], +RTE_SECURITY_PDCP_MODE_SHORT_MAC } };doc/guides/prog_guide/rte_security.rst +10
-1@@ -1,5 +1,5 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright 2017,2020 NXP + Copyright 2017,2020-2021 NXP@@ -408,6 +408,15 @@ PMD which supports the IPsec and PDCP protocol. }, .crypto_capabilities = pmd_capabilities }, + { /* PDCP Lookaside Protocol offload short MAC-I */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags = 0 + }, + .crypto_capabilities = pmd_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }doc/guides/tools/cryptoperf.rst +0
-0@@ -318,7 +318,7 @@ The following are the application command-lineoptions:
Quoted 1 line
* ``--pdcp-domain <control/user>``
You can add short_mac here as well.
Quoted 22 lines
doc/guides/tools/cryptoperf.rst +1
-1- Set PDCP domain to specify Control/user plane. + Set PDCP domain to specify short_mac/control/user plane. * ``--docsis-hdr-sz <n>``lib/security/rte_security.h +0
-0@@ -233,6 +233,7 @@ struct rte_security_macsec_xform {enum rte_security_pdcp_domain {RTE_SECURITY_PDCP_MODE_CONTROL ,/**< PDCP control plane */
lib/security/rte_security.h +1
-0RTE_SECURITY_PDCP_MODE_DATA ,/**< PDCP data plane */ + RTE_SECURITY_PDCP_MODE_SHORT_MAC, /**< PDCP short mac*/
};/** PDCP Frame direction */
--
2.25.1
PATCH 3/5 test/crypto: add pdcp security short MAC-I support
In reply to Gagandeep SinghThis patch add support to test the pdcp short mac
packets support in crypto.
--- app/test/test_cryptodev.c | 48 ++++++++ ...est_cryptodev_security_pdcp_test_vectors.h | 105 +++++++++++++++++- 2 files changed, 152 insertions(+), 1 deletion(-)
app/test/test_cryptodev.c +48 -0
@@ -8768,6 +8768,50 @@ test_PDCP_SDAP_PROTO_encap_all(void)return (all_err ==TEST_SUCCESS ) ?TEST_SUCCESS :TEST_FAILED ; } +static int +test_PDCP_PROTO_short_mac (void ) +{ +int i =0 , size =0 ; +int err, all_err =TEST_SUCCESS ; +const struct pdcp_short_mac_test *cur_test; + + size =RTE_DIM (list_pdcp_smac_tests); + +for (i =0 ; i < size; i++) { + cur_test = &list_pdcp_smac_tests[i]; + err =test_pdcp_proto ( + i,0 ,RTE_CRYPTO_CIPHER_OP_ENCRYPT , +RTE_CRYPTO_AUTH_OP_GENERATE , cur_test->data_in, + cur_test->in_len, cur_test->data_out, + cur_test->in_len + ((cur_test->auth_key) ?4 :0 ), +RTE_CRYPTO_CIPHER_NULL ,NULL , +0 , cur_test->param.auth_alg, + cur_test->auth_key, cur_test->param.auth_key_len, +0 , cur_test->param.domain,0 ,0 , +0 ,0 ,0 ); +if (err) { +printf ("\t%d) %s: Short MAC test failed\n" , + cur_test->test_idx, + cur_test->param.name); + err =TEST_FAILED ; + }else { +printf ("\t%d) %s: Short MAC test PASS\n" , + cur_test->test_idx, + cur_test->param.name); +rte_hexdump (stdout,"MAC I" , + cur_test->data_out + cur_test->in_len +2 , +2 ); + err =TEST_SUCCESS ; + } + all_err += err; + } + +printf ("Success: %d, Failure: %d\n" , size + all_err, -all_err); + +return (all_err ==TEST_SUCCESS ) ?TEST_SUCCESS :TEST_FAILED ; + +} +static int test_PDCP_SDAP_PROTO_decap_all (void ) {
@@ -14039,6 +14083,8 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_encryption_test_case_5), +TEST_CASE_ST (ut_setup, ut_teardown, + test_PDCP_PROTO_short_mac),TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_encryption_test_case_1_oop), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -14279,6 +14325,8 @@ static struct unit_test_suite cryptodev_kasumi_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_kasumi_decryption_test_case_1_oop), +TEST_CASE_ST (ut_setup, ut_teardown, + test_PDCP_PROTO_short_mac),TEST_CASE_ST (ut_setup, ut_teardown, test_kasumi_cipher_auth_test_case_1),
app/test/test_cryptodev_security_pdcp_test_vectors.h +104 -1
117 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 4/5 crypto/dpaa2_sec: add PDCP short MAC-I support
In reply to Gagandeep SinghThis patch add PDCP short mac support in dpaa2_sec driver.
--- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 4 ++++ drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 9 +++++++++ 2 files changed, 13 insertions(+)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +4 -0
@@ -3290,6 +3290,10 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, pdcp_xform->hfn_threshold, &cipherdata, &authdata, 0); + + }else if (pdcp_xform->domain ==RTE_SECURITY_PDCP_MODE_SHORT_MAC ) { + bufsize =cnstr_shdsc_pdcp_short_mac (priv->flc_desc[0 ].desc, +1 , swap, &authdata); }else {if (session->dir ==DIR_ENC ) {if (pdcp_xform->sdap_enabled)
drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h +9 -0
@@ -941,6 +941,15 @@ static const struct rte_security_capability dpaa2_sec_security_cap[] = { }, .crypto_capabilities = dpaa2_pdcp_capabilities }, + {/* PDCP Lookaside Protocol offload Short MAC */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags =0 + }, + .crypto_capabilities = dpaa2_pdcp_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }
Signature · 1 line
2.25.1
PATCH 5/5 crypto/dpaa_sec: add pdcp short MAC-I support
In reply to Gagandeep SinghThis patch add pdcp security short MAC-I support for dpaa_sec driver.
--- drivers/crypto/dpaa_sec/dpaa_sec.c | 3 +++ drivers/crypto/dpaa_sec/dpaa_sec.h | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
drivers/crypto/dpaa_sec/dpaa_sec.c +3 -0
@@ -294,6 +294,9 @@ dpaa_sec_prep_pdcp_cdb(dpaa_sec_session *ses) ses->pdcp.hfn_threshold, &cipherdata, &authdata, 0); + }else if (ses->pdcp.domain ==RTE_SECURITY_PDCP_MODE_SHORT_MAC ) { + shared_desc_len =cnstr_shdsc_pdcp_short_mac (cdb->sh_desc, +1 , swap, &authdata); }else {if (ses->dir ==DIR_ENC ) {if (ses->pdcp.sdap_enabled)
drivers/crypto/dpaa_sec/dpaa_sec.h +10 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: BSD-3-Clause * -* Copyright 2016-2020 NXP +* Copyright 2016-2021 NXP * */
@@ -769,6 +769,15 @@ static const struct rte_security_capability dpaa_sec_security_cap[] = { }, .crypto_capabilities = dpaa_pdcp_capabilities }, + {/* PDCP Lookaside Protocol offload Short MAC */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags =0 + }, + .crypto_capabilities = dpaa_pdcp_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }
Signature · 1 line
2.25.1
v2 cover support of MAC-I
In reply to Gagandeep SinghThis series add support of Message Authentication Code
- Integrity on DPAAX platforms.
v2-change-log:
* update commit message
* merged an existing patch with this series:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/mbox/
Gagandeep Singh (4):
common/dpaax: fix IV value for shortMAC-I for SNOW algo test/crypto: add pdcp security short MAC-I support crypto/dpaa2_sec: add PDCP short MAC-I support crypto/dpaa_sec: add pdcp short MAC-I support
Hemant Agrawal (1):
security: support PDCP short MAC-I
app/test-crypto-perf/cperf_options_parsing.c | 8 +- app/test/test_cryptodev.c | 48 ++++++++ ...est_cryptodev_security_pdcp_test_vectors.h | 105 +++++++++++++++++- doc/guides/prog_guide/rte_security.rst | 11 +- doc/guides/tools/cryptoperf.rst | 4 +- drivers/common/dpaax/caamflib/desc/pdcp.h | 7 +- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 29 +++-- drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 9 ++ drivers/crypto/dpaa_sec/dpaa_sec.c | 3 + drivers/crypto/dpaa_sec/dpaa_sec.h | 11 +- lib/security/rte_security.h | 1 + 11 files changed, 215 insertions(+), 21 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/5 common/dpaax: fix IV value for shortMAC-I for SNOW algo
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__
@@ -3710,9 +3710,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.25.1
v3 cover support of MAC-I
This series add support of Message Authentication Code
- Integrity on DPAAX platforms.
v2-change-log:
* update commit message
* merged an existing patch with this series:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/mbox/
v3-change-log:
* updated release notes
Gagandeep Singh (3):
test/crypto: add pdcp security short MAC-I support crypto/dpaa2_sec: add PDCP short MAC-I support crypto/dpaa_sec: add pdcp short MAC-I support
Hemant Agrawal (1):
security: support PDCP short MAC-I
app/test-crypto-perf/cperf_options_parsing.c | 8 +- app/test/test_cryptodev.c | 48 ++++++++ ...est_cryptodev_security_pdcp_test_vectors.h | 105 +++++++++++++++++- doc/guides/prog_guide/rte_security.rst | 11 +- doc/guides/rel_notes/release_21_11.rst | 8 ++ doc/guides/tools/cryptoperf.rst | 4 +- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 29 +++-- drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 9 ++ drivers/crypto/dpaa_sec/dpaa_sec.c | 3 + drivers/crypto/dpaa_sec/dpaa_sec.h | 11 +- lib/security/rte_security.h | 1 + 11 files changed, 219 insertions(+), 18 deletions(-)
Signature · 1 line
2.25.1
PATCH v3 1/4 security: support PDCP short MAC-I
From: Hemant Agrawal <[email protected]>
This patch add support to handle PDCP short MAC-I domain along with standard control and data domains as it has to be treated as special case with PDCP protocol offload support.
ShortMAC-I is the 16 least significant bits of calculated MAC-I. Usually when a RRC message is exchanged between UE and eNodeB it is integrity & ciphered protected.
MAC-I = f(key, varShortMAC-I, count, bearer, direction).
Here varShortMAC-I is prepared by using (current cellId, pci of source cell and C-RNTI of old cell). Other parameters like count, bearer and direction set to all 1.
--- app/test-crypto-perf/cperf_options_parsing.c | 8 ++++++- doc/guides/prog_guide/rte_security.rst | 11 ++++++++- doc/guides/tools/cryptoperf.rst | 4 ++-- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 25 ++++++++++---------- lib/security/rte_security.h | 1 + 5 files changed, 33 insertions(+), 16 deletions(-)
app/test-crypto-perf/cperf_options_parsing.c +7 -1
@@ -662,7 +662,8 @@ parse_pdcp_sn_sz(struct cperf_options *opts, const char *arg)const char *cperf_pdcp_domain_strs[] = { [RTE_SECURITY_PDCP_MODE_CONTROL ] ="control" , - [RTE_SECURITY_PDCP_MODE_DATA ] ="data" + [RTE_SECURITY_PDCP_MODE_DATA ] ="data" , + [RTE_SECURITY_PDCP_MODE_SHORT_MAC ] ="short_mac" }; static int
@@ -677,6 +678,11 @@ parse_pdcp_domain(struct cperf_options *opts, const char *arg) cperf_pdcp_domain_strs [RTE_SECURITY_PDCP_MODE_DATA ],RTE_SECURITY_PDCP_MODE_DATA + }, + { + cperf_pdcp_domain_strs + [RTE_SECURITY_PDCP_MODE_SHORT_MAC ], + RTE_SECURITY_PDCP_MODE_SHORT_MAC } };
doc/guides/prog_guide/rte_security.rst +10 -1
@@ -1,5 +1,5 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright 2017,2020 NXP + Copyright 2017,2020-2021 NXP
@@ -408,6 +408,15 @@ PMD which supports the IPsec and PDCP protocol. }, .crypto_capabilities = pmd_capabilities }, + { /* PDCP Lookaside Protocol offload short MAC-I */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags = 0 + }, + .crypto_capabilities = pmd_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }
doc/guides/tools/cryptoperf.rst +2 -2
@@ -316,9 +316,9 @@ The following are the application command-line options: Set PDCP sequence number size(n) in bits. Valid values of n will be 5/7/12/15/18. -* ``--pdcp-domain <control/user>`` +* ``--pdcp-domain <control/user/short_mac>`` - Set PDCP domain to specify Control/user plane. + Set PDCP domain to specify short_mac/control/user plane. * ``--docsis-hdr-sz <n>``
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +13 -12
@@ -3104,7 +3104,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;
@@ -3136,18 +3136,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 ;
@@ -3186,7 +3186,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;
lib/security/rte_security.h +1 -0
@@ -233,6 +233,7 @@ struct rte_security_macsec_xform {enum rte_security_pdcp_domain {RTE_SECURITY_PDCP_MODE_CONTROL ,/**< PDCP control plane */ RTE_SECURITY_PDCP_MODE_DATA ,/**< PDCP data plane */ +RTE_SECURITY_PDCP_MODE_SHORT_MAC ,/**< PDCP short mac */ };/** PDCP Frame direction */
Signature · 1 line
2.25.1
Re: [dpdk-dev] [EXT] [PATCH v3 1/4] security: support PDCP short MAC-I
Quoted 15 lines
From: Hemant Agrawal <[email protected]>
This patch add support to handle PDCP short MAC-I domain along with standard control and data domains as it has to be treated as special case with PDCP protocol offload support.
ShortMAC-I is the 16 least significant bits of calculated MAC-I. Usually when a RRC message is exchanged between UE and eNodeB it is integrity & ciphered protected.
MAC-I =
f(key, varShortMAC-I, count, bearer, direction).
Here varShortMAC-I is prepared by using (current cellId, pci of source cell and C-RNTI of old cell). Other parameters like count, bearer and direction set to all 1.
Quoted 7 lines
Signed-off-by Gagandeep Singh <[email protected]>Signed-off-by Hemant Agrawal <[email protected]>--- app/test-crypto-perf/cperf_options_parsing.c | 8 ++++++- doc/guides/prog_guide/rte_security.rst | 11 ++++++++- doc/guides/tools/cryptoperf.rst | 4 ++-- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 25 ++++++++++----------
Why is the dpaa2_sec patch squashed in this patch?
I asked to have it as a separate patch in this series instead of the dpaa_sec series.
Quoted 152 lines
lib/security/rte_security.h | 1 + 5 files changed, 33 insertions(+), 16 deletions(-)app/test-crypto- renamed from app/test-crypto-perf/cperf_options_parsing.c +0
-0
perf/cperf_options_parsing.c
indexe84f56cfaa..0348972c85100644app/test-crypto-perf/cperf_options_parsing.c +2
-1@@ -662,7 +662,8 @@ parse_pdcp_sn_sz(struct cperf_options *opts, const char *arg)const char *cperf_pdcp_domain_strs[] = { [RTE_SECURITY_PDCP_MODE_CONTROL ] ="control" , - [RTE_SECURITY_PDCP_MODE_DATA ] ="data" + [RTE_SECURITY_PDCP_MODE_DATA ] ="data" , + [RTE_SECURITY_PDCP_MODE_SHORT_MAC ] ="short_mac" };static int
app/test-crypto-perf/cperf_options_parsing.c +5
-0@@ -677,6 +678,11 @@ parse_pdcp_domain(struct cperf_options *opts, const char *arg) cperf_pdcp_domain_strs [RTE_SECURITY_PDCP_MODE_DATA ],RTE_SECURITY_PDCP_MODE_DATA + }, + { + cperf_pdcp_domain_strs + [RTE_SECURITY_PDCP_MODE_SHORT_MAC ], +RTE_SECURITY_PDCP_MODE_SHORT_MAC } };doc/guides/prog_guide/rte_security.rst +10
-1@@ -1,5 +1,5 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright 2017,2020 NXP + Copyright 2017,2020-2021 NXP@@ -408,6 +408,15 @@ PMD which supports the IPsec and PDCP protocol. }, .crypto_capabilities = pmd_capabilities }, + { /* PDCP Lookaside Protocol offload short MAC-I */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags = 0 + }, + .crypto_capabilities = pmd_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }doc/guides/tools/cryptoperf.rst +0
-0@@ -316,9 +316,9 @@ The following are the application command-lineoptions:
Set PDCP sequence number size(n) in bits. Valid values of n will be 5/7/12/15/18.doc/guides/tools/cryptoperf.rst +2
-2-* ``--pdcp-domain <control/user>`` +* ``--pdcp-domain <control/user/short_mac>`` - Set PDCP domain to specify Control/user plane. + Set PDCP domain to specify short_mac/control/user plane. * ``--docsis-hdr-sz <n>``drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +1
-1@@ -3104,7 +3104,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;@@ -3136,18 +3136,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 ;@@ -3186,7 +3186,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;drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +0
-0cipherdata.keylen = session->cipher_key.length;lib/security/rte_security.h +0
-0@@ -233,6 +233,7 @@ struct rte_security_macsec_xform {enum rte_security_pdcp_domain {RTE_SECURITY_PDCP_MODE_CONTROL ,/**< PDCP control plane */
lib/security/rte_security.h +1
-0RTE_SECURITY_PDCP_MODE_DATA ,/**< PDCP data plane */ + RTE_SECURITY_PDCP_MODE_SHORT_MAC, /**< PDCP short mac*/
};/** PDCP Frame direction */
--
2.25.1
Re: [dpdk-dev] [EXT] [PATCH v3 1/4] security: support PDCP short MAC-I
Quoted 32 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Wednesday, September 8, 2021 5:45 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Cc: [email protected]; Hemant Agrawal <[email protected]>
Subject: RE: [EXT] [PATCH v3 1/4] security: support PDCP short MAC-IQuoted 15 lines
From: Hemant Agrawal <[email protected]>
This patch add support to handle PDCP short MAC-I domain along with standard control and data domains as it has to be treated as special case with PDCP protocol offload support.
ShortMAC-I is the 16 least significant bits of calculated MAC-I. Usually when a RRC message is exchanged between UE and eNodeB it is integrity & ciphered protected.
MAC-I =
f(key, varShortMAC-I, count, bearer, direction).
Here varShortMAC-I is prepared by using (current cellId, pci of source cell and C-RNTI of old cell). Other parameters like count, bearer and direction set to all 1.Quoted 7 lines
Signed-off-by Gagandeep Singh <[email protected]>Signed-off-by Hemant Agrawal <[email protected]>--- app/test-crypto-perf/cperf_options_parsing.c | 8 ++++++- doc/guides/prog_guide/rte_security.rst | 11 ++++++++- doc/guides/tools/cryptoperf.rst | 4 ++-- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 25 ++++++++++----------
Quoted 3 lines
Why is the
dpaa2_secpatch squashed in this patch?
I asked to have it as a separate patch in this series instead of thedpaa_secseries.
Ok, I will send v4 with a separate patch for dpaa2_sec in this series.
Quoted 153 lines
Quoted 153 lines
lib/security/rte_security.h | 1 + 5 files changed, 33 insertions(+), 16 deletions(-)app/test-crypto- renamed from app/test-crypto-perf/cperf_options_parsing.c +0
-0
perf/cperf_options_parsing.c
indexe84f56cfaa..0348972c85100644app/test-crypto-perf/cperf_options_parsing.c +2
-1@@ -662,7 +662,8 @@ parse_pdcp_sn_sz(struct cperf_options *opts, const char *arg)const char *cperf_pdcp_domain_strs[] = { [RTE_SECURITY_PDCP_MODE_CONTROL ] ="control" , - [RTE_SECURITY_PDCP_MODE_DATA ] ="data" + [RTE_SECURITY_PDCP_MODE_DATA ] ="data" , + [RTE_SECURITY_PDCP_MODE_SHORT_MAC ] ="short_mac" };static int
app/test-crypto-perf/cperf_options_parsing.c +5
-0@@ -677,6 +678,11 @@ parse_pdcp_domain(struct cperf_options *opts, const char *arg) cperf_pdcp_domain_strs [RTE_SECURITY_PDCP_MODE_DATA ],RTE_SECURITY_PDCP_MODE_DATA + }, + { + cperf_pdcp_domain_strs + [RTE_SECURITY_PDCP_MODE_SHORT_MAC ], +RTE_SECURITY_PDCP_MODE_SHORT_MAC } };doc/guides/prog_guide/rte_security.rst +10
-1@@ -1,5 +1,5 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright 2017,2020 NXP + Copyright 2017,2020-2021 NXP@@ -408,6 +408,15 @@ PMD which supports the IPsec and PDCP protocol. }, .crypto_capabilities = pmd_capabilities }, + { /* PDCP Lookaside Protocol offload short MAC-I */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags = 0 + }, + .crypto_capabilities = pmd_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }doc/guides/tools/cryptoperf.rst +0
-0@@ -316,9 +316,9 @@ The following are the application command-lineoptions:
Set PDCP sequence number size(n) in bits. Valid values of n will be 5/7/12/15/18.doc/guides/tools/cryptoperf.rst +2
-2-* ``--pdcp-domain <control/user>`` +* ``--pdcp-domain <control/user/short_mac>`` - Set PDCP domain to specify Control/user plane. + Set PDCP domain to specify short_mac/control/user plane. * ``--docsis-hdr-sz <n>``drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +1
-1@@ -3104,7 +3104,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;@@ -3136,18 +3136,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 ;@@ -3186,7 +3186,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;drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +0
-0cipherdata.keylen = session->cipher_key.length;lib/security/rte_security.h +0
-0@@ -233,6 +233,7 @@ struct rte_security_macsec_xform {enum rte_security_pdcp_domain {RTE_SECURITY_PDCP_MODE_CONTROL ,/**< PDCP control plane */
lib/security/rte_security.h +1
-0RTE_SECURITY_PDCP_MODE_DATA ,/**< PDCP data plane */ + RTE_SECURITY_PDCP_MODE_SHORT_MAC, /**< PDCP short mac*/
};/** PDCP Frame direction */
--
2.25.1
v4 cover support of MAC-I
In reply to Gagandeep SinghThis series add support of Message Authentication Code
- Integrity on DPAAX platforms.
v2-change-log:
* update commit message
* merged an existing patch with this series:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/mbox/
v3-change-log:
* updated release notes
v4-change-log:
* move the dpaa2_sec changes from first patch to a separate patch
Gagandeep Singh (3):
test/crypto: add pdcp security short MAC-I support crypto/dpaa2_sec: add PDCP short MAC-I support crypto/dpaa_sec: add pdcp short MAC-I support
Hemant Agrawal (2):
crypto/dpaa2_sec: support integrity only case for PDCP
security: add pdcp short MAC-I support
app/test-crypto-perf/cperf_options_parsing.c | 8 +- app/test/test_cryptodev.c | 48 ++++++++ ...est_cryptodev_security_pdcp_test_vectors.h | 105 +++++++++++++++++- doc/guides/prog_guide/rte_security.rst | 11 +- doc/guides/rel_notes/release_21_11.rst | 8 ++ doc/guides/tools/cryptoperf.rst | 2 +- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 29 +++-- drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 9 ++ drivers/crypto/dpaa_sec/dpaa_sec.c | 3 + drivers/crypto/dpaa_sec/dpaa_sec.h | 11 +- lib/security/rte_security.h | 1 + 11 files changed, 218 insertions(+), 17 deletions(-)
Signature · 1 line
2.25.1
PATCH v4 1/5 crypto/dpaa2_sec: support integrity only case for PDCP
From: Hemant Agrawal <[email protected]>
To support short MAC-I, integrity only case is required to be supported for PDCP.
--- 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
@@ -3104,7 +3104,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;
@@ -3136,18 +3136,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 ;
@@ -3186,7 +3186,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.25.1
PATCH v4 2/5 security: add pdcp short MAC-I support
In reply to Gagandeep SinghFrom: Hemant Agrawal <[email protected]>
This patch add support to handle PDCP short MAC-I domain along with standard control and data domains as it has to be treaty as special case with PDCP protocol offload support.
ShortMAC-I is the 16 least significant bits of calculated MAC-I. Usually when a RRC message is exchanged between UE and eNodeB it is integrity & ciphered protected.
MAC-I = f(key, varShortMAC-I, count, bearer, direction).
Here varShortMAC-I is prepared by using (current cellId, pci of source cell and C-RNTI of old cell). Other parameters like count, bearer and direction set to all 1.
--- app/test-crypto-perf/cperf_options_parsing.c | 8 +++++++- doc/guides/prog_guide/rte_security.rst | 11 ++++++++++- doc/guides/tools/cryptoperf.rst | 2 +- lib/security/rte_security.h | 1 + 4 files changed, 19 insertions(+), 3 deletions(-)
app/test-crypto-perf/cperf_options_parsing.c +7 -1
@@ -662,7 +662,8 @@ parse_pdcp_sn_sz(struct cperf_options *opts, const char *arg)const char *cperf_pdcp_domain_strs[] = { [RTE_SECURITY_PDCP_MODE_CONTROL ] ="control" , - [RTE_SECURITY_PDCP_MODE_DATA ] ="data" + [RTE_SECURITY_PDCP_MODE_DATA ] ="data" , + [RTE_SECURITY_PDCP_MODE_SHORT_MAC ] ="short_mac" }; static int
@@ -677,6 +678,11 @@ parse_pdcp_domain(struct cperf_options *opts, const char *arg) cperf_pdcp_domain_strs [RTE_SECURITY_PDCP_MODE_DATA ],RTE_SECURITY_PDCP_MODE_DATA + }, + { + cperf_pdcp_domain_strs + [RTE_SECURITY_PDCP_MODE_SHORT_MAC ], + RTE_SECURITY_PDCP_MODE_SHORT_MAC } };
doc/guides/prog_guide/rte_security.rst +10 -1
@@ -1,5 +1,5 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright 2017,2020 NXP + Copyright 2017,2020-2021 NXP
@@ -408,6 +408,15 @@ PMD which supports the IPsec and PDCP protocol. }, .crypto_capabilities = pmd_capabilities }, + { /* PDCP Lookaside Protocol offload short MAC-I */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags = 0 + }, + .crypto_capabilities = pmd_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }
doc/guides/tools/cryptoperf.rst +1 -1
@@ -318,7 +318,7 @@ The following are the application command-line options: * ``--pdcp-domain <control/user>`` - Set PDCP domain to specify Control/user plane. + Set PDCP domain to specify short_mac/control/user plane. * ``--docsis-hdr-sz <n>``
lib/security/rte_security.h +1 -0
@@ -233,6 +233,7 @@ struct rte_security_macsec_xform {enum rte_security_pdcp_domain {RTE_SECURITY_PDCP_MODE_CONTROL ,/**< PDCP control plane */ RTE_SECURITY_PDCP_MODE_DATA ,/**< PDCP data plane */ +RTE_SECURITY_PDCP_MODE_SHORT_MAC ,/**< PDCP short mac */ };/** PDCP Frame direction */
Signature · 1 line
2.25.1
PATCH v4 3/5 test/crypto: add pdcp security short MAC-I support
In reply to Gagandeep SinghThis patch add support to test the pdcp short mac
packets support in crypto.
--- app/test/test_cryptodev.c | 48 ++++++++ ...est_cryptodev_security_pdcp_test_vectors.h | 105 +++++++++++++++++- 2 files changed, 152 insertions(+), 1 deletion(-)
app/test/test_cryptodev.c +48 -0
@@ -8767,6 +8767,50 @@ test_PDCP_SDAP_PROTO_encap_all(void)return (all_err ==TEST_SUCCESS ) ?TEST_SUCCESS :TEST_FAILED ; } +static int +test_PDCP_PROTO_short_mac (void ) +{ +int i =0 , size =0 ; +int err, all_err =TEST_SUCCESS ; +const struct pdcp_short_mac_test *cur_test; + + size =RTE_DIM (list_pdcp_smac_tests); + +for (i =0 ; i < size; i++) { + cur_test = &list_pdcp_smac_tests[i]; + err =test_pdcp_proto ( + i,0 ,RTE_CRYPTO_CIPHER_OP_ENCRYPT , +RTE_CRYPTO_AUTH_OP_GENERATE , cur_test->data_in, + cur_test->in_len, cur_test->data_out, + cur_test->in_len + ((cur_test->auth_key) ?4 :0 ), +RTE_CRYPTO_CIPHER_NULL ,NULL , +0 , cur_test->param.auth_alg, + cur_test->auth_key, cur_test->param.auth_key_len, +0 , cur_test->param.domain,0 ,0 , +0 ,0 ,0 ); +if (err) { +printf ("\t%d) %s: Short MAC test failed\n" , + cur_test->test_idx, + cur_test->param.name); + err =TEST_FAILED ; + }else { +printf ("\t%d) %s: Short MAC test PASS\n" , + cur_test->test_idx, + cur_test->param.name); +rte_hexdump (stdout,"MAC I" , + cur_test->data_out + cur_test->in_len +2 , +2 ); + err =TEST_SUCCESS ; + } + all_err += err; + } + +printf ("Success: %d, Failure: %d\n" , size + all_err, -all_err); + +return (all_err ==TEST_SUCCESS ) ?TEST_SUCCESS :TEST_FAILED ; + +} +static int test_PDCP_SDAP_PROTO_decap_all (void ) {
@@ -14039,6 +14083,8 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_encryption_test_case_5), +TEST_CASE_ST (ut_setup, ut_teardown, + test_PDCP_PROTO_short_mac),TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_encryption_test_case_1_oop), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -14279,6 +14325,8 @@ static struct unit_test_suite cryptodev_kasumi_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_kasumi_decryption_test_case_1_oop), +TEST_CASE_ST (ut_setup, ut_teardown, + test_PDCP_PROTO_short_mac),TEST_CASE_ST (ut_setup, ut_teardown, test_kasumi_cipher_auth_test_case_1),
app/test/test_cryptodev_security_pdcp_test_vectors.h +104 -1
117 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 4/5 crypto/dpaa2_sec: add PDCP short MAC-I support
In reply to Gagandeep SinghThis patch add PDCP short mac support in dpaa2_sec driver.
--- doc/guides/rel_notes/release_21_11.rst | 4 ++++ drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 4 ++++ drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 9 +++++++++ 3 files changed, 17 insertions(+)
doc/guides/rel_notes/release_21_11.rst +4 -0
@@ -77,6 +77,10 @@ New Features * Added DES-CBC, AES-XCBC-MAC, AES-CMAC and non-HMAC algo support. +* **Updated NXP dpaa2_sec crypto PMD.** + + * Added PDCP short MAC-I support. + Removed Items -------------
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +4 -0
@@ -3309,6 +3309,10 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, pdcp_xform->hfn_threshold, &cipherdata, &authdata, 0); + + }else if (pdcp_xform->domain ==RTE_SECURITY_PDCP_MODE_SHORT_MAC ) { + bufsize =cnstr_shdsc_pdcp_short_mac (priv->flc_desc[0 ].desc, +1 , swap, &authdata); }else {if (session->dir ==DIR_ENC ) {if (pdcp_xform->sdap_enabled)
drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h +9 -0
@@ -941,6 +941,15 @@ static const struct rte_security_capability dpaa2_sec_security_cap[] = { }, .crypto_capabilities = dpaa2_pdcp_capabilities }, + {/* PDCP Lookaside Protocol offload Short MAC */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags =0 + }, + .crypto_capabilities = dpaa2_pdcp_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }
Signature · 1 line
2.25.1
PATCH v4 5/5 crypto/dpaa_sec: add pdcp short MAC-I support
In reply to Gagandeep SinghThis patch add pdcp security short MAC-I support for dpaa_sec driver.
--- doc/guides/rel_notes/release_21_11.rst | 4 ++++ drivers/crypto/dpaa_sec/dpaa_sec.c | 3 +++ drivers/crypto/dpaa_sec/dpaa_sec.h | 11 ++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_21_11.rst +4 -0
@@ -81,6 +81,10 @@ New Features * Added PDCP short MAC-I support. +* **Updated NXP dpaa_sec crypto PMD.** + + * Added PDCP short MAC-I support. + Removed Items -------------
drivers/crypto/dpaa_sec/dpaa_sec.c +3 -0
@@ -311,6 +311,9 @@ dpaa_sec_prep_pdcp_cdb(dpaa_sec_session *ses) ses->pdcp.hfn_threshold, &cipherdata, &authdata, 0); + }else if (ses->pdcp.domain ==RTE_SECURITY_PDCP_MODE_SHORT_MAC ) { + shared_desc_len =cnstr_shdsc_pdcp_short_mac (cdb->sh_desc, +1 , swap, &authdata); }else {if (ses->dir ==DIR_ENC ) {if (ses->pdcp.sdap_enabled)
drivers/crypto/dpaa_sec/dpaa_sec.h +10 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: BSD-3-Clause * -* Copyright 2016-2020 NXP +* Copyright 2016-2021 NXP * */
@@ -958,6 +958,15 @@ static const struct rte_security_capability dpaa_sec_security_cap[] = { }, .crypto_capabilities = dpaa_pdcp_capabilities }, + {/* PDCP Lookaside Protocol offload Short MAC */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags =0 + }, + .crypto_capabilities = dpaa_pdcp_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }
Signature · 1 line
2.25.1
Akhil Goyal
AppliedQuoted 33 lines
-----Original Message-----
----------------------------------------------------------------------
This series add support of Message Authentication Code
- Integrity on DPAAX platforms.v2-change-log:
* update commit message
* merged an existing patch with this series:
https://urldefense.proofpoint.com/v2/url?u=https-
3A__patches.dpdk.org_project_dpdk_patch_20210825081837.23830-2D1- 2Dhemant.agrawal- 40nxp.com_mbox_&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=DnL7Si2wl _PRwpZ9TWey3eu68gBzn7DkPwuqhd6WNyo&m=uVb88j-BcZCOk- dj_YN250HwoG6vE4oaTbdZ0crhu_o&s=ke0c8NuRQj2AR4pX7yDDk5gytngbs6 O1D6Urd1Xk5qk&e=v3-change-log:
* updated release notesv4-change-log:
* move thedpaa2_secchanges from first patch to a separate patchGagandeep Singh (3):
test/crypto: add pdcp security short MAC-I supportcrypto/dpaa2_sec: add PDCP short MAC-I supportcrypto/dpaa_sec: add pdcp short MAC-I supportHemant Agrawal (2):
crypto/dpaa2_sec: support integrity only case for PDCP
security: add pdcp short MAC-I support
Quoted 13 lines
app/test-crypto-perf/cperf_options_parsing.c | 8 +- app/test/test_cryptodev.c | 48 ++++++++ ...est_cryptodev_security_pdcp_test_vectors.h | 105 +++++++++++++++++- doc/guides/prog_guide/rte_security.rst | 11 +- doc/guides/rel_notes/release_21_11.rst | 8 ++ doc/guides/tools/cryptoperf.rst | 2 +- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 29 +++-- drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 9 ++ drivers/crypto/dpaa_sec/dpaa_sec.c | 3 + drivers/crypto/dpaa_sec/dpaa_sec.h | 11 +- lib/security/rte_security.h | 1 + 11 files changed, 218 insertions(+), 17 deletions(-)
Series Acked-by: Akhil Goyal <[email protected]>
Applied to dpdk-next-crypto
Thanks.
PATCH v3 2/4 test/crypto: add pdcp security short MAC-I support
In reply to Gagandeep SinghThis patch add support to test the pdcp short mac
packets support in crypto.
--- app/test/test_cryptodev.c | 48 ++++++++ ...est_cryptodev_security_pdcp_test_vectors.h | 105 +++++++++++++++++- 2 files changed, 152 insertions(+), 1 deletion(-)
app/test/test_cryptodev.c +48 -0
@@ -8767,6 +8767,50 @@ test_PDCP_SDAP_PROTO_encap_all(void)return (all_err ==TEST_SUCCESS ) ?TEST_SUCCESS :TEST_FAILED ; } +static int +test_PDCP_PROTO_short_mac (void ) +{ +int i =0 , size =0 ; +int err, all_err =TEST_SUCCESS ; +const struct pdcp_short_mac_test *cur_test; + + size =RTE_DIM (list_pdcp_smac_tests); + +for (i =0 ; i < size; i++) { + cur_test = &list_pdcp_smac_tests[i]; + err =test_pdcp_proto ( + i,0 ,RTE_CRYPTO_CIPHER_OP_ENCRYPT , +RTE_CRYPTO_AUTH_OP_GENERATE , cur_test->data_in, + cur_test->in_len, cur_test->data_out, + cur_test->in_len + ((cur_test->auth_key) ?4 :0 ), +RTE_CRYPTO_CIPHER_NULL ,NULL , +0 , cur_test->param.auth_alg, + cur_test->auth_key, cur_test->param.auth_key_len, +0 , cur_test->param.domain,0 ,0 , +0 ,0 ,0 ); +if (err) { +printf ("\t%d) %s: Short MAC test failed\n" , + cur_test->test_idx, + cur_test->param.name); + err =TEST_FAILED ; + }else { +printf ("\t%d) %s: Short MAC test PASS\n" , + cur_test->test_idx, + cur_test->param.name); +rte_hexdump (stdout,"MAC I" , + cur_test->data_out + cur_test->in_len +2 , +2 ); + err =TEST_SUCCESS ; + } + all_err += err; + } + +printf ("Success: %d, Failure: %d\n" , size + all_err, -all_err); + +return (all_err ==TEST_SUCCESS ) ?TEST_SUCCESS :TEST_FAILED ; + +} +static int test_PDCP_SDAP_PROTO_decap_all (void ) {
@@ -14039,6 +14083,8 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_encryption_test_case_5), +TEST_CASE_ST (ut_setup, ut_teardown, + test_PDCP_PROTO_short_mac),TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_encryption_test_case_1_oop), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -14279,6 +14325,8 @@ static struct unit_test_suite cryptodev_kasumi_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_kasumi_decryption_test_case_1_oop), +TEST_CASE_ST (ut_setup, ut_teardown, + test_PDCP_PROTO_short_mac),TEST_CASE_ST (ut_setup, ut_teardown, test_kasumi_cipher_auth_test_case_1),
app/test/test_cryptodev_security_pdcp_test_vectors.h +104 -1
117 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 3/4 crypto/dpaa2_sec: add PDCP short MAC-I support
In reply to Gagandeep SinghThis patch add PDCP short mac support in dpaa2_sec driver.
--- doc/guides/rel_notes/release_21_11.rst | 4 ++++ drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 4 ++++ drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 9 +++++++++ 3 files changed, 17 insertions(+)
doc/guides/rel_notes/release_21_11.rst +4 -0
@@ -77,6 +77,10 @@ New Features * Added DES-CBC, AES-XCBC-MAC, AES-CMAC and non-HMAC algo support. +* **Updated NXP dpaa2_sec crypto PMD.** + + * Added PDCP short MAC-I support. + Removed Items -------------
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +4 -0
@@ -3309,6 +3309,10 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, pdcp_xform->hfn_threshold, &cipherdata, &authdata, 0); + + }else if (pdcp_xform->domain ==RTE_SECURITY_PDCP_MODE_SHORT_MAC ) { + bufsize =cnstr_shdsc_pdcp_short_mac (priv->flc_desc[0 ].desc, +1 , swap, &authdata); }else {if (session->dir ==DIR_ENC ) {if (pdcp_xform->sdap_enabled)
drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h +9 -0
@@ -941,6 +941,15 @@ static const struct rte_security_capability dpaa2_sec_security_cap[] = { }, .crypto_capabilities = dpaa2_pdcp_capabilities }, + {/* PDCP Lookaside Protocol offload Short MAC */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags =0 + }, + .crypto_capabilities = dpaa2_pdcp_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }
Signature · 1 line
2.25.1
PATCH v3 4/4 crypto/dpaa_sec: add pdcp short MAC-I support
In reply to Gagandeep SinghThis patch add pdcp security short MAC-I support for dpaa_sec driver.
--- doc/guides/rel_notes/release_21_11.rst | 4 ++++ drivers/crypto/dpaa_sec/dpaa_sec.c | 3 +++ drivers/crypto/dpaa_sec/dpaa_sec.h | 11 ++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_21_11.rst +4 -0
@@ -81,6 +81,10 @@ New Features * Added PDCP short MAC-I support. +* **Updated NXP dpaa_sec crypto PMD.** + + * Added PDCP short MAC-I support. + Removed Items -------------
drivers/crypto/dpaa_sec/dpaa_sec.c +3 -0
@@ -311,6 +311,9 @@ dpaa_sec_prep_pdcp_cdb(dpaa_sec_session *ses) ses->pdcp.hfn_threshold, &cipherdata, &authdata, 0); + }else if (ses->pdcp.domain ==RTE_SECURITY_PDCP_MODE_SHORT_MAC ) { + shared_desc_len =cnstr_shdsc_pdcp_short_mac (cdb->sh_desc, +1 , swap, &authdata); }else {if (ses->dir ==DIR_ENC ) {if (ses->pdcp.sdap_enabled)
drivers/crypto/dpaa_sec/dpaa_sec.h +10 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: BSD-3-Clause * -* Copyright 2016-2020 NXP +* Copyright 2016-2021 NXP * */
@@ -958,6 +958,15 @@ static const struct rte_security_capability dpaa_sec_security_cap[] = { }, .crypto_capabilities = dpaa_pdcp_capabilities }, + {/* PDCP Lookaside Protocol offload Short MAC */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags =0 + }, + .crypto_capabilities = dpaa_pdcp_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }
Signature · 1 line
2.25.1
PATCH v2 2/5 security: support PDCP short MAC-I
In reply to Gagandeep SinghFrom: Hemant Agrawal <[email protected]>
This patch add support to handle PDCP short MAC-I domain along with standard control and data domains as it has to be treated as special case with PDCP protocol offload support.
ShortMAC-I is the 16 least significant bits of calculated MAC-I. Usually when a RRC message is exchanged between UE and eNodeB it is integrity & ciphered protected.
MAC-I = f(key, varShortMAC-I, count, bearer, direction).
Here varShortMAC-I is prepared by using (current cellId, pci of source cell and C-RNTI of old cell). Other parameters like count, bearer and direction set to all 1.
--- app/test-crypto-perf/cperf_options_parsing.c | 8 ++++++- doc/guides/prog_guide/rte_security.rst | 11 ++++++++- doc/guides/tools/cryptoperf.rst | 4 ++-- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 25 ++++++++++---------- lib/security/rte_security.h | 1 + 5 files changed, 33 insertions(+), 16 deletions(-)
app/test-crypto-perf/cperf_options_parsing.c +7 -1
@@ -662,7 +662,8 @@ parse_pdcp_sn_sz(struct cperf_options *opts, const char *arg)const char *cperf_pdcp_domain_strs[] = { [RTE_SECURITY_PDCP_MODE_CONTROL ] ="control" , - [RTE_SECURITY_PDCP_MODE_DATA ] ="data" + [RTE_SECURITY_PDCP_MODE_DATA ] ="data" , + [RTE_SECURITY_PDCP_MODE_SHORT_MAC ] ="short_mac" }; static int
@@ -677,6 +678,11 @@ parse_pdcp_domain(struct cperf_options *opts, const char *arg) cperf_pdcp_domain_strs [RTE_SECURITY_PDCP_MODE_DATA ],RTE_SECURITY_PDCP_MODE_DATA + }, + { + cperf_pdcp_domain_strs + [RTE_SECURITY_PDCP_MODE_SHORT_MAC ], + RTE_SECURITY_PDCP_MODE_SHORT_MAC } };
doc/guides/prog_guide/rte_security.rst +10 -1
@@ -1,5 +1,5 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright 2017,2020 NXP + Copyright 2017,2020-2021 NXP
@@ -408,6 +408,15 @@ PMD which supports the IPsec and PDCP protocol. }, .crypto_capabilities = pmd_capabilities }, + { /* PDCP Lookaside Protocol offload short MAC-I */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags = 0 + }, + .crypto_capabilities = pmd_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }
doc/guides/tools/cryptoperf.rst +2 -2
@@ -316,9 +316,9 @@ The following are the application command-line options: Set PDCP sequence number size(n) in bits. Valid values of n will be 5/7/12/15/18. -* ``--pdcp-domain <control/user>`` +* ``--pdcp-domain <control/user/short_mac>`` - Set PDCP domain to specify Control/user plane. + Set PDCP domain to specify short_mac/control/user plane. * ``--docsis-hdr-sz <n>``
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;
lib/security/rte_security.h +1 -0
@@ -233,6 +233,7 @@ struct rte_security_macsec_xform {enum rte_security_pdcp_domain {RTE_SECURITY_PDCP_MODE_CONTROL ,/**< PDCP control plane */ RTE_SECURITY_PDCP_MODE_DATA ,/**< PDCP data plane */ +RTE_SECURITY_PDCP_MODE_SHORT_MAC ,/**< PDCP short mac */ };/** PDCP Frame direction */
Signature · 1 line
2.25.1
PATCH v2 3/5 test/crypto: add pdcp security short MAC-I support
In reply to Gagandeep SinghThis patch add support to test the pdcp short mac
packets support in crypto.
--- app/test/test_cryptodev.c | 48 ++++++++ ...est_cryptodev_security_pdcp_test_vectors.h | 105 +++++++++++++++++- 2 files changed, 152 insertions(+), 1 deletion(-)
app/test/test_cryptodev.c +48 -0
@@ -8768,6 +8768,50 @@ test_PDCP_SDAP_PROTO_encap_all(void)return (all_err ==TEST_SUCCESS ) ?TEST_SUCCESS :TEST_FAILED ; } +static int +test_PDCP_PROTO_short_mac (void ) +{ +int i =0 , size =0 ; +int err, all_err =TEST_SUCCESS ; +const struct pdcp_short_mac_test *cur_test; + + size =RTE_DIM (list_pdcp_smac_tests); + +for (i =0 ; i < size; i++) { + cur_test = &list_pdcp_smac_tests[i]; + err =test_pdcp_proto ( + i,0 ,RTE_CRYPTO_CIPHER_OP_ENCRYPT , +RTE_CRYPTO_AUTH_OP_GENERATE , cur_test->data_in, + cur_test->in_len, cur_test->data_out, + cur_test->in_len + ((cur_test->auth_key) ?4 :0 ), +RTE_CRYPTO_CIPHER_NULL ,NULL , +0 , cur_test->param.auth_alg, + cur_test->auth_key, cur_test->param.auth_key_len, +0 , cur_test->param.domain,0 ,0 , +0 ,0 ,0 ); +if (err) { +printf ("\t%d) %s: Short MAC test failed\n" , + cur_test->test_idx, + cur_test->param.name); + err =TEST_FAILED ; + }else { +printf ("\t%d) %s: Short MAC test PASS\n" , + cur_test->test_idx, + cur_test->param.name); +rte_hexdump (stdout,"MAC I" , + cur_test->data_out + cur_test->in_len +2 , +2 ); + err =TEST_SUCCESS ; + } + all_err += err; + } + +printf ("Success: %d, Failure: %d\n" , size + all_err, -all_err); + +return (all_err ==TEST_SUCCESS ) ?TEST_SUCCESS :TEST_FAILED ; + +} +static int test_PDCP_SDAP_PROTO_decap_all (void ) {
@@ -14039,6 +14083,8 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_encryption_test_case_5), +TEST_CASE_ST (ut_setup, ut_teardown, + test_PDCP_PROTO_short_mac),TEST_CASE_ST (ut_setup, ut_teardown, test_snow3g_encryption_test_case_1_oop), TEST_CASE_ST(ut_setup, ut_teardown,
@@ -14279,6 +14325,8 @@ static struct unit_test_suite cryptodev_kasumi_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_kasumi_decryption_test_case_1_oop), +TEST_CASE_ST (ut_setup, ut_teardown, + test_PDCP_PROTO_short_mac),TEST_CASE_ST (ut_setup, ut_teardown, test_kasumi_cipher_auth_test_case_1),
app/test/test_cryptodev_security_pdcp_test_vectors.h +104 -1
117 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 4/5 crypto/dpaa2_sec: add PDCP short MAC-I support
In reply to Gagandeep SinghThis patch add PDCP short mac support in dpaa2_sec driver.
--- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 4 ++++ drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 9 +++++++++ 2 files changed, 13 insertions(+)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +4 -0
@@ -3291,6 +3291,10 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, pdcp_xform->hfn_threshold, &cipherdata, &authdata, 0); + + }else if (pdcp_xform->domain ==RTE_SECURITY_PDCP_MODE_SHORT_MAC ) { + bufsize =cnstr_shdsc_pdcp_short_mac (priv->flc_desc[0 ].desc, +1 , swap, &authdata); }else {if (session->dir ==DIR_ENC ) {if (pdcp_xform->sdap_enabled)
drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h +9 -0
@@ -941,6 +941,15 @@ static const struct rte_security_capability dpaa2_sec_security_cap[] = { }, .crypto_capabilities = dpaa2_pdcp_capabilities }, + {/* PDCP Lookaside Protocol offload Short MAC */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags =0 + }, + .crypto_capabilities = dpaa2_pdcp_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }
Signature · 1 line
2.25.1
PATCH v2 5/5 crypto/dpaa_sec: add pdcp short MAC-I support
In reply to Gagandeep SinghThis patch add pdcp security short MAC-I support for dpaa_sec driver.
--- drivers/crypto/dpaa_sec/dpaa_sec.c | 3 +++ drivers/crypto/dpaa_sec/dpaa_sec.h | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
drivers/crypto/dpaa_sec/dpaa_sec.c +3 -0
@@ -294,6 +294,9 @@ dpaa_sec_prep_pdcp_cdb(dpaa_sec_session *ses) ses->pdcp.hfn_threshold, &cipherdata, &authdata, 0); + }else if (ses->pdcp.domain ==RTE_SECURITY_PDCP_MODE_SHORT_MAC ) { + shared_desc_len =cnstr_shdsc_pdcp_short_mac (cdb->sh_desc, +1 , swap, &authdata); }else {if (ses->dir ==DIR_ENC ) {if (ses->pdcp.sdap_enabled)
drivers/crypto/dpaa_sec/dpaa_sec.h +10 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: BSD-3-Clause * -* Copyright 2016-2020 NXP +* Copyright 2016-2021 NXP * */
@@ -769,6 +769,15 @@ static const struct rte_security_capability dpaa_sec_security_cap[] = { }, .crypto_capabilities = dpaa_pdcp_capabilities }, + {/* PDCP Lookaside Protocol offload Short MAC */ + .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol = RTE_SECURITY_PROTOCOL_PDCP, + .pdcp = { + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .capa_flags =0 + }, + .crypto_capabilities = dpaa_pdcp_capabilities + }, { .action = RTE_SECURITY_ACTION_TYPE_NONE }
Signature · 1 line
2.25.1
Quoted 24 lines
----------------------------------------------------------------------
This series add support of Message Authentication Code
- Integrity on DPAAX platforms.v2-change-log:
* update commit message
* merged an existing patch with this series:
https://urldefense.proofpoint.com/v2/url?u=https-
3A__patches.dpdk.org_project_dpdk_patch_20210825081837.23830-2D1- 2Dhemant.agrawal- 40nxp.com_mbox_&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=DnL7Si2wl _PRwpZ9TWey3eu68gBzn7DkPwuqhd6WNyo&m=rsC8q5LCqM75FDZlT9cU21 Qaf4v__D1_IufHF8an_x0&s=8v25- EfDZN2P66hDuhUAZtK5PNPnODDAyGSmtKeQ_oI&e=Gagandeep Singh (4):
common/dpaax: fix IV value for shortMAC-I for SNOW algo test/crypto: add pdcp security short MAC-I supportcrypto/dpaa2_sec: add PDCP short MAC-I supportcrypto/dpaa_sec: add pdcp short MAC-I supportHemant Agrawal (1):
security: support PDCP short MAC-I
Quoted 12 lines
app/test-crypto-perf/cperf_options_parsing.c | 8 +- app/test/test_cryptodev.c | 48 ++++++++ ...est_cryptodev_security_pdcp_test_vectors.h | 105 +++++++++++++++++- doc/guides/prog_guide/rte_security.rst | 11 +- doc/guides/tools/cryptoperf.rst | 4 +- drivers/common/dpaax/caamflib/desc/pdcp.h | 7 +- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 29 +++-- drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 9 ++ drivers/crypto/dpaa_sec/dpaa_sec.c | 3 + drivers/crypto/dpaa_sec/dpaa_sec.h | 11 +- lib/security/rte_security.h | 1 + 11 files changed, 215 insertions(+), 21 deletions(-)
Release notes missing for new feature updates