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 E013EA04FF; Tue, 24 May 2022 14:52:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8CE7A40140; Tue, 24 May 2022 14:52:57 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id DDB87400D6 for ; Tue, 24 May 2022 14:52:55 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24O99pjO005704; Tue, 24 May 2022 05:52:55 -0700 Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam07lp2049.outbound.protection.outlook.com [104.47.56.49]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3g8vg48qm2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 May 2022 05:52:54 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HHd7oiXbySHbCIbSiQXGcEkZPz01F9zE8844m+goJ327gLJYcIwAJl8GocZTDqHhk4j27XBd2DeU+yG6zGWdCBmJNmdvIkikx3pIgUAWYDZ5uwY2sG2OoXswxAMBtXJyRMN8Ezzo+VVxSO8BEjP5hsUxYybVyhazCwCN2X5P6D67lF98B25QmWpkoZliIyFiESdabJxqhocuAA6mpaIRNqQeks04LCNCtgNMH3sYCLA/njvCzbCNEInZbXQC+WPem4pnE2ovxVBBiqtX54d9P0akCTA+t4jQz1kqLrvGExrqav+y2ruvw6EUC6zvukXvv1/Yym8cpYv09cxTPWvOOg== 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=t3/uKs9Mg9gt9WFGLTTcXJsIBNdoKlohyO+Nlp6z+gk=; b=kt+fJrcnlT8vQ2ROiUfj/PqFFPkPdv2n1ZCr3Dtb5fjZazxebAmBtktH34F+8q+XJZ/VkvmhyZ+Pe03xvvMHrkGwtJO22rEvi5f8Q/31wmlyLKi0CLdBokdfrX11hO+APY9CwkNP0W0L+Sj+KiWtAw8nbYHjTHF9uhPaTzZnipp0bPH3z+jWWKJ3SM7Q3Dbx9xVoASxrFawQzb6o8g/7QUd4Bey9o+HqwgP4KaVR62cECXAy4CmOQogq0E6fd9xKe+EJliALMmt+O8FhIWBd1Kje7o0q5yc17aN0OARfte0zDoa0DqOwvFQTqIuUGyDK+eT0Bcw7QQ9hkxYL9ppUZQ== 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=t3/uKs9Mg9gt9WFGLTTcXJsIBNdoKlohyO+Nlp6z+gk=; b=us1cVdJCXjqiEqHhwL1qEkdp718Wh7YtRZW9LQ+Gd4mfQ1YKV7jh9o0So7xf3RAY+c0UTnYoBv0OLniUZIartEKprl2WvkTobTjapFhE3hdFWSX1feBQhY1tc6Y5GjvdgsLblVCk8Z7p0RI4NMWeQ1J9nhNKGqueW6bkWJ0aGPU= Received: from CO6PR18MB4484.namprd18.prod.outlook.com (2603:10b6:5:359::9) by MN2PR18MB2750.namprd18.prod.outlook.com (2603:10b6:208:a2::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.23; Tue, 24 May 2022 12:52:52 +0000 Received: from CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::f154:453d:893:f6ce]) by CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::f154:453d:893:f6ce%7]) with mapi id 15.20.5293.013; Tue, 24 May 2022 12:52:51 +0000 From: Akhil Goyal To: Arek Kusztal , "dev@dpdk.org" CC: Anoob Joseph , "roy.fan.zhang@intel.com" Subject: RE: [EXT] [PATCH 30/40] cryptodev: reduce rsa struct to only necessary fields Thread-Topic: [EXT] [PATCH 30/40] cryptodev: reduce rsa struct to only necessary fields Thread-Index: AQHYbBfDvc1Ls6foMEuU3nvjaXahD60t/RGQ Date: Tue, 24 May 2022 12:52:51 +0000 Message-ID: References: <20220520055445.40063-1-arkadiuszx.kusztal@intel.com> <20220520055445.40063-31-arkadiuszx.kusztal@intel.com> In-Reply-To: <20220520055445.40063-31-arkadiuszx.kusztal@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: df61dabc-4a1b-4905-6544-08da3d84500f x-ms-traffictypediagnostic: MN2PR18MB2750:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ++WcpLyExujGpQkrKlxc6aUS6tSzpeOchNwUdrjXwUr1d1I3S7hrCGu1q3cB8gilsXQAnnAaotVhDzs2FMzB89AiZZmgR+O884p15CKL6GLCNuJEGSEHA2bXr+sWGdVZc0WwZuqkcE1UeHQ6ypFkXlxCjgDeLC+6m2DaPmx+/2e30Xa3EMY0tXtrHw8x0OO0WULWP7q9A95YsD7G+IZB1Mk1qDIMPiZcouraiSfX0WmcaNMzV1Ekl7E1T1GtT5KLRU2djlIy9fRHr7qvxb7RXMKjsjq5SaCKt/OXkD6UPKudRstL5znvU0LJ0fiuFq6Co9tDREniLvmT6HrAZ55oKmq7lW0Fr/kaK95Ebf+j/j2HBstRgEBq8LF6sLspBy6AQDwqfN8APy1f4xUUjA2qp70kMnhsCj7o5Jw3SRiBeMAdDIF6XJzC2QLLQeKkMHUnpflAHtUa/9Bj14F8gaEfOHHA0FQQgyZRHYdV9jicieVpbw6pMO/MoGlpZCgcp40Q6mCW/GAmhLJkh59X79w+iaKMPIrswdMfDNHVRtRHZwevr9LysQagtFclQIv156MEwfcUJmZmbvbvVV0GXTS/V7ncQDgWB4jlCbydDuYeXF4oOPV4VFoITfJmo79OpKWY8RJm+v9bG97NJi7cVzGf/YHM3CN2TfKlSpW7xpnBjmjVtS2Om8mjPGdlDp1+Byh2PXIObxQQe/hA9KC2w+G1+A== 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:(13230001)(4636009)(366004)(66446008)(66476007)(86362001)(76116006)(64756008)(186003)(122000001)(71200400001)(55016003)(8676002)(83380400001)(8936002)(110136005)(5660300002)(54906003)(9686003)(6506007)(26005)(7696005)(316002)(38070700005)(66556008)(38100700002)(2906002)(33656002)(66946007)(4326008)(508600001)(52536014); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?OapemND5uqLQ6fOpoGiE7i7Koy7cn+dw1Rts/VsOydJKhwUle7KxqLKIYlV6?= =?us-ascii?Q?V3w5lyR96W7oXWyRMvHZtDW3goVVJZqR12FPoW6AM7VsNBB++0YwDyJmLp3L?= =?us-ascii?Q?NWFKPssbY6jlJSkbiy1Q8nuFMUDFwPfl3HSfPK0gn6DBxRZz6+HRP3IIi/Xk?= =?us-ascii?Q?ArYb7Z4X0yNLPwATTeMgSg4+1nCOsKT6hDFzYC37wI32q0HjvenL/PpY8YvK?= =?us-ascii?Q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qf+5kOwB/5a67?= =?us-ascii?Q?m2+jZ2HKcVhs+er7NYi+YC/idc5AAV1inN9YxGGtaKPHgVf4nJqX0WjVym4C?= =?us-ascii?Q?SxtutnMlXWMIiAFtDH11AMJjEfRC8TftxwR/WodyCYFOf2rili9Mo5jsUxw1?= =?us-ascii?Q?3xHECTcfQd4PfELKvb9LG1IDon5m0G0Pw5rqovwxWBlX850aM1vDmWOwEv6o?= =?us-ascii?Q?88N1Tlh9ytihtF1NRCyg6QzMqrP4pgoL2II2DrvwSutDfBCNMgwBAQ5phVQg?= =?us-ascii?Q?579mp2mQ0TACwHcANBGtAr8DspOEJOoE1jvigFEI5gbAQJ/9NxtDuP9JoDJ/?= =?us-ascii?Q?FiLVaJJtNpflcrB8uRW4X0LjdrbMCsnDx5w1EW/IWGq0C8GAneBbZ6E57njT?= =?us-ascii?Q?rrgMEUTs1qZFUxTDyj9MqucMs4RDEFHOy1M5cBRabfjGPWYnb7+Ub6LAEABo?= =?us-ascii?Q?M36FL8IwUkzyQVqYEIyRzXtu5H5ClF3JFwOPsJ18WDk0ikHsPkKTf6f+rYlM?= =?us-ascii?Q?QYgq+2aUTo3aogd/P5kcxmrLL1Pv1dIL5ozaU71lS5Ci62+zktBIxizv76jF?= =?us-ascii?Q?RyXzlV3Bmh4uTOmJZYFPMJJ2pA5PABhtbaX9MYRmhfAOUqP0lARYrwEaz4yg?= =?us-ascii?Q?tfHSDyUs2w=3D=3D?= 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: df61dabc-4a1b-4905-6544-08da3d84500f X-MS-Exchange-CrossTenant-originalarrivaltime: 24 May 2022 12:52:51.4353 (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: Qh0TO90qFoKDpfvUZe6k3jU+gGn01jZxVIveqpAN64iW7OufE6fCkzPU/gRtnHMXr77r9BZehGy1dWGr0MRBbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2750 X-Proofpoint-ORIG-GUID: eZbq5kPBI5e2AR9iOSOvY4ZNuDVK5bRX X-Proofpoint-GUID: eZbq5kPBI5e2AR9iOSOvY4ZNuDVK5bRX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-24_07,2022-05-23_01,2022-02-23_01 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 > - reduced rsa struct to only necessary fields. > RSA operation is generally used with one input and one output. > One exception for this is signature verification, when RSA verify > called, both message and signature are inputs, but there is no rsa > output except for op status. I am not sure if this is the correct renaming of fields. You are changing the name of message -> input and=20 Cipher and sign -> output/message union. Right? I believe this would impact the existing applications and=20 Would create confusion as the message was used for input and now it is=20 In union with output. The logic listed here is looking very complex. Please simplify it. Can you try adding comments in the description of struc= t Instead of individual fields. >=20 > Signed-off-by: Arek Kusztal > --- > lib/cryptodev/rte_crypto_asym.h | 87 +++++++++++++++++++++++------------= ---- > -- > 1 file changed, 50 insertions(+), 37 deletions(-) >=20 > diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_a= sym.h > index c864b8a115..37dd3b9d86 100644 > --- a/lib/cryptodev/rte_crypto_asym.h > +++ b/lib/cryptodev/rte_crypto_asym.h > @@ -362,53 +362,66 @@ struct rte_crypto_rsa_op_param { > enum rte_crypto_asym_op_type op_type; > /**< Type of RSA operation for transform */ >=20 > - rte_crypto_param message; > + rte_crypto_param input; > /**< > - * Pointer to input data > - * - to be encrypted for RSA public encrypt. > - * - to be signed for RSA sign generation. > - * - to be authenticated for RSA sign verification. > + * When op_type =3D=3D RTE_CRYPTO_ASYM_OP_ENCRYPT: > + * If padding.type =3D RTE_CRYPTO_RSA_PADDING_NONE > + * input should only be used along with cryptographically > + * secure padding scheme. > + * If padding.type =3D RTE_CRYPTO_RSA_PADDING_PKCS1_5 > + * input shall be no longer than public modulus minus 11. > + * If padding.type =3D RTE_CRYPTO_RSA_PADDING_OAEP > + * input shall be no longer than public modulus - > + * 2 * len(hash) - 2. > + * When op_type =3D=3D RTE_CRYPTO_ASYM_OP_SIGN: > * > - * Pointer to output data > - * - for RSA private decrypt. > - * In this case the underlying array should have been > - * allocated with enough memory to hold plaintext output > - * (i.e. must be at least RSA key size). The message.length > - * field should be 0 and will be overwritten by the PMD > - * with the decrypted length. > + * If padding.type =3D RTE_CRYPTO_RSA_PADDING_NONE > + * input should only be used along with cryptographically > + * secure padding scheme. * > + * If padding.type =3D RTE_CRYPTO_RSA_PADDING_PKCS1_5 or > + * RTE_CRYPTO_RSA_PADDING_PSS > + * if the RTE_CRYPTO_RSA_FLAG_PT flag is set, input shall contain > + * the message to be signed, if this flag is not set, > + * input shall contain the digest of the message to be signed. Does it mean if padding.type =3D RTE_CRYPTO_RSA_PADDING_PKCS1_5 or RTE_CRYP= TO_RSA_PADDING_PSS and if RTE_CRYPTO_RSA_FLAG_PT flag is set > * > - * All data is in Octet-string network byte order format. > - */ > - > - rte_crypto_param cipher; > - /**< > - * Pointer to input data > - * - to be decrypted for RSA private decrypt. > + * When op_type =3D=3D RTE_CRYPTO_ASYM_OP_DECRYPT: > * > - * Pointer to output data > - * - for RSA public encrypt. > - * In this case the underlying array should have been allocated > - * with enough memory to hold ciphertext output (i.e. must be > - * at least RSA key size). The cipher.length field should > - * be 0 and will be overwritten by the PMD with the encrypted length. > + * Input shall contain previously encrypted RSA message. > * > - * All data is in Octet-string network byte order format. > + * When op_type =3D=3D RTE_CRYPTO_ASYM_OP_VERIFY: > + * > + * Input shall contain signature to be verified > */ > - > - rte_crypto_param sign; > + union { > + rte_crypto_param output; > + rte_crypto_param message; > + }; > /**< > - * Pointer to input data > - * - to be verified for RSA public decrypt. > + * When op_type =3D=3D RTE_CRYPTO_ASYM_OP_ENCRYPT: > + * > + * Output shall contain encrypted data, output.length shall > + * be set to the length of encrypted data. > + * > + * When op_type =3D=3D > RTE_CRYPTO_ASYM_OP_DECRYPT/RTE_CRYPTO_ASYM_OP_SIGN: > * > - * Pointer to output data > - * - for RSA private encrypt. > - * In this case the underlying array should have been allocated > - * with enough memory to hold signature output (i.e. must be > - * at least RSA key size). The sign.length field should > - * be 0 and will be overwritten by the PMD with the signature length. > + * If padding.type =3D RTE_CRYPTO_RSA_PADDING_NONE > + * output shall contain decrypted/signed data, but all leading zeros > + * shall be preserved. Therefore output.length should be > + * equal to the length of the modulus.. > + * For other types of padding, output should contain > + * decrypted data, and output.length shall be set to the length > + * of decrypted data. > * > - * All data is in Octet-string network byte order format. > + * When op_type =3D=3D RTE_CRYPTO_ASYM_OP_VERIFY: > + * > + * If padding.type =3D RTE_CRYPTO_RSA_PADDING_NONE > + * output shall contain the public key decrypted signature. > + * All leading zeroes shall be preserved. > + * > + * For other padding types, the message should be set with data for the > + * signature to be compared with. > */ > + > struct rte_crypto_rsa_padding padding; > /**< RSA padding information */ >=20 > -- > 2.13.6