From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 7C95E1D5B1 for ; Fri, 15 Jun 2018 10:40:32 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jun 2018 01:40:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,226,1526367600"; d="scan'208";a="237672772" Received: from irsmsx105.ger.corp.intel.com ([163.33.3.28]) by fmsmga006.fm.intel.com with ESMTP; 15 Jun 2018 01:40:30 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.139]) by irsmsx105.ger.corp.intel.com ([169.254.7.126]) with mapi id 14.03.0319.002; Fri, 15 Jun 2018 09:40:29 +0100 From: "De Lara Guarch, Pablo" To: Shally Verma CC: "Trahe, Fiona" , "akhil.goyal@nxp.com" , "dev@dpdk.org" , "pathreya@caviumnetworks.com" , Sunila Sahu , Ashish Gupta Thread-Topic: [PATCH v3 1/6] lib/cryptodev: add asymmetric algos in cryptodev Thread-Index: AQHT7NwNhuZPQD0ndUiCQwXA0CbzaaRf+QvA Date: Fri, 15 Jun 2018 08:40:28 +0000 Message-ID: References: <1526450713-17299-1-git-send-email-shally.verma@caviumnetworks.com> <1526450713-17299-2-git-send-email-shally.verma@caviumnetworks.com> In-Reply-To: <1526450713-17299-2-git-send-email-shally.verma@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjgyZGJhOWQtMWUwMC00MjVmLWE2ZWQtZDdiOWE0YTUzMjdkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiMWN5YTJEajFMNDExXC9wVFNacmhMMFRtUUZFVzEyVWFTc0NpZU54Q0pzQVp1dTVjWGNibWlVRm93UjVBVURkTXUifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 1/6] lib/cryptodev: add asymmetric algos in cryptodev X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2018 08:40:33 -0000 Hi Shally, > -----Original Message----- > From: Shally Verma [mailto:shally.verma@caviumnetworks.com] > Sent: Wednesday, May 16, 2018 7:05 AM > To: De Lara Guarch, Pablo > Cc: Trahe, Fiona ; akhil.goyal@nxp.com; > dev@dpdk.org; pathreya@caviumnetworks.com; Sunila Sahu > ; Ashish Gupta > > Subject: [PATCH v3 1/6] lib/cryptodev: add asymmetric algos in cryptodev >=20 > Add rte_crypto_asym.h with supported xfrms and associated op structures a= nd > APIs >=20 > API currently supports: > - RSA Encrypt, Decrypt, Sign and Verify > - Modular Exponentiation and Inversion > - DSA Sign and Verify > - Deffie-hellman private key exchange > - Deffie-hellman public key exchange > - Deffie-hellman shared secret compute > - Deffie-hellman public/private key pair generation using xform chain >=20 > Signed-off-by: Shally Verma > Signed-off-by: Sunila Sahu > Signed-off-by: Ashish Gupta I have some comments below, but apart from those, could you send a rebased = version of this API? Thanks, Pablo > --- > lib/librte_cryptodev/Makefile | 2 +- > lib/librte_cryptodev/meson.build | 3 +- > lib/librte_cryptodev/rte_crypto_asym.h | 519 > +++++++++++++++++++++++++++++++++ > 3 files changed, 522 insertions(+), 2 deletions(-) >=20 > diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefil= e index > bba8dee9f..138e627dc 100644 > --- a/lib/librte_cryptodev/Makefile > +++ b/lib/librte_cryptodev/Makefile > @@ -23,7 +23,7 @@ SYMLINK-y-include +=3D rte_crypto.h SYMLINK-y-include = +=3D > rte_crypto_sym.h SYMLINK-y-include +=3D rte_cryptodev.h SYMLINK-y-inclu= de +=3D > rte_cryptodev_pmd.h > - > +SYMLINK-y-include +=3D rte_crypto_asym.h Leave the blank space that was present before. > # versioning export map > EXPORT_MAP :=3D rte_cryptodev_version.map >=20 ... > --- /dev/null > +++ b/lib/librte_cryptodev/rte_crypto_asym.h ... > + > +#include > +#include Leave a blank space between non-DPDK and DPDK libraries. > +#include > +#include > +#include > + ... > +struct rte_crypto_rsa_xform { > + rte_crypto_param n; > + /**< n - Prime modulus > + * Prime modulus data of RSA operation in Octet-string network > + * byte order format. > + */ > + > + rte_crypto_param e; > + /**< e - Public key exponent > + * Public key exponent used for RSA public key operations in Octet- > + * string network byte order format. > + */ > + > + enum rte_crypto_rsa_priv_key_type key_type; > + Needs RTE_STD_C11/extension, before the union. > + union { > + rte_crypto_param d; > + /**< d - Private key exponent > + * Private key exponent used for RSA > + * private key operations in > + * Octet-string network byte order format. > + */ > + > + struct rte_crypto_rsa_priv_key_qt qt; > + /**< qt - Private key in quintuple format */ > + }; > +}; ... > +/** > + * Asymmetric Cryptographic Operation. > + * > + * Structure describing asymmetric crypto operation params. > + * > + */ > +struct rte_crypto_asym_op { > + struct rte_cryptodev_asym_session *session; > + /**< Handle for the initialised session context */ > + Looking at the xform structure, it looks like a chain of xforms is possible= . Looking at this union, this case wouldn't be possible, as only one item fro= m the union can be set. > + __extension__ > + union { > + struct rte_crypto_rsa_op_param rsa; > + struct rte_crypto_mod_op_param modex; > + struct rte_crypto_mod_op_param modinv; > + struct rte_crypto_dh_op_param dh; > + struct rte_crypto_dsa_op_param dsa; > + }; > +} __rte_cache_aligned; > + > +/** > + * Reset the fields of an asymmetric operation to their default values. > + * > + * @param op The crypto operation to be reset. > + */ > +static inline void > +__rte_crypto_asym_op_reset(struct rte_crypto_asym_op *op) { > + memset(op, 0, sizeof(*op)); > +} > + > +/** > + * Attach a session to an asymmetric crypto operation > + * > + * @param asym_op crypto operation > + * @param sess cryptodev session > + */ > +static inline int > +__rte_crypto_op_attach_asym_session(struct rte_crypto_asym_op *asym_op, > + struct rte_cryptodev_asym_session *sess) { > + asym_op->session =3D sess; > + return 0; > +} I think we should get rid of these two functions, as they are just one line= , used just once in the code. I know it is also done in symmetric, I think it can be removed from there t= oo. > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _RTE_CRYPTO_ASYM_H_ */ > -- > 2.14.3