[dpdk-dev] [PATCH] lib/cryptodev: fix API digest length comments

Declan Doherty declan.doherty at intel.com
Fri Apr 28 11:21:50 CEST 2017


On 25/04/2017 5:56 PM, Trahe, Fiona wrote:
> Fix misleading comments clarifying setting of digest length.
>
> Fixes: d11b0f30df88 ("cryptodev: introduce API and framework for crypto devices")
>
> Cc: stable at dpdk.org
> Signed-off-by: Fiona Trahe <fiona.trahe at intel.com>
> ---
>  lib/librte_cryptodev/rte_crypto_sym.h | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/lib/librte_cryptodev/rte_crypto_sym.h b/lib/librte_cryptodev/rte_crypto_sym.h
> index eb7b530..12f1583 100644
> --- a/lib/librte_cryptodev/rte_crypto_sym.h
> +++ b/lib/librte_cryptodev/rte_crypto_sym.h
> @@ -310,11 +310,10 @@ struct rte_crypto_auth_xform {
>  	 * this specifies the length of the digest to be compared for the
>  	 * session.
>  	 *
> +	 * It is the caller's responsibility to ensure that the
> +	 * digest length is compliant with the hash algorithm being used.
>  	 * If the value is less than the maximum length allowed by the hash,
> -	 * the result shall be truncated.  If the value is greater than the
> -	 * maximum length allowed by the hash then an error will be generated
> -	 * by *rte_cryptodev_sym_session_create* or by the
> -	 * *rte_cryptodev_sym_enqueue_burst* if using session-less APIs.
> +	 * the result shall be truncated.
>  	 */

I don't think this comment change is valid, we already validate many of 
the parameters which are passed into session creation, such as key 
lengths etc, if we are not validating digest length now I think we 
should be, maybe this is a gap in our unit tests.

>
>  	uint32_t add_auth_data_length;
> @@ -597,7 +596,9 @@ struct rte_crypto_sym_op {
>  			phys_addr_t phys_addr;
>  			/**< Physical address of digest */
>  			uint16_t length;
> -			/**< Length of digest */
> +			/**< Length of digest. This must be the same value as
> +			 * @ref rte_crypto_auth_xform.digest_length.
> +			 */
>  		} digest; /**< Digest parameters */
>
>  		struct {
>



More information about the dev mailing list