From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 77C49A0C41; Wed, 6 Oct 2021 16:48:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4469B41136; Wed, 6 Oct 2021 16:48:42 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id A9D4B41130 for ; Wed, 6 Oct 2021 16:48:39 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1969kcLo007632; Wed, 6 Oct 2021 07:48:39 -0700 Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2109.outbound.protection.outlook.com [104.47.58.109]) by mx0b-0016f401.pphosted.com with ESMTP id 3bh9fd14ww-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Oct 2021 07:48:38 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WEpNzvQPpIB2G2wx/o0jycXo+kTYO7oxnU/idfY8ienNYL+EqtUZLPg+TbTTysNobySULszJ9WYiGSkH12WaJbTHVh/UuF9RVfU6rRcSkF0XA2KnQTs9mKlQfl5YWLaCm1HgWoJWnvFYIN9Wq7GyV4bI4ynPGqb3M0LhHTHN4NXt8HtVJq3+5lRu3HqELXoWF/il8kBlbyIb3QqSUAFlKd/en2LwSQKcncaPLFe+Db0BVZT5qIagiK8/30c2MBy4FamzSV0p0fbYmN+2dqLIGcKJzF5FWmRahJ4xJh4/OAbHZqFxXzQpiQLjP5izegwAmnDJxRiQEP/w8xH0wkLrIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lITKqI8/WoFVvO3CvGXVJ5i2lKEF1ww4jj2eAui8H7g=; b=S9ZpLKaVQpJ/PO0DJ8HstILgYpl04Vfpp8bgT6mDM4e2Ms5tugETo6Ji3+yU+d0TlslIFIAsvqI2Jq1gpoMRZEkYvDgOWb68i8NdXoWN19i4LN6vRcD0s1+87kBXPGQJ9J8Wxjfxg89eRAKrXq/W8VCdM0c/NLKRpSOlRu2jQqKMmU7QPCNBf8Sej/IuC69HNOZLfoxmX9Qw1NKpdtyv3e+a/cIdhfVsQPTz4BCL4H8z8qtBZEX4tlfaEuibjpPZpT1mUwbcMAGpoabTrwrFs5ROPiSIOSrm5uTCISoasS9/iZe097WrSG3EJllK2U8li27gGfT8fUZFHr/ihvOhow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lITKqI8/WoFVvO3CvGXVJ5i2lKEF1ww4jj2eAui8H7g=; b=g/v7P1CCe/bQSCG6bsRMvqvz0DvnK0P4QRqi6t4EPzAIe60wTJLYTYg+eYbN3VknzMjxBdMBcHIFmZEoXg5frR5bN1gdTt/et753LA+tOe9OWY7kiPTQHf2/dz+bEFaUemTvRIICF9gyn7px34V5U04igKOLt5aCKKP+z1jI0CI= Received: from CO6PR18MB4484.namprd18.prod.outlook.com (2603:10b6:5:359::9) by CO6PR18MB4481.namprd18.prod.outlook.com (2603:10b6:303:13a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Wed, 6 Oct 2021 14:48:30 +0000 Received: from CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::c41e:707:3f91:71b8]) by CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::c41e:707:3f91:71b8%6]) with mapi id 15.20.4566.023; Wed, 6 Oct 2021 14:48:30 +0000 From: Akhil Goyal To: Ciara Power , "dev@dpdk.org" CC: "roy.fan.zhang@intel.com" , "piotrx.bronowski@intel.com" , Kai Ji , Declan Doherty , Pablo de Lara Thread-Topic: [EXT] [PATCH v3 09/10] crypto/ipsec_mb: add chacha20-poly1305 PMD to framework Thread-Index: AQHXtU9sSp9/6TUqOkaC7s7SKnlZsKvGFYpA Date: Wed, 6 Oct 2021 14:48:30 +0000 Message-ID: References: <20210727083832.291687-1-roy.fan.zhang@intel.com> <20210929163035.608387-1-ciara.power@intel.com> <20210929163035.608387-10-ciara.power@intel.com> In-Reply-To: <20210929163035.608387-10-ciara.power@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f830ec83-c0d5-41fc-f2fa-08d988d85cf3 x-ms-traffictypediagnostic: CO6PR18MB4481: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:639; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: bh2SaZcDKIlsqD0QfCjzDb6YG/5GLsQXn5Ab7tjfQBOdmUJ4f4iiZmhCw8SZAg8sG5Qf2dZLPWqmyFhtu5nsZvZprBB+XSvXAFT/rbm7wnsT1reapq36nUdB5y8UC92wqJZi75lmYS458f5NPDwTPufuhEJk7wyUe07P9lc6mOudFKxWZYrndmaf+7HITQnVhv3jYTlIvcfca4epeQVfhiJ7tjUVuAP+v7Bwfuh0lrDJz2UiZbGCu8OjFurLOXRGw8Mz+KH+MNl0U2coGlDL/Ax5PHjwLE4tF22bZ3Dtan5u+1/Z+QxBGhDqlu0qhH8bTs7BgSqWw40w/ZeXii31JY0DQx764UGfIIDJfBfKLZCA/zRUPIk7FYEnnzXOPb3+H5wj55NcBuLwtFy0HRd2IDBkI3tlxeOIRxc/bjqrUz1Cgk4E/59VUNN2ywSwER1MBjy3BJG67I50zY6hdb7wyGk3BYxQFZ21hmgvHL7JdGrYn17nfIFdmMcu0f+20hp9ZWPFFdlkSajCbGK3cAiW8VwQ4hyoFipCQh1syACUFM/a2JdUzTtlOyG9ueKRBd4BY0FbAz3+/Md9mvyfvciAF+WEM00hXbNVDXbYa33bOoPb8uC5pt0BvnZczbDzw6aOYgjg6Rdn3KPNiGRGdESQX0VVV6WtqmgxJQsStwNb9ihJokWnebaEAfA+pvXGi7MD3QjkrEHuDUCNp6soPB9ptb2p4jn9Ah2OmgNOspvw4q5anpZ1e4QTGNmTOsTO1wsw9gVYofELU51qbWIMNaD5XlQGaU6xzLgXE2h5lXnv0Sg= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR18MB4484.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(55016002)(4326008)(8676002)(64756008)(66556008)(66476007)(26005)(66446008)(71200400001)(33656002)(66946007)(186003)(76116006)(8936002)(9686003)(86362001)(38070700005)(2906002)(6506007)(83380400001)(55236004)(7696005)(508600001)(54906003)(122000001)(52536014)(110136005)(316002)(5660300002)(30864003)(38100700002)(579004)(559001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?m4clGN3Fz/hmw38LyEdTa9cWv6PUlEg7h+mNT1Q8MbBWVTEVpLhVFAkqYVB/?= =?us-ascii?Q?pLjngc/ErD/iWSHkY9UC7rBrn0AypRMQGkiqNMyKOGyb6j3slvNd5msB45fl?= =?us-ascii?Q?B2ho+XKVPYRa29Px8OvYPSwNDmb+/uU0hDIBF9C7Nk0kW3cXAaQcfJSJPS9H?= =?us-ascii?Q?KMyPrJFVSJJ7cY4QrXcK1KckquVrqT4LK1dyGtOHbaZNqZsaaF2U2D+3+Hbi?= =?us-ascii?Q?o9U5SFcpkPxUo3Sg2CGF4Hcmf3Tf5nCKoPjJzgackpYARLiNp9b7o+U6/+x5?= =?us-ascii?Q?buUdPaSLz5Uy9IfxO7rJQqvWYcLqsOs3Qgi7WzZKMq3dRDDBmjgFhBeyn4kb?= =?us-ascii?Q?jH5i4bYiW+RuWGYqYkm2fKqVqJjXZRLK0FkXhD0Vw2AmnUw6pOAFwt6qwsdr?= =?us-ascii?Q?YrEW3Hn+JEw+0Ka50KR63AO3RFTLa5yZNAku4F1btprOJLmcwVnBaEOyLBTH?= =?us-ascii?Q?MUvHauIPD3br/9U6+hj03cWrl0JnMwbNREMAeZIag+jzprgCQ1CfJrSQibvQ?= =?us-ascii?Q?EoKgOKTw8MenAwzQn9nmiXdCr80wAwKspT8HNJH24eJvlf7BzZIrv2zyvK+U?= =?us-ascii?Q?SHROepbOsc10HqeKPyaOFAtnctx4F7qSUcVHMwCm0TZbaNgZmkuOh419R9i6?= =?us-ascii?Q?86VIINFfawNfhF1/U6LEI2cUDn2IeslXSzUvTcC60M7BXVNp92m2GXWUWOuL?= =?us-ascii?Q?ccGP1gCfHkfGxvz3YwE0Fizp4z1piaekmu0ZJ2GZ5eFcx2zCHSeCQzgxJckc?= =?us-ascii?Q?KliAwwvEflykB0INRW4i5ynXsifuhyUecXLDx7pRI3jF195YbMbQcY7VNqng?= =?us-ascii?Q?7XAOhcXPxIwUorjAMJxo/nt+5pZ6fNiBLfDB4YhqfI74vvSIxjrye+5//lKP?= =?us-ascii?Q?LSIvW7cXqYRyIU/PzkX8JHY4ldkrO5MUudqhc0NaDHku5PIl3MkZ7uDRV1Pr?= =?us-ascii?Q?uZCMcmAZskhnMccAHLzOZ7wQD/xbJuJSI+5OKbhsC2+wV9I/FCHDaqK62IV0?= =?us-ascii?Q?J03+G3ZknbyXuVD7+mVpVyiftz+vDohkEvv7gn7vTMbLJLnk3yjdZ9p7W0ni?= =?us-ascii?Q?DOw/YBDbGRKNf0iC0uPT95RmY9URBmugf0+3bReMWSx4px4aMdnxYypUUaUK?= =?us-ascii?Q?tVWnfVgmH6XkDMCp5o3t6PIqOe1ZFkhI7NVduea1GcvZ1bSf+7dnG96z0ok8?= =?us-ascii?Q?oCW0W921A7SKMy9aU4ETss5rCN32QFItiOQWctKFEe9WHh75XdEVgKdEaydz?= =?us-ascii?Q?lC/b7BDdFvxTamY4d9VoRXciTNBvYQi2dFriAlW7ldsqZoUQRWl7g79Mm6qJ?= =?us-ascii?Q?mA00ao0gjKZvnVTzmjuligvP?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR18MB4484.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f830ec83-c0d5-41fc-f2fa-08d988d85cf3 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Oct 2021 14:48:30.1140 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: cyRFZ7FhPaB/oRWAlpHjt8cC1Ng3phdwDEzwBhFU4Mw0fDxwtSLB64lXQz2qH7ojxLPUjIMc8VhaY5Alrux+mQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR18MB4481 X-Proofpoint-GUID: ueeS-UCR75gPmfrm08f8gR4tiyUvhlND X-Proofpoint-ORIG-GUID: ueeS-UCR75gPmfrm08f8gR4tiyUvhlND X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-10-06_04,2021-10-06_01,2020-04-07_01 Subject: Re: [dpdk-dev] [EXT] [PATCH v3 09/10] crypto/ipsec_mb: add chacha20-poly1305 PMD to framework X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > From: Kai Ji >=20 > Add in new chacha20_poly1305 support in ipsec_mb. > Add in new chacha20_poly1305 test vector for SGL test. >=20 > Signed-off-by: Kai Ji > Signed-off-by: Ciara Power >=20 > --- > v3: > - Fixed some formatting. > - Removed unnecessary get session function. >=20 > v2: > - Added unused tag to session configure parameter. > - Added release note. > - Added documentation for PMD. > --- > app/test/test_cryptodev.c | 23 + > app/test/test_cryptodev.h | 1 + > app/test/test_cryptodev_aead_test_vectors.h | 114 +++++ Separate out test app changes from this patch. > doc/guides/cryptodevs/chacha20_poly1305.rst | 99 ++++ > .../cryptodevs/features/chacha20_poly1305.ini | 35 ++ > doc/guides/cryptodevs/index.rst | 1 + > doc/guides/rel_notes/release_21_11.rst | 5 + > drivers/crypto/ipsec_mb/meson.build | 1 + > drivers/crypto/ipsec_mb/pmd_chacha_poly.c | 482 ++++++++++++++++++ > .../ipsec_mb/rte_ipsec_mb_pmd_private.h | 7 + > 10 files changed, 768 insertions(+) > create mode 100644 doc/guides/cryptodevs/chacha20_poly1305.rst > create mode 100644 > doc/guides/cryptodevs/features/chacha20_poly1305.ini > create mode 100644 drivers/crypto/ipsec_mb/pmd_chacha_poly.c >=20 > diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c > index 16d770a17f..92c9bd0141 100644 > --- a/app/test/test_cryptodev.c > +++ b/app/test/test_cryptodev.c > @@ -13455,6 +13455,14 @@ > test_chacha20_poly1305_decrypt_test_case_rfc8439(void) > return > test_authenticated_decryption(&chacha20_poly1305_case_rfc8439); > } >=20 > +static int > +test_chacha20_poly1305_encrypt_SGL_out_of_place(void) > +{ > + return test_authenticated_encryption_SGL( > + &chacha20_poly1305_case_2, OUT_OF_PLACE, 32, > + chacha20_poly1305_case_2.plaintext.len); > +} > + > #ifdef RTE_CRYPTO_SCHEDULER >=20 > /* global AESNI worker IDs for the scheduler test */ > @@ -14063,6 +14071,8 @@ static struct unit_test_suite > cryptodev_chacha20_poly1305_testsuite =3D { >=20 > test_chacha20_poly1305_encrypt_test_case_rfc8439), > TEST_CASE_ST(ut_setup, ut_teardown, >=20 > test_chacha20_poly1305_decrypt_test_case_rfc8439), > + TEST_CASE_ST(ut_setup, ut_teardown, > + > test_chacha20_poly1305_encrypt_SGL_out_of_place), > TEST_CASES_END() > } > }; > @@ -14629,6 +14639,17 @@ test_cryptodev_cpu_aesni_mb(void) > return rc; > } >=20 > +static int > +test_cryptodev_chacha_poly_mb(void) > +{ > + int32_t rc; > + enum rte_security_session_action_type at =3D gbl_action_type; > + rc =3D run_cryptodev_testsuite( > + > RTE_STR(CRYPTODEV_NAME_CHACHA20_POLY1305_PMD)); > + gbl_action_type =3D at; > + return rc; > +} > + > static int > test_cryptodev_openssl(void) > { > @@ -14888,6 +14909,8 @@ > REGISTER_TEST_COMMAND(cryptodev_qat_autotest, test_cryptodev_qat); > REGISTER_TEST_COMMAND(cryptodev_aesni_mb_autotest, > test_cryptodev_aesni_mb); > REGISTER_TEST_COMMAND(cryptodev_cpu_aesni_mb_autotest, > test_cryptodev_cpu_aesni_mb); > +REGISTER_TEST_COMMAND(cryptodev_chacha_poly_mb_autotest, > + test_cryptodev_chacha_poly_mb); > REGISTER_TEST_COMMAND(cryptodev_openssl_autotest, > test_cryptodev_openssl); > REGISTER_TEST_COMMAND(cryptodev_aesni_gcm_autotest, > test_cryptodev_aesni_gcm); > REGISTER_TEST_COMMAND(cryptodev_cpu_aesni_gcm_autotest, > diff --git a/app/test/test_cryptodev.h b/app/test/test_cryptodev.h > index 1cdd84d01f..90c8287365 100644 > --- a/app/test/test_cryptodev.h > +++ b/app/test/test_cryptodev.h > @@ -59,6 +59,7 @@ > #define CRYPTODEV_NAME_SNOW3G_PMD crypto_snow3g > #define CRYPTODEV_NAME_KASUMI_PMD crypto_kasumi > #define CRYPTODEV_NAME_ZUC_PMD crypto_zuc > +#define CRYPTODEV_NAME_CHACHA20_POLY1305_PMD > crypto_chacha20_poly1305 > #define CRYPTODEV_NAME_ARMV8_PMD crypto_armv8 > #define CRYPTODEV_NAME_DPAA_SEC_PMD crypto_dpaa_sec > #define CRYPTODEV_NAME_DPAA2_SEC_PMD crypto_dpaa2_sec > diff --git a/app/test/test_cryptodev_aead_test_vectors.h > b/app/test/test_cryptodev_aead_test_vectors.h > index 73cc143f10..07292620a4 100644 > --- a/app/test/test_cryptodev_aead_test_vectors.h > +++ b/app/test/test_cryptodev_aead_test_vectors.h > @@ -3930,4 +3930,118 @@ static const struct aead_test_data > chacha20_poly1305_case_rfc8439 =3D { > .len =3D 16 > } > }; > + Any specific reason to add new vectors for chacha poly? Are the ones already present not enough? > +static uint8_t chacha_aad_2[] =3D { > + 0xf3, 0x33, 0x88, 0x86, 0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00, 0x4e, 0x91 > +}; > + > +static const struct aead_test_data chacha20_poly1305_case_2 =3D { > + .algo =3D RTE_CRYPTO_AEAD_CHACHA20_POLY1305, > + .key =3D { > + .data =3D { > + 0x1c, 0x92, 0x40, 0xa5, 0xeb, 0x55, 0xd3, > 0x8a, > + 0xf3, 0x33, 0x88, 0x86, 0x04, 0xf6, 0xb5, 0xf0, > + 0x47, 0x39, 0x17, 0xc1, 0x40, 0x2b, 0x80, > 0x09, > + 0x9d, 0xca, 0x5c, 0xbc, 0x20, 0x70, 0x75, 0xc0 > + }, > + .len =3D 32 > + }, > + .iv =3D { > + .data =3D { > + 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, > 0x04, > + 0x05, 0x06, 0x07, 0x08 > + }, > + .len =3D 12 > + }, > + .aad =3D { > + .data =3D chacha_aad_2, > + .len =3D 12 > + }, > + .plaintext =3D { > + .data =3D { > + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, > 0x74, > + 0x2d, 0x44, 0x72, 0x61, 0x66, 0x74, 0x73, > 0x20, > + 0x61, 0x72, 0x65, 0x20, 0x64, 0x72, 0x61, > 0x66, > + 0x74, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, > 0x65, > + 0x6e, 0x74, 0x73, 0x20, 0x76, 0x61, 0x6c, > 0x69, > + 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, > 0x20, > + 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, > 0x20, > + 0x6f, 0x66, 0x20, 0x73, 0x69, 0x78, 0x20, > 0x6d, > + 0x6f, 0x6e, 0x74, 0x68, 0x73, 0x20, 0x61, > 0x6e, > + 0x64, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, > 0x65, > + 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, > 0x64, > + 0x2c, 0x20, 0x72, 0x65, 0x70, 0x6c, 0x61, > 0x63, > + 0x65, 0x64, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x6f, > + 0x62, 0x73, 0x6f, 0x6c, 0x65, 0x74, 0x65, > 0x64, > + 0x20, 0x62, 0x79, 0x20, 0x6f, 0x74, 0x68, > 0x65, > + 0x72, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, > 0x65, > + 0x6e, 0x74, 0x73, 0x20, 0x61, 0x74, 0x20, > 0x61, > + 0x6e, 0x79, 0x20, 0x74, 0x69, 0x6d, 0x65, > 0x2e, > + 0x20, 0x49, 0x74, 0x20, 0x69, 0x73, 0x20, > 0x69, > + 0x6e, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x70, > 0x72, > + 0x69, 0x61, 0x74, 0x65, 0x20, 0x74, 0x6f, > 0x20, > + 0x75, 0x73, 0x65, 0x20, 0x49, 0x6e, 0x74, > 0x65, > + 0x72, 0x6e, 0x65, 0x74, 0x2d, 0x44, 0x72, > 0x61, > + 0x66, 0x74, 0x73, 0x20, 0x61, 0x73, 0x20, > 0x72, > + 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, > 0x65, > + 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, > 0x61, > + 0x6c, 0x20, 0x6f, 0x72, 0x20, 0x74, 0x6f, 0x20, > + 0x63, 0x69, 0x74, 0x65, 0x20, 0x74, 0x68, > 0x65, > + 0x6d, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, > 0x20, > + 0x74, 0x68, 0x61, 0x6e, 0x20, 0x61, 0x73, > 0x20, > + 0x2f, 0xe2, 0x80, 0x9c, 0x77, 0x6f, 0x72, > 0x6b, > + 0x20, 0x69, 0x6e, 0x20, 0x70, 0x72, 0x6f, > 0x67, > + 0x72, 0x65, 0x73, 0x73, 0x2e, 0x2f, 0xe2, > 0x80, > + 0x9d > + }, > + .len =3D 265 > + }, > + .ciphertext =3D { > + .data =3D { > + 0x64, 0xa0, 0x86, 0x15, 0x75, 0x86, 0x1a, > 0xf4, > + 0x60, 0xf0, 0x62, 0xc7, 0x9b, 0xe6, 0x43, > 0xbd, > + 0x5e, 0x80, 0x5c, 0xfd, 0x34, 0x5c, 0xf3, 0x89, > + 0xf1, 0x08, 0x67, 0x0a, 0xc7, 0x6c, 0x8c, > 0xb2, > + 0x4c, 0x6c, 0xfc, 0x18, 0x75, 0x5d, 0x43, > 0xee, > + 0xa0, 0x9e, 0xe9, 0x4e, 0x38, 0x2d, 0x26, > 0xb0, > + 0xbd, 0xb7, 0xb7, 0x3c, 0x32, 0x1b, 0x01, > 0x00, > + 0xd4, 0xf0, 0x3b, 0x7f, 0x35, 0x58, 0x94, 0xcf, > + 0x33, 0x2f, 0x83, 0x0e, 0x71, 0x0b, 0x97, > 0xce, > + 0x98, 0xc8, 0xa8, 0x4a, 0xbd, 0x0b, 0x94, > 0x81, > + 0x14, 0xad, 0x17, 0x6e, 0x00, 0x8d, 0x33, > 0xbd, > + 0x60, 0xf9, 0x82, 0xb1, 0xff, 0x37, 0xc8, 0x55, > + 0x97, 0x97, 0xa0, 0x6e, 0xf4, 0xf0, 0xef, 0x61, > + 0xc1, 0x86, 0x32, 0x4e, 0x2b, 0x35, 0x06, > 0x38, > + 0x36, 0x06, 0x90, 0x7b, 0x6a, 0x7c, 0x02, > 0xb0, > + 0xf9, 0xf6, 0x15, 0x7b, 0x53, 0xc8, 0x67, > 0xe4, > + 0xb9, 0x16, 0x6c, 0x76, 0x7b, 0x80, 0x4d, > 0x46, > + 0xa5, 0x9b, 0x52, 0x16, 0xcd, 0xe7, 0xa4, > 0xe9, > + 0x90, 0x40, 0xc5, 0xa4, 0x04, 0x33, 0x22, > 0x5e, > + 0xe2, 0x82, 0xa1, 0xb0, 0xa0, 0x6c, 0x52, > 0x3e, > + 0xaf, 0x45, 0x34, 0xd7, 0xf8, 0x3f, 0xa1, 0x15, > + 0x5b, 0x00, 0x47, 0x71, 0x8c, 0xbc, 0x54, > 0x6a, > + 0x0d, 0x07, 0x2b, 0x04, 0xb3, 0x56, 0x4e, > 0xea, > + 0x1b, 0x42, 0x22, 0x73, 0xf5, 0x48, 0x27, > 0x1a, > + 0x0b, 0xb2, 0x31, 0x60, 0x53, 0xfa, 0x76, > 0x99, > + 0x19, 0x55, 0xeb, 0xd6, 0x31, 0x59, 0x43, > 0x4e, > + 0xce, 0xbb, 0x4e, 0x46, 0x6d, 0xae, 0x5a, > 0x10, > + 0x73, 0xa6, 0x72, 0x76, 0x27, 0x09, 0x7a, > 0x10, > + 0x49, 0xe6, 0x17, 0xd9, 0x1d, 0x36, 0x10, > 0x94, > + 0xfa, 0x68, 0xf0, 0xff, 0x77, 0x98, 0x71, 0x30, > + 0x30, 0x5b, 0xea, 0xba, 0x2e, 0xda, 0x04, > 0xdf, > + 0x99, 0x7b, 0x71, 0x4d, 0x6c, 0x6f, 0x2c, > 0x29, > + 0xa6, 0xad, 0x5c, 0xb4, 0x02, 0x2b, 0x02, > 0x70, > + 0x9b > + }, > + .len =3D 265 > + }, > + .auth_tag =3D { > + .data =3D { > + 0xee, 0xad, 0x9d, 0x67, 0x89, 0x0c, 0xbb, > 0x22, > + 0x39, 0x23, 0x36, 0xfe, 0xa1, 0x85, 0x1f, 0x38 > + }, > + .len =3D 16 > + } > +}; > #endif /* TEST_CRYPTODEV_AEAD_TEST_VECTORS_H_ */ > diff --git a/doc/guides/cryptodevs/chacha20_poly1305.rst > b/doc/guides/cryptodevs/chacha20_poly1305.rst > new file mode 100644 > index 0000000000..e5f7368d6d > --- /dev/null > +++ b/doc/guides/cryptodevs/chacha20_poly1305.rst > @@ -0,0 +1,99 @@ > +.. SPDX-License-Identifier: BSD-3-Clause > + Copyright(c) 2016-2019 Intel Corporation. > + > +Chacha20-poly1305 Crypto Poll Mode Driver > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +The Chacha20-poly1305 PMD provides poll mode crypto driver support for > +utilizing `Intel IPSec Multi-buffer library > 3A__github.com_01org_intel-2Dipsec- > 2Dmb&d=3DDwIDAg&c=3DnKjWec2b6R0mOyPaz7xtfQ&r=3DDnL7Si2wl_PRwpZ9TWe > y3eu68gBzn7DkPwuqhd6WNyo&m=3DcJBMpjPsWqfEmtw2rODDkdR7x3SsmW4 > - > 54dwxIGI6os&s=3DFrXg2cbYTOa7noqANBGmUQgdAVNCP8wTOBeCtjNkUH8&e=3D > >`_. > + > +Features > +-------- > + > +Chacha20-poly1305 PMD has support for: > + > +AEAD algorithms: > + > +* RTE_CRYPTO_AEAD_CHACHA20_POLY1305 > + > + > +Installation > +------------ > + > +To build DPDK with the Chacha20-poly1305 PMD the user is required to > download > +the multi-buffer library from `here > 3A__github.com_01org_intel-2Dipsec- > 2Dmb&d=3DDwIDAg&c=3DnKjWec2b6R0mOyPaz7xtfQ&r=3DDnL7Si2wl_PRwpZ9TWe > y3eu68gBzn7DkPwuqhd6WNyo&m=3DcJBMpjPsWqfEmtw2rODDkdR7x3SsmW4 > - > 54dwxIGI6os&s=3DFrXg2cbYTOa7noqANBGmUQgdAVNCP8wTOBeCtjNkUH8&e=3D > >`_ > +and compile it on their user system before building DPDK. > +The latest version of the library supported by this PMD is v1.0, which > +can be downloaded from > ` 3A__github.com_01org_intel-2Dipsec- > 2Dmb_archive_v1.0.zip&d=3DDwIDAg&c=3DnKjWec2b6R0mOyPaz7xtfQ&r=3DDnL7Si > 2wl_PRwpZ9TWey3eu68gBzn7DkPwuqhd6WNyo&m=3DcJBMpjPsWqfEmtw2rO > DDkdR7x3SsmW4-54dwxIGI6os&s=3DEZeDlYo123VyTtXBBs_5FB5hrTLQTD5- > OfGMKFbqRXs&e=3D >`_. > + > +After downloading the library, the user needs to unpack and compile it > +on their system before building DPDK: > + > +.. code-block:: console > + > + make > + make install > + > +The library requires NASM to be built. Depending on the library version,= it > might > +require a minimum NASM version (e.g. v0.54 requires at least NASM 2.14). > + > +NASM is packaged for different OS. However, on some OS the version is to= o > old, > +so a manual installation is required. In that case, NASM can be download= ed > from > +`NASM website 3A__www.nasm.us_pub_nasm_releasebuilds_-3FC-3DM-3BO- > 3DD&d=3DDwIDAg&c=3DnKjWec2b6R0mOyPaz7xtfQ&r=3DDnL7Si2wl_PRwpZ9TWey > 3eu68gBzn7DkPwuqhd6WNyo&m=3DcJBMpjPsWqfEmtw2rODDkdR7x3SsmW4- > 54dwxIGI6os&s=3D3BB7_2sRCgmORUOvnzI3Lc9AG4lq07D6K1OndgbWQVc&e=3D > >`_. > +Once it is downloaded, extract it and follow these steps: > + > +.. code-block:: console > + > + ./configure > + make > + make install > + > +.. note:: > + > + Compilation of the Multi-Buffer library is broken when GCC < 5.0, if = library > <=3D v0.53. > + If a lower GCC version than 5.0, the workaround proposed by the > following link > + should be used: ` 3A__github.com_intel_intel-2Dipsec- > 2Dmb_issues_40&d=3DDwIDAg&c=3DnKjWec2b6R0mOyPaz7xtfQ&r=3DDnL7Si2wl_P > RwpZ9TWey3eu68gBzn7DkPwuqhd6WNyo&m=3DcJBMpjPsWqfEmtw2rODDkdR > 7x3SsmW4- > 54dwxIGI6os&s=3D3vpATFyHRB05ndE_OFBm4s0K6Z_tx8qsAiyQGSZOhOk&e=3D > >`_. > + > +As a reference, the following table shows a mapping between the past > DPDK versions > +and the external crypto libraries supported by them: > + > +.. _table_zuc_versions: ZUC ???? > + > +.. table:: DPDK and external crypto library version compatibility > + > + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + DPDK version Crypto library version > + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + 21.11+ Multi-buffer library 1.0* > + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +\* Multi-buffer library 1.0 or newer only works for Meson but not Make > build system. > + > +Initialization > +-------------- > + > +In order to enable this virtual crypto PMD, user must: > + > +* Build the multi buffer library (explained in Installation section). > + > +To use the PMD in an application, user must: > + > +* Call rte_vdev_init("crypto_chacha20_poly1305") within the application. > + > +* Use --vdev=3D"crypto_chacha20_poly1305" in the EAL options, which will > call > + rte_vdev_init() internally. > + > +The following parameters (all optional) can be provided in the previous = two > calls: > + > +* socket_id: Specify the socket where the memory for the device is going= to > be allocated > + (by default, socket_id will be the socket where the core that is creat= ing the > PMD is running on). > + > +* max_nb_queue_pairs: Specify the maximum number of queue pairs in the > device (8 by default). > + > +* max_nb_sessions: Specify the maximum number of sessions that can be > created (2048 by default). > + > +Example: > + > +.. code-block:: console > + > + --vdev=3D"crypto_chacha20_poly1305,socket_id=3D0,max_nb_sessions=3D1= 28" > diff --git a/doc/guides/cryptodevs/features/chacha20_poly1305.ini > b/doc/guides/cryptodevs/features/chacha20_poly1305.ini > new file mode 100644 > index 0000000000..3353e031c9 > --- /dev/null > +++ b/doc/guides/cryptodevs/features/chacha20_poly1305.ini > @@ -0,0 +1,35 @@ > +; > +; Supported features of the 'chacha20_poly1305' crypto driver. > +; > +; Refer to default.ini for the full list of available PMD features. > +; > +[Features] > +Symmetric crypto =3D Y > +Sym operation chaining =3D Y > +Symmetric sessionless =3D Y > +Non-Byte aligned data =3D Y > +In Place SGL =3D Y > +OOP SGL In LB Out =3D Y > +OOP LB In LB Out =3D Y > +CPU crypto =3D Y > + > +; > +; Supported crypto algorithms of the 'chacha20_poly1305' crypto driver. > +; > +[Cipher] > + > +; > +; Supported authentication algorithms of the 'chacha20_poly1305' crypto > driver. > +; > +[Auth] > + > +; > +; Supported AEAD algorithms of the 'chacha20_poly1305' crypto driver. > +; > +[AEAD] > +CHACHA20-POLY1305 =3D Y > + > +; > +; Supported Asymmetric algorithms of the 'chacha20_poly1305' crypto > driver. > +; > +[Asymmetric] > diff --git a/doc/guides/cryptodevs/index.rst > b/doc/guides/cryptodevs/index.rst > index 0f981c77b5..3dcc2ecd2e 100644 > --- a/doc/guides/cryptodevs/index.rst > +++ b/doc/guides/cryptodevs/index.rst > @@ -16,6 +16,7 @@ Crypto Device Drivers > bcmfs > caam_jr > ccp > + chacha20_poly1305 > cnxk > dpaa2_sec > dpaa_sec > diff --git a/doc/guides/rel_notes/release_21_11.rst > b/doc/guides/rel_notes/release_21_11.rst > index 696541dab7..3beecb2392 100644 > --- a/doc/guides/rel_notes/release_21_11.rst > +++ b/doc/guides/rel_notes/release_21_11.rst > @@ -76,6 +76,11 @@ New Features > * Added support for partially encrypted digest when using auth-cipher > operations. >=20 > +* **Added Chacha20-poly1305 Crypto PMD.** > + > + * Added PMD to support chacha20-poly1305 algorithms to IPSec_MB PMD > framework. A sub-bullet may be sufficient in the ipsec-mb update. > + * Test vector added for chacha20-poly1305 SGL test. > + > * **Updated Marvell cnxk crypto PMD.** >=20 > * Added AES-CBC SHA1-HMAC support in lookaside protocol (IPsec) for > CN10K. > diff --git a/drivers/crypto/ipsec_mb/meson.build > b/drivers/crypto/ipsec_mb/meson.build > index a1619c78ac..6e0a5f8004 100644 > --- a/drivers/crypto/ipsec_mb/meson.build > +++ b/drivers/crypto/ipsec_mb/meson.build > @@ -25,6 +25,7 @@ sources =3D files('rte_ipsec_mb_pmd.c', > 'rte_ipsec_mb_pmd_ops.c', > 'pmd_aesni_mb.c', > 'pmd_aesni_gcm.c', > + 'pmd_chacha_poly.c', > 'pmd_kasumi.c', > 'pmd_snow3g.c', > 'pmd_zuc.c' > diff --git a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c > b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c > new file mode 100644 > index 0000000000..814bc0761c > --- /dev/null > +++ b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c > @@ -0,0 +1,482 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2015-2021 Intel Corporation > + */ > + > +#include > + > +#if defined(RTE_LIB_SECURITY) > +#define AESNI_MB_DOCSIS_SEC_ENABLED 1 > +#include > +#include > +#include > +#endif > + > +#include "rte_ipsec_mb_pmd_private.h" > + > +#define CHACHA20_POLY1305_IV_LENGTH 12 > +#define CHACHA20_POLY1305_DIGEST_LENGTH 16 > +#define CHACHA20_POLY1305_KEY_SIZE 32 > + > +static const > +struct rte_cryptodev_capabilities chacha20_poly1305_capabilities[] =3D { > + {/* CHACHA20-POLY1305 */ > + .op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC, > + {.sym =3D { > + .xform_type =3D RTE_CRYPTO_SYM_XFORM_AEAD, > + {.aead =3D { > + .algo =3D > RTE_CRYPTO_AEAD_CHACHA20_POLY1305, > + .block_size =3D 64, > + .key_size =3D { > + .min =3D 32, > + .max =3D 32, > + .increment =3D 0}, > + .digest_size =3D { > + .min =3D 16, > + .max =3D 16, > + .increment =3D 0}, > + .aad_size =3D { > + .min =3D 0, > + .max =3D 240, > + .increment =3D 1}, > + .iv_size =3D { > + .min =3D 12, > + .max =3D 12, > + .increment =3D 0}, > + }, > + } > + },} > + }, > + RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() > +}; > + > +uint8_t pmd_driver_id_chacha20_poly1305; > + > +/** CHACHA20 POLY1305 private session structure */ > +struct chacha20_poly1305_session { > + struct { > + uint16_t length; > + uint16_t offset; > + } iv; > + /**< IV parameters */ > + uint16_t aad_length; > + /**< AAD length */ > + uint16_t req_digest_length; > + /**< Requested digest length */ > + uint16_t gen_digest_length; > + /**< Generated digest length */ > + uint8_t key[CHACHA20_POLY1305_KEY_SIZE]; > + enum ipsec_mb_operation op; > +} __rte_cache_aligned; > + > +struct chacha20_poly1305_qp_data { > + struct chacha20_poly1305_context_data > chacha20_poly1305_ctx_data; > + uint8_t temp_digest[CHACHA20_POLY1305_DIGEST_LENGTH]; > + /**< Buffer used to store the digest generated > + * by the driver when verifying a digest provided > + * by the user (using authentication verify operation) > + */ > +}; > + > +/** Parse crypto xform chain and set private session parameters. */ > +static int > +chacha20_poly1305_session_configure(IMB_MGR * mb_mgr __rte_unused, > + void *priv_sess, const struct rte_crypto_sym_xform *xform) > +{ > + struct chacha20_poly1305_session *sess =3D priv_sess; > + const struct rte_crypto_sym_xform *auth_xform; > + const struct rte_crypto_sym_xform *cipher_xform; > + const struct rte_crypto_sym_xform *aead_xform; > + > + uint8_t key_length; > + const uint8_t *key; > + enum ipsec_mb_operation mode; > + int ret =3D 0; > + > + ret =3D ipsec_mb_parse_xform(xform, &mode, &auth_xform, > + &cipher_xform, &aead_xform); > + if (ret) > + return ret; > + > + sess->op =3D mode; > + > + switch (sess->op) { > + case IPSEC_MB_OP_AEAD_AUTHENTICATED_ENCRYPT: > + case IPSEC_MB_OP_AEAD_AUTHENTICATED_DECRYPT: > + if (aead_xform->aead.algo !=3D > + RTE_CRYPTO_AEAD_CHACHA20_POLY1305) { > + IPSEC_MB_LOG(ERR, > + "The only combined operation supported is > CHACHA20 POLY1305"); > + ret =3D -ENOTSUP; > + goto error_exit; > + } > + /* Set IV parameters */ > + sess->iv.offset =3D aead_xform->aead.iv.offset; > + sess->iv.length =3D aead_xform->aead.iv.length; > + key_length =3D aead_xform->aead.key.length; > + key =3D aead_xform->aead.key.data; > + sess->aad_length =3D aead_xform->aead.aad_length; > + sess->req_digest_length =3D aead_xform->aead.digest_length; > + break; > + default: > + IPSEC_MB_LOG( > + ERR, "Wrong xform type, has to be AEAD or > authentication"); > + ret =3D -ENOTSUP; > + goto error_exit; > + } > + > + /* IV check */ > + if (sess->iv.length !=3D CHACHA20_POLY1305_IV_LENGTH && > + sess->iv.length !=3D 0) { > + IPSEC_MB_LOG(ERR, "Wrong IV length"); > + ret =3D -EINVAL; > + goto error_exit; > + } > + > + /* Check key length */ > + if (key_length !=3D CHACHA20_POLY1305_KEY_SIZE) { > + IPSEC_MB_LOG(ERR, "Invalid key length"); > + ret =3D -EINVAL; > + goto error_exit; > + } else { > + memcpy(sess->key, key, CHACHA20_POLY1305_KEY_SIZE); > + } > + > + /* Digest check */ > + if (sess->req_digest_length !=3D > CHACHA20_POLY1305_DIGEST_LENGTH) { > + IPSEC_MB_LOG(ERR, "Invalid digest length"); > + ret =3D -EINVAL; > + goto error_exit; > + } else { > + sess->gen_digest_length =3D > CHACHA20_POLY1305_DIGEST_LENGTH; > + } > + > +error_exit: > + return ret; > +} > + > +/** > + * Process a crypto operation, calling > + * the direct chacha poly API from the multi buffer library. > + * > + * @param qp queue pair > + * @param op symmetric crypto operation > + * @param session chacha poly session > + * > + * @return > + * - Return 0 if success > + */ > +static int > +chacha20_poly1305_crypto_op(struct ipsec_mb_qp *qp, struct > rte_crypto_op *op, > + struct chacha20_poly1305_session *session) > +{ > + struct chacha20_poly1305_qp_data *qp_data =3D > + ipsec_mb_get_qp_private_data(qp); > + uint8_t *src, *dst; > + uint8_t *iv_ptr; > + struct rte_crypto_sym_op *sym_op =3D op->sym; > + struct rte_mbuf *m_src =3D sym_op->m_src; > + uint32_t offset, data_offset, data_length; > + uint32_t part_len, data_len; > + int total_len; > + uint8_t *tag; > + unsigned int oop =3D 0; > + > + offset =3D sym_op->aead.data.offset; > + data_offset =3D offset; > + data_length =3D sym_op->aead.data.length; > + RTE_ASSERT(m_src !=3D NULL); > + > + while (offset >=3D m_src->data_len && data_length !=3D 0) { > + offset -=3D m_src->data_len; > + m_src =3D m_src->next; > + > + RTE_ASSERT(m_src !=3D NULL); > + } > + > + src =3D rte_pktmbuf_mtod_offset(m_src, uint8_t *, offset); > + > + data_len =3D m_src->data_len - offset; > + part_len =3D (data_len < data_length) ? data_len : > + data_length; > + > + /* In-place */ > + if (sym_op->m_dst =3D=3D NULL || (sym_op->m_dst =3D=3D sym_op->m_src)) > + dst =3D src; > + /* Out-of-place */ > + else { > + oop =3D 1; > + /* Segmented destination buffer is not supported > + * if operation is Out-of-place > + */ > + RTE_ASSERT(rte_pktmbuf_is_contiguous(sym_op->m_dst)); > + dst =3D rte_pktmbuf_mtod_offset(sym_op->m_dst, uint8_t *, > + data_offset); > + } > + > + iv_ptr =3D rte_crypto_op_ctod_offset(op, uint8_t *, > + session->iv.offset); > + > + IMB_CHACHA20_POLY1305_INIT(qp->mb_mgr, session->key, > + &qp_data->chacha20_poly1305_ctx_data, > + iv_ptr, sym_op->aead.aad.data, > + (uint64_t)session->aad_length); > + > + if (session->op =3D=3D IPSEC_MB_OP_AEAD_AUTHENTICATED_ENCRYPT) > { > + IMB_CHACHA20_POLY1305_ENC_UPDATE(qp->mb_mgr, > + session->key, > + &qp_data->chacha20_poly1305_ctx_data, > + dst, src, (uint64_t)part_len); > + total_len =3D data_length - part_len; > + > + while (total_len) { > + m_src =3D m_src->next; > + RTE_ASSERT(m_src !=3D NULL); > + > + src =3D rte_pktmbuf_mtod(m_src, uint8_t *); > + if (oop) > + dst +=3D part_len; > + else > + dst =3D src; > + part_len =3D (m_src->data_len < total_len) ? > + m_src->data_len : total_len; > + > + if (dst =3D=3D NULL || src =3D=3D NULL) { > + IPSEC_MB_LOG(ERR, "Invalid src or dst > input"); > + return -EINVAL; > + } > + IMB_CHACHA20_POLY1305_ENC_UPDATE(qp- > >mb_mgr, > + session->key, > + &qp_data- > >chacha20_poly1305_ctx_data, > + dst, src, (uint64_t)part_len); > + total_len -=3D part_len; > + if (total_len < 0) { > + IPSEC_MB_LOG(ERR, "Invalid part len"); > + return -EINVAL; > + } > + } > + > + tag =3D sym_op->aead.digest.data; > + IMB_CHACHA20_POLY1305_ENC_FINALIZE(qp->mb_mgr, > + &qp_data- > >chacha20_poly1305_ctx_data, > + tag, session->gen_digest_length); > + > + } else { > + IMB_CHACHA20_POLY1305_DEC_UPDATE(qp->mb_mgr, > + session->key, > + &qp_data- > >chacha20_poly1305_ctx_data, > + dst, src, (uint64_t)part_len); > + > + total_len =3D data_length - part_len; > + > + while (total_len) { > + m_src =3D m_src->next; > + > + RTE_ASSERT(m_src !=3D NULL); > + > + src =3D rte_pktmbuf_mtod(m_src, uint8_t *); > + if (oop) > + dst +=3D part_len; > + else > + dst =3D src; > + part_len =3D (m_src->data_len < total_len) ? > + m_src->data_len : total_len; > + > + if (dst =3D=3D NULL || src =3D=3D NULL) { > + IPSEC_MB_LOG(ERR, "Invalid src or dst > input"); > + return -EINVAL; > + } > + IMB_CHACHA20_POLY1305_DEC_UPDATE(qp- > >mb_mgr, > + session->key, > + &qp_data- > >chacha20_poly1305_ctx_data, > + dst, src, (uint64_t)part_len); > + total_len -=3D part_len; > + if (total_len < 0) { > + IPSEC_MB_LOG(ERR, "Invalid part len"); > + return -EINVAL; > + } > + } > + > + tag =3D qp_data->temp_digest; > + IMB_CHACHA20_POLY1305_DEC_FINALIZE(qp->mb_mgr, > + &qp_data- > >chacha20_poly1305_ctx_data, > + tag, session->gen_digest_length); > + } > + > + return 0; > +} > + > +/** > + * Process a completed chacha poly op > + * > + * @param qp Queue Pair to process > + * @param op Crypto operation > + * @param sess Crypto session > + * > + * @return > + * - void > + */ > +static void > +post_process_chacha20_poly1305_crypto_op(struct ipsec_mb_qp *qp, > + struct rte_crypto_op *op, > + struct chacha20_poly1305_session *session) > +{ > + struct chacha20_poly1305_qp_data *qp_data =3D > + ipsec_mb_get_qp_private_data(qp); > + > + op->status =3D RTE_CRYPTO_OP_STATUS_SUCCESS; > + /* Verify digest if required */ > + if (session->op =3D=3D IPSEC_MB_OP_AEAD_AUTHENTICATED_DECRYPT > || > + session->op =3D=3D IPSEC_MB_OP_HASH_VERIFY_ONLY) { > + uint8_t *digest =3D op->sym->aead.digest.data; > + uint8_t *tag =3D qp_data->temp_digest; > + > +#ifdef RTE_LIBRTE_PMD_CHACHA20_POLY1305_DEBUG > + rte_hexdump(stdout, "auth tag (orig):", > + digest, session->req_digest_length); > + rte_hexdump(stdout, "auth tag (calc):", > + tag, session->req_digest_length); > +#endif > + if (memcmp(tag, digest, session->req_digest_length) > !=3D 0) > + op->status =3D > RTE_CRYPTO_OP_STATUS_AUTH_FAILED; > + > + } > + > +} > + > +/** > + * Process a completed Chacha20_poly1305 request > + * > + * @param qp Queue Pair to process > + * @param op Crypto operation > + * @param sess Crypto session > + * > + * @return > + * - void > + */ > +static void > +handle_completed_chacha20_poly1305_crypto_op(struct ipsec_mb_qp > *qp, > + struct rte_crypto_op *op, > + struct chacha20_poly1305_session *sess) > +{ > + post_process_chacha20_poly1305_crypto_op(qp, op, sess); > + > + /* Free session if a session-less crypto op */ > + if (op->sess_type =3D=3D RTE_CRYPTO_OP_SESSIONLESS) { > + memset(sess, 0, sizeof(struct chacha20_poly1305_session)); > + memset(op->sym->session, 0, > + > rte_cryptodev_sym_get_existing_header_session_size( > + op->sym->session)); > + rte_mempool_put(qp->sess_mp_priv, sess); > + rte_mempool_put(qp->sess_mp, op->sym->session); > + op->sym->session =3D NULL; > + } > +} > + > +static uint16_t > +chacha20_poly1305_pmd_dequeue_burst(void *queue_pair, > + struct rte_crypto_op **ops, uint16_t nb_ops) > +{ > + struct chacha20_poly1305_session *sess; > + struct ipsec_mb_qp *qp =3D queue_pair; > + > + int retval =3D 0; > + unsigned int i =3D 0, nb_dequeued; > + > + nb_dequeued =3D rte_ring_dequeue_burst(qp->ingress_queue, > + (void **)ops, nb_ops, NULL); > + > + for (i =3D 0; i < nb_dequeued; i++) { > + > + sess =3D ipsec_mb_get_session_private(qp, ops[i]); > + if (unlikely(sess =3D=3D NULL)) { > + ops[i]->status =3D > RTE_CRYPTO_OP_STATUS_INVALID_ARGS; > + qp->stats.dequeue_err_count++; > + break; > + } > + > + retval =3D chacha20_poly1305_crypto_op(qp, ops[i], sess); > + if (retval < 0) { > + ops[i]->status =3D > RTE_CRYPTO_OP_STATUS_INVALID_ARGS; > + qp->stats.dequeue_err_count++; > + break; > + } > + > + handle_completed_chacha20_poly1305_crypto_op(qp, > ops[i], sess); > + } > + > + qp->stats.dequeued_count +=3D i; > + > + return i; > +} > + > +struct rte_cryptodev_ops chacha20_poly1305_pmd_ops =3D { > + .dev_configure =3D ipsec_mb_pmd_config, > + .dev_start =3D ipsec_mb_pmd_start, > + .dev_stop =3D ipsec_mb_pmd_stop, > + .dev_close =3D ipsec_mb_pmd_close, > + > + .stats_get =3D ipsec_mb_pmd_stats_get, > + .stats_reset =3D ipsec_mb_pmd_stats_reset, > + > + .dev_infos_get =3D ipsec_mb_pmd_info_get, > + > + .queue_pair_setup =3D ipsec_mb_pmd_qp_setup, > + .queue_pair_release =3D ipsec_mb_pmd_qp_release, > + > + .sym_session_get_size =3D ipsec_mb_pmd_sym_session_get_size, > + .sym_session_configure =3D ipsec_mb_pmd_sym_session_configure, > + .sym_session_clear =3D ipsec_mb_pmd_sym_session_clear > +}; > + > +struct rte_cryptodev_ops *rte_chacha20_poly1305_pmd_ops =3D > + > &chacha20_poly1305_pmd_ops; > + > +static int > +cryptodev_chacha20_poly1305_probe(struct rte_vdev_device *vdev) > +{ > + return cryptodev_ipsec_mb_create(vdev, > + IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305); > +} > + > +static struct rte_vdev_driver cryptodev_chacha20_poly1305_pmd_drv =3D { > + .probe =3D cryptodev_chacha20_poly1305_probe, > + .remove =3D cryptodev_ipsec_mb_remove > +}; > + > +static struct cryptodev_driver chacha20_poly1305_crypto_drv; > + > +RTE_PMD_REGISTER_VDEV(CRYPTODEV_NAME_CHACHA20_POLY1305_PM > D, > + > cryptodev_chacha20_poly1305_pmd_drv); > +RTE_PMD_REGISTER_ALIAS(CRYPTODEV_NAME_CHACHA20_POLY1305_PM > D, > + > cryptodev_chacha20_poly1305_pmd); > +RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_CHACHA20_POL > Y1305_PMD, > + "max_nb_queue_pairs=3D socket_id=3D"); > +RTE_PMD_REGISTER_CRYPTO_DRIVER(chacha20_poly1305_crypto_drv, > + > cryptodev_chacha20_poly1305_pmd_drv.driver, > + pmd_driver_id_chacha20_poly1305); > + > +/* Constructor function to register chacha20_poly1305 PMD */ > +RTE_INIT(ipsec_mb_register_chacha20_poly1305) > +{ > + struct ipsec_mb_pmd_data *chacha_poly_data > + =3D > &ipsec_mb_pmds[IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305]; > + > + chacha_poly_data->caps =3D chacha20_poly1305_capabilities; > + chacha_poly_data->dequeue_burst =3D > chacha20_poly1305_pmd_dequeue_burst; > + chacha_poly_data->feature_flags =3D > + RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | > + RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | > + RTE_CRYPTODEV_FF_IN_PLACE_SGL | > + RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT | > + RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT | > + RTE_CRYPTODEV_FF_SYM_CPU_CRYPTO | > + RTE_CRYPTODEV_FF_SYM_SESSIONLESS; > + chacha_poly_data->internals_priv_size =3D 0; > + chacha_poly_data->ops =3D &chacha20_poly1305_pmd_ops; > + chacha_poly_data->qp_priv_size =3D > + sizeof(struct chacha20_poly1305_qp_data); > + chacha_poly_data->session_configure =3D > + chacha20_poly1305_session_configure; > + chacha_poly_data->session_priv_size =3D > + sizeof(struct chacha20_poly1305_session); > +} > diff --git a/drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h > b/drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h > index b6a98a85ba..db36584f3a 100644 > --- a/drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h > +++ b/drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h > @@ -49,6 +49,9 @@ extern RTE_DEFINE_PER_LCORE(IMB_MGR *, mb_mgr); > #define CRYPTODEV_NAME_ZUC_PMD crypto_zuc > /**< IPSEC Multi buffer PMD zuc device name */ >=20 > +#define CRYPTODEV_NAME_CHACHA20_POLY1305_PMD > crypto_chacha20_poly1305 > +/**< IPSEC Multi buffer PMD chacha20_poly1305 device name */ > + > /** PMD LOGTYPE DRIVER, common to all PMDs */ > extern int ipsec_mb_logtype_driver; > #define IPSEC_MB_LOG(level, fmt, ...) = \ > @@ -62,6 +65,7 @@ enum ipsec_mb_pmd_types { > IPSEC_MB_PMD_TYPE_KASUMI, > IPSEC_MB_PMD_TYPE_SNOW3G, > IPSEC_MB_PMD_TYPE_ZUC, > + IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305, > IPSEC_MB_N_PMD_TYPES > }; >=20 > @@ -85,6 +89,7 @@ extern uint8_t pmd_driver_id_aesni_gcm; > extern uint8_t pmd_driver_id_kasumi; > extern uint8_t pmd_driver_id_snow3g; > extern uint8_t pmd_driver_id_zuc; > +extern uint8_t pmd_driver_id_chacha20_poly1305; >=20 > /** Helper function. Gets driver ID based on PMD type */ > static __rte_always_inline uint8_t > @@ -101,6 +106,8 @@ ipsec_mb_get_driver_id(enum ipsec_mb_pmd_types > pmd_type) > return pmd_driver_id_snow3g; > case IPSEC_MB_PMD_TYPE_ZUC: > return pmd_driver_id_zuc; > + case IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305: > + return pmd_driver_id_chacha20_poly1305; > default: > break; > } > -- > 2.25.1