From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Yang, GangX" Subject: Re: [PATCH] crypto/aesni_mb: add AES DOCSIS BPI support Date: Fri, 3 Mar 2017 06:08:33 +0000 Message-ID: References: <1485950646-116146-1-git-send-email-pablo.de.lara.guarch@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "De Lara Guarch, Pablo" , "Trahe, Fiona" , "Doherty, Declan" To: "dev@dpdk.org" Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id DF4352952 for ; Fri, 3 Mar 2017 07:08:37 +0100 (CET) In-Reply-To: <1485950646-116146-1-git-send-email-pablo.de.lara.guarch@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Tested-by: Yang Gang < gangx.yang@intel.com > - Check patch: success - Apply patch: success - compilation: success OS: fedora23 GCC: gcc_x86-64, 5.3.1 Commit: dpdk-next-crypto(081fefb01748e7063b1b9692af89d8115ec64632) x86_64-native-linuxapp-gcc: compile pass - dts validation: -- Test Commit: e5041333988936fdb09d578ec4fb7cb0ce796ecb -- OS/Kernel: Fedora23/4.2.3-300.fc23.x86_64 -- GCC: gcc version 5.3.1 -- CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 1.80GHz -- NIC: Intel Corporation Ethernet Controller X710 for 10GbE SFP+ [8086:157= 2] -- total 2,failed 0 (case1: contain cryptodev_aesni_mb_autotest and all of = others cryptodev cases on unit test . case 2: all of the related cases about AES DOCSIS BPI cipher only on l2f= wd-crypto test) -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pablo de Lara Sent: Wednesday, February 01, 2017 8:04 PM To: Doherty, Declan Cc: dev@dpdk.org; De Lara Guarch, Pablo Subject: [dpdk-dev] [PATCH] crypto/aesni_mb: add AES DOCSIS BPI support Underlying IPSec Multi buffer library implements DOCSIS specification, so t= his commit adds support for this new feature. Signed-off-by: Pablo de Lara --- This patch depends on following patch and it is targetting 17.05 release: http://dpdk.org/dev/patchwork/patch/19732/ app/test-crypto-perf/cperf_options_parsing.c | 5 + app/test/test_cryptodev.c | 17 +++ app/test/test_cryptodev_aes_test_vectors.h | 142 +++++++++++++++++++++= ++++ app/test/test_cryptodev_blockcipher.c | 5 + app/test/test_cryptodev_blockcipher.h | 1 + doc/guides/cryptodevs/aesni_mb.rst | 1 + drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 3 + drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 21 ++++ examples/l2fwd-crypto/main.c | 1 + lib/librte_cryptodev/rte_cryptodev.c | 3 +- 10 files changed, 198 insertions(+), 1 deletion(-) diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto= -perf/cperf_options_parsing.c index 3b7342d..becc013 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -335,6 +335,11 @@ parse_cipher_algo(struct cperf_options *opts, const ch= ar *arg) }, { rte_crypto_cipher_algorithm_strings + [RTE_CRYPTO_CIPHER_AES_DOCSISBPI], + RTE_CRYPTO_CIPHER_AES_DOCSISBPI + }, + { + rte_crypto_cipher_algorithm_strings [RTE_CRYPTO_CIPHER_AES_ECB], RTE_CRYPTO_CIPHER_AES_ECB }, diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 35= 7a92e..377e713 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1532,6 +1532,22 @@ test_AES_cipheronly_mb_all(void) } =20 static int +test_AES_docsis_mb_all(void) +{ + struct crypto_testsuite_params *ts_params =3D &testsuite_params; + int status; + + status =3D test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, ts_params->valid_devs[0], + RTE_CRYPTODEV_AESNI_MB_PMD, + BLKCIPHER_AES_DOCSIS_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int test_authonly_mb_all(void) { struct crypto_testsuite_params *ts_params =3D &testsuite_params; @@ -7695= ,6 +7711,7 @@ static struct unit_test_suite cryptodev_aesni_mb_testsuite = =3D { .unit_test_cases =3D { TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_mb_all), TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_mb_all), + TEST_CASE_ST(ut_setup, ut_teardown, test_AES_docsis_mb_all), TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_mb_all), =20 TEST_CASES_END() /**< NULL terminate unit test array */ diff --git a/app= /test/test_cryptodev_aes_test_vectors.h b/app/test/test_cryptodev_aes_test_= vectors.h index f3fbef1..aacabab 100644 --- a/app/test/test_cryptodev_aes_test_vectors.h +++ b/app/test/test_cryptodev_aes_test_vectors.h @@ -56,6 +56,26 @@ static const uint8_t ciphertext64_aes128ctr[] =3D { 0x79, 0x21, 0x70, 0xA0, 0xF3, 0x00, 0x9C, 0xEE }; =20 +static const uint8_t plaintext_aes_docsis_bpi_cfb[] =3D { + 0x00, 0x01, 0x02, 0x88, 0xEE, 0x59, 0x7E }; + +static const uint8_t ciphertext_aes_docsis_bpi_cfb[] =3D { + 0xFC, 0x68, 0xA3, 0x55, 0x60, 0x37, 0xDC }; + +static const uint8_t plaintext_aes_docsis_bpi_cbc_cfb[] =3D { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x91, + 0xD2, 0xD1, 0x9F +}; + +static const uint8_t ciphertext_aes_docsis_bpi_cbc_cfb[] =3D { + 0x9D, 0xD1, 0x67, 0x4B, 0xBA, 0x61, 0x10, 0x1B, + 0x56, 0x75, 0x64, 0x74, 0x36, 0x4F, 0x10, 0x1D, + 0x44, 0xD4, 0x73 +}; + static const uint8_t plaintext_aes192ctr[] =3D { 0x01, 0x0F, 0x10, 0x1F, 0x20, 0x1C, 0x0E, 0xB8, 0xFB, 0x5C, 0xCD, 0xCC, 0x1F, 0xF9, 0xAF, 0x0B, @@ -917,6 +937,89 @@ stat= ic const struct blockcipher_test_data aes_test_data_13 =3D { } }; =20 +/* AES-DOCSIS-BPI test vectors */ + +/* Multiple of AES block size */ +static const struct blockcipher_test_data aes_test_data_docsis_1 =3D { + .crypto_algo =3D RTE_CRYPTO_CIPHER_AES_DOCSISBPI, + .cipher_key =3D { + .data =3D { + 0xE4, 0x23, 0x33, 0x8A, 0x35, 0x64, 0x61, 0xE2, + 0x49, 0x03, 0xDD, 0xC6, 0xB8, 0xCA, 0x55, 0x7A + }, + .len =3D 16 + }, + .iv =3D { + .data =3D { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F + }, + .len =3D 16 + }, + .plaintext =3D { + .data =3D plaintext_aes_common, + .len =3D 512 + }, + .ciphertext =3D { + .data =3D ciphertext512_aes128cbc, + .len =3D 512 + } +}; + +/* Less than AES block size */ +static const struct blockcipher_test_data aes_test_data_docsis_2 =3D { + .crypto_algo =3D RTE_CRYPTO_CIPHER_AES_DOCSISBPI, + .cipher_key =3D { + .data =3D { + 0xE6, 0x60, 0x0F, 0xD8, 0x85, 0x2E, 0xF5, 0xAB, + 0xE6, 0x60, 0x0F, 0xD8, 0x85, 0x2E, 0xF5, 0xAB + }, + .len =3D 16 + }, + .iv =3D { + .data =3D { + 0x81, 0x0E, 0x52, 0x8E, 0x1C, 0x5F, 0xDA, 0x1A, + 0x81, 0x0E, 0x52, 0x8E, 0x1C, 0x5F, 0xDA, 0x1A + }, + .len =3D 16 + }, + .plaintext =3D { + .data =3D plaintext_aes_docsis_bpi_cfb, + .len =3D 7 + }, + .ciphertext =3D { + .data =3D ciphertext_aes_docsis_bpi_cfb, + .len =3D 7 + } +}; + +/* Not multiple of AES block size */ +static const struct blockcipher_test_data aes_test_data_docsis_3 =3D { + .crypto_algo =3D RTE_CRYPTO_CIPHER_AES_DOCSISBPI, + .cipher_key =3D { + .data =3D { + 0xE6, 0x60, 0x0F, 0xD8, 0x85, 0x2E, 0xF5, 0xAB, + 0xE6, 0x60, 0x0F, 0xD8, 0x85, 0x2E, 0xF5, 0xAB + }, + .len =3D 16 + }, + .iv =3D { + .data =3D { + 0x81, 0x0E, 0x52, 0x8E, 0x1C, 0x5F, 0xDA, 0x1A, + 0x81, 0x0E, 0x52, 0x8E, 0x1C, 0x5F, 0xDA, 0x1A + }, + .len =3D 16 + }, + .plaintext =3D { + .data =3D plaintext_aes_docsis_bpi_cbc_cfb, + .len =3D 19 + }, + .ciphertext =3D { + .data =3D ciphertext_aes_docsis_bpi_cbc_cfb, + .len =3D 19 + } +}; + static const struct blockcipher_test_case aes_chain_test_cases[] =3D { { .test_descr =3D "AES-128-CTR HMAC-SHA1 Encryption Digest", @@ -1330,4 +1= 433,43 @@ static const struct blockcipher_test_case aes_cipheronly_test_cas= es[] =3D { }, }; =20 +static const struct blockcipher_test_case aes_docsis_test_cases[] =3D { + + { + .test_descr =3D "AES-DOCSIS-BPI Full Block Encryption", + .test_data =3D &aes_test_data_docsis_1, + .op_mask =3D BLOCKCIPHER_TEST_OP_ENCRYPT, + .pmd_mask =3D BLOCKCIPHER_TEST_TARGET_PMD_MB + }, + { + .test_descr =3D "AES-DOCSIS-BPI Runt Block Encryption", + .test_data =3D &aes_test_data_docsis_2, + .op_mask =3D BLOCKCIPHER_TEST_OP_ENCRYPT, + .pmd_mask =3D BLOCKCIPHER_TEST_TARGET_PMD_MB + }, + { + .test_descr =3D "AES-DOCSIS-BPI Uneven Encryption", + .test_data =3D &aes_test_data_docsis_3, + .op_mask =3D BLOCKCIPHER_TEST_OP_ENCRYPT, + .pmd_mask =3D BLOCKCIPHER_TEST_TARGET_PMD_MB + }, + { + .test_descr =3D "AES-DOCSIS-BPI Full Block Decryption", + .test_data =3D &aes_test_data_docsis_1, + .op_mask =3D BLOCKCIPHER_TEST_OP_DECRYPT, + .pmd_mask =3D BLOCKCIPHER_TEST_TARGET_PMD_MB + }, + { + .test_descr =3D "AES-DOCSIS-BPI Runt Block Decryption", + .test_data =3D &aes_test_data_docsis_2, + .op_mask =3D BLOCKCIPHER_TEST_OP_DECRYPT, + .pmd_mask =3D BLOCKCIPHER_TEST_TARGET_PMD_MB + }, + { + .test_descr =3D "AES-DOCSIS-BPI Uneven Decryption", + .test_data =3D &aes_test_data_docsis_3, + .op_mask =3D BLOCKCIPHER_TEST_OP_DECRYPT, + .pmd_mask =3D BLOCKCIPHER_TEST_TARGET_PMD_MB + } +}; #endif /* TEST_CRYPTODEV_AES_TEST_VECTORS_H_ */ diff --git a/app/test/test= _cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c index da87368..9d39b7d 100644 --- a/app/test/test_cryptodev_blockcipher.c +++ b/app/test/test_cryptodev_blockcipher.c @@ -613,6 +613,11 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_po= ol, sizeof(aes_cipheronly_test_cases[0]); tcs =3D aes_cipheronly_test_cases; break; + case BLKCIPHER_AES_DOCSIS_TYPE: + n_test_cases =3D sizeof(aes_docsis_test_cases) / + sizeof(aes_docsis_test_cases[0]); + tcs =3D aes_docsis_test_cases; + break; case BLKCIPHER_3DES_CHAIN_TYPE: n_test_cases =3D sizeof(triple_des_chain_test_cases) / sizeof(triple_des_chain_test_cases[0]); diff --git a/app/test/test_cryptodev_blockcipher.h b/app/test/test_cryptode= v_blockcipher.h index 053aaa1..6e37121 100644 --- a/app/test/test_cryptodev_blockcipher.h +++ b/app/test/test_cryptodev_blockcipher.h @@ -68,6 +68,7 @@ enum blockcipher_test_type { BLKCIPHER_AES_CHAIN_TYPE, /* use aes_chain_test_cases[] */ BLKCIPHER_AES_CIPHERONLY_TYPE, /* use aes_cipheronly_test_cases[] */ + BLKCIPHER_AES_DOCSIS_TYPE, /* use aes_docsis_test_cases[] */ BLKCIPHER_3DES_CHAIN_TYPE, /* use triple_des_chain_test_cases[] */ BLKCIPHER_3DES_CIPHERONLY_TYPE, /* triple_des_cipheronly_test_cases[] */ BLKCIPHER_AUTHONLY_TYPE, /* use hash_test_cases[] */ diff --git a/doc/guides/cryptodevs/aesni_mb.rst b/doc/guides/cryptodevs/aes= ni_mb.rst index 8b18eba..3427e41 100644 --- a/doc/guides/cryptodevs/aesni_mb.rst +++ b/doc/guides/cryptodevs/aesni_mb.rst @@ -51,6 +51,7 @@ Cipher algorithms: * RTE_CRYPTO_CIPHER_AES128_CTR * RTE_CRYPTO_CIPHER_AES192_CTR * RTE_CRYPTO_CIPHER_AES256_CTR +* RTE_CRYPTO_CIPHER_AES_DOCSISBPI =20 Hash algorithms: =20 diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/ae= sni_mb/rte_aesni_mb_pmd.c index 432d239..15c445f 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -218,6 +218,9 @@ aesni_mb_set_session_cipher_parameters(const struct aes= ni_mb_ops *mb_ops, case RTE_CRYPTO_CIPHER_AES_CTR: sess->cipher.mode =3D CNTR; break; + case RTE_CRYPTO_CIPHER_AES_DOCSISBPI: + sess->cipher.mode =3D DOCSIS_SEC_BPI; + break; default: MB_LOG_ERR("Unsupported cipher mode parameter"); return -1; diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c b/drivers/crypt= o/aesni_mb/rte_aesni_mb_pmd_ops.c index 3d49e2a..9c1b826 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c @@ -227,6 +227,27 @@ static const struct rte_cryptodev_capabilities aesni_m= b_pmd_capabilities[] =3D { }, } }, } }, + { /* AES DOCSIS BPI */ + .op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym =3D { + .xform_type =3D RTE_CRYPTO_SYM_XFORM_CIPHER, + {.cipher =3D { + .algo =3D RTE_CRYPTO_CIPHER_AES_DOCSISBPI, + .block_size =3D 16, + .key_size =3D { + .min =3D 16, + .max =3D 16, + .increment =3D 0 + }, + .iv_size =3D { + .min =3D 16, + .max =3D 16, + .increment =3D 0 + } + }, } + }, } + }, + RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() }; =20 diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c in= dex 43fef59..b592f57 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -365,6 +365,7 @@ fill_supported_algorithm_tables(void) =20 strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_AES_CBC], "AES_CBC"); strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_AES_CTR], "AES_CTR"); + strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_AES_DOCSISBPI],=20 +"AES_DOCSISBPI"); strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_AES_GCM], "AES_GCM"); strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_NULL], "NULL"); strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_SNOW3G_UEA2], "SNOW3G_UEA2= "); diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptode= v/rte_cryptodev.c index e557e77..5af7080 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -137,7 +137,8 @@ rte_crypto_cipher_algorithm_strings[] =3D { =20 [RTE_CRYPTO_CIPHER_KASUMI_F8] =3D "kasumi-f8", [RTE_CRYPTO_CIPHER_SNOW3G_UEA2] =3D "snow3g-uea2", - [RTE_CRYPTO_CIPHER_ZUC_EEA3] =3D "zuc-eea3" + [RTE_CRYPTO_CIPHER_ZUC_EEA3] =3D "zuc-eea3", + [RTE_CRYPTO_CIPHER_AES_DOCSISBPI] =3D "aes-docsisbpi" }; =20 /** -- 2.7.4