[EXT] [PATCH 20/40] cryptodev: add elliptic curve diffie hellman

Akhil Goyal gakhil at marvell.com
Tue May 24 14:08:27 CEST 2022


> - added elliptic curve Diffie-Hellman parameters.
> Point multiplication allows the user to process every phase of
> ECDH, but for phase 1, user should not really care about the generator.
> The user does not even need to know what the generator looks like,
> therefore setting ec xform would make this work.
> 
> Signed-off-by: Arek Kusztal <arkadiuszx.kusztal at intel.com>
> ---
>  lib/cryptodev/rte_crypto_asym.h | 34 +++++++++++++++++++++-------------
>  1 file changed, 21 insertions(+), 13 deletions(-)
> 
> diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h
> index 52cb1c5c80..09edf2ac3d 100644
> --- a/lib/cryptodev/rte_crypto_asym.h
> +++ b/lib/cryptodev/rte_crypto_asym.h
> @@ -82,8 +82,10 @@ enum rte_crypto_asym_xform_type {
>  	/**< Modular Exponentiation */
>  	RTE_CRYPTO_ASYM_XFORM_ECDSA,
>  	/**< Elliptic Curve Digital Signature Algorithm */
> -	RTE_CRYPTO_ASYM_XFORM_ECPM
> +	RTE_CRYPTO_ASYM_XFORM_ECPM,
>  	/**< Elliptic Curve Point Multiplication */
> +	RTE_CRYPTO_ASYM_XFORM_ECDH
> +	/**< Elliptic Curve Diffie Hellman */
>  };
Please add relevant information in "doc/guides/prog_guide/cryptodev_lib.rst"

> 
>  /**
> @@ -383,22 +385,28 @@ struct rte_crypto_dh_op_param {
>  	/**<
>  	 * Output generated private key when op_type is
>  	 * DH PRIVATE_KEY_GENERATION

Update with actual enum name for this as well

> -	 * Input when op_type is DH SHARED_SECRET_COMPUTATION.
> -	 *
> +	 * Input for RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE
>  	 */
> -	rte_crypto_uint pub_key;
> +	union {
> +		rte_crypto_uint pub_key;
> +		struct rte_crypto_ec_point pub_point;
> +	};
>  	/**<
> -	 * Output generated public key when op_type is
> -	 * DH PUB_KEY_GENERATION.
> -	 * Input peer public key when op_type is DH
> -	 * SHARED_SECRET_COMPUTATION
> -	 *
> +	 * Diffie-Hellman public part
> +	 * For DH it is big-endian unsigned integer.
> +	 * For ECDH it is a point on the curve.
> +	 * Output for RTE_CRYPTO_ASYM_KE_PUBLIC_KEY_GENERATE
> +	 * Input for RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE
>  	 */
> -	rte_crypto_uint shared_secret;
> +	union {
> +		rte_crypto_uint shared_secret;
> +		struct rte_crypto_ec_point shared_point;
> +	};
>  	/**<
> -	 * Output with calculated shared secret
> -	 * when op type is SHARED_SECRET_COMPUTATION.
> -	 *
> +	 * Diffie-Hellman shared secret
> +	 * For DH it is big-endian unsigned integer.
> +	 * For ECDH it is a point on the curve.
> +	 * Output for RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE
>  	 */

Is it output for others as well?
Please be consistent in the comments for all params.


>  };
> 
> --
> 2.13.6



More information about the dev mailing list