[dpdk-dev] [PATCH v3 5/6] crypto/openssl: add asym crypto support

De Lara Guarch, Pablo pablo.de.lara.guarch at intel.com
Sun Jun 17 15:25:10 CEST 2018



> -----Original Message-----
> From: Shally Verma [mailto:shally.verma at caviumnetworks.com]
> Sent: Wednesday, May 16, 2018 7:05 AM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch at intel.com>
> Cc: Trahe, Fiona <fiona.trahe at intel.com>; akhil.goyal at nxp.com;
> dev at dpdk.org; pathreya at caviumnetworks.com; Sunila Sahu
> <sunila.sahu at caviumnetworks.com>; Ashish Gupta
> <ashish.gupta at caviumnetworks.com>
> Subject: [PATCH v3 5/6] crypto/openssl: add asym crypto support
> 
> Add asymmetric crypto operation support in openssl PMD.
> Current list of supported asym xforms:
> * RSA
> * DSA
> * Deffie-hellman
> * Modular Operations
> 
> changes from v2:
> - Update the pmd capability as per new capability structure
> 
> changes from v1:
> - resolve new line error in dod/guides/cryptodevs/openssl.rst
> 
> Signed-off-by: Shally Verma <shally.verma at caviumnetworks.com>
> Signed-off-by: Sunila Sahu <sunila.sahu at caviumnetworks.com>
> Signed-off-by: Ashish Gupta <ashish.gupta at caviumnetworks.com>
> ---
>  doc/guides/cryptodevs/features/openssl.ini       |  11 +
>  doc/guides/cryptodevs/openssl.rst                |   1 +
>  drivers/crypto/openssl/rte_openssl_pmd.c         | 377 ++++++++++++++++++++-
>  drivers/crypto/openssl/rte_openssl_pmd_ops.c     | 395
> ++++++++++++++++++++++-
>  drivers/crypto/openssl/rte_openssl_pmd_private.h |  29 ++
>  5 files changed, 801 insertions(+), 12 deletions(-)
> 
> diff --git a/doc/guides/cryptodevs/features/openssl.ini
> b/doc/guides/cryptodevs/features/openssl.ini
> index 691565865..bef5c7f79 100644
> --- a/doc/guides/cryptodevs/features/openssl.ini
> +++ b/doc/guides/cryptodevs/features/openssl.ini
> @@ -7,6 +7,7 @@
>  Symmetric crypto       = Y
>  Sym operation chaining = Y
>  Mbuf scatter gather    = Y
> +Asymmetric crypto	   = Y
> 
>  ;
>  ; Supported crypto algorithms of the 'openssl' crypto driver.
> @@ -49,3 +50,13 @@ AES GCM (256) = Y
>  AES CCM (128) = Y
>  AES CCM (192) = Y
>  AES CCM (256) = Y
> +
> +;
> +; Supported Asymmetric algorithms of the 'openssl' crypto driver.
> +;
> +[Asymmetric]
> +RSA = Y
> +DSA = Y
> +Modular Exponentiation = Y
> +Modular Inversion = Y
> +Deffie-hellman = Y

You need to add these parameters in default.ini file,
otherwise they are not shown when building the documentation.

> diff --git a/doc/guides/cryptodevs/openssl.rst
> b/doc/guides/cryptodevs/openssl.rst
> index 427fc807c..4f90be888 100644
> --- a/doc/guides/cryptodevs/openssl.rst
> +++ b/doc/guides/cryptodevs/openssl.rst
> @@ -80,6 +80,7 @@ crypto processing.
> 
>  Test name is cryptodev_openssl_autotest.
>  For performance test cryptodev_openssl_perftest can be used.
> +For asymmetric crypto operations testing, run
> +cryptodev_openssl_asym_autotest
> 
>  To verify real traffic l2fwd-crypto example can be used with this command:
> 
> diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c
> b/drivers/crypto/openssl/rte_openssl_pmd.c
> index f584d0d6f..527e42773 100644
> --- a/drivers/crypto/openssl/rte_openssl_pmd.c
> +++ b/drivers/crypto/openssl/rte_openssl_pmd.c

...

> +		}
> +		dh_key->priv_key = BN_bin2bn(op->priv_key.data,
> +					     op->priv_key.length,
> +					     dh_key->priv_key);

As on the previous patch, I am getting a compilation issue:

drivers/crypto/openssl/rte_openssl_pmd.c:1711:9: error:
dereferencing pointer to incomplete type 'DH {aka struct dh_st}'
   dh_key->priv_key = BN_bin2bn(op->priv_key.data,

...

> diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
> b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
> index 1cb87d59a..76f7410cb 100644
> --- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
> +++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c

...

>  struct rte_cryptodev_ops openssl_pmd_ops = {
>  		.dev_configure		= openssl_pmd_config,
>  		.dev_start		= openssl_pmd_start,
> @@ -750,8 +1138,11 @@ struct rte_cryptodev_ops openssl_pmd_ops = {
>  		.queue_pair_count	= openssl_pmd_qp_count,
> 
>  		.session_get_size	= openssl_pmd_session_get_size,
> +		.asym_session_get_size	=
> openssl_pmd_asym_session_get_size,
>  		.session_configure	= openssl_pmd_session_configure,
> -		.session_clear		= openssl_pmd_session_clear
> +		.asym_session_configure	=
> openssl_pmd_asym_session_configure,
> +		.session_clear		= openssl_pmd_session_clear,
> +		.asym_session_clear	= openssl_pmd_asym_session_clear
>  };

I think session_get_size, session_configure and session_clear should be renamed
to sym_session_*, to avoid confusion. Could you add another patch renaming these?

Thanks,
Pablo




More information about the dev mailing list