[dpdk-dev] [PATCH v2] app/crypto-perf: fix for segfault when bad optype is used with gcm alghorithms

De Lara Guarch, Pablo pablo.de.lara.guarch at intel.com
Mon Mar 6 14:26:23 CET 2017


Hi Daniel,

> -----Original Message-----
> From: Mrzyglod, DanielX T
> Sent: Thursday, February 16, 2017 11:27 AM
> To: Mrozowicz, SlawomirX; Doherty, Declan; De Lara Guarch, Pablo
> Cc: dev at dpdk.org; Mrzyglod, DanielX T
> Subject: [PATCH v2] app/crypto-perf: fix for segfault when bad optype is
> used with gcm alghorithms

Typo in the title. Also, title is too long. Maybe something like "avoid wrong optype for AEAD algorithms" is better.

> 
> When somebody use bad --optype with aead alghorithms
> segmentation fault could happen.
> 
> Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test
> application")
> 
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod at intel.com>

...

> ---
>  app/test-crypto-perf/cperf_options_parsing.c | 9 +++++++++
>  app/test-crypto-perf/main.c                  | 6 ++++--
>  doc/guides/tools/cryptoperf.rst              | 2 ++
>  3 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-
> perf/cperf_options_parsing.c
> index c1d5ffc..215a07b 100644
> --- a/app/test-crypto-perf/cperf_options_parsing.c
> +++ b/app/test-crypto-perf/cperf_options_parsing.c
> @@ -829,6 +829,15 @@ cperf_options_check(struct cperf_options
> *options)
>  		}
>  	}
> 
> +	if (options->cipher_algo == RTE_CRYPTO_CIPHER_AES_GCM ||
> +			options->auth_algo ==
> RTE_CRYPTO_AUTH_AES_GCM ||
> +			options->auth_algo ==
> RTE_CRYPTO_AUTH_AES_GMAC) {

I would expend this to AES_CCM as well, as it is another AEAD algorithm.

> +		if (options->op_type != CPERF_AEAD) {
> +			RTE_LOG(ERR, USER1, "Use --optype aead\n");
> +			return -EINVAL;
> +		}
> +	}
> +
>  	return 0;
>  }
> 

...

> diff --git a/doc/guides/tools/cryptoperf.rst
> b/doc/guides/tools/cryptoperf.rst
> index 1fc40c4..9cb3338 100644
> --- a/doc/guides/tools/cryptoperf.rst
> +++ b/doc/guides/tools/cryptoperf.rst
> @@ -180,6 +180,8 @@ The following are the appication command-line
> options:
>             auth-then-cipher
>             aead
> 
> +        For GCM algorithms you should use aead flag.

Include CCM here too.

> +
>  * ``--sessionless``
> 
>          Enable session-less crypto operations mode.
> --
> 2.7.4



More information about the dev mailing list