* [dpdk-dev] [PATCH] app/crypto-perf: fix for segfault when bad optype is used with gcm alghorithms
@ 2017-02-16 10:48 Daniel Mrzyglod
2017-02-16 10:55 ` De Lara Guarch, Pablo
2017-02-16 11:27 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
0 siblings, 2 replies; 7+ messages in thread
From: Daniel Mrzyglod @ 2017-02-16 10:48 UTC (permalink / raw)
To: slawomirx.mrozowicz, declan.doherty, pablo.de.lara.guarch
Cc: dev, Daniel Mrzyglod
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@intel.com>
---
How to reproduce:
AESNI_GCM:
./build/app/dpdk-test-crypto-perf -c 0xc0 --vdev crypto_aesni_gcm_pmd
-w 0000:5e:00.0 -w 0000:3d:01.0 -- --ptest throughput
--devtype crypto_aesni_gcm --optype cipher-then-auth --cipher-algo aes-gcm
--cipher-op encrypt --cipher-key-sz 16 --cipher-iv-sz 12 --auth-algo aes-gcm
--auth-op generate --auth-key-sz 16 --auth-aad-sz 4 --auth-digest-sz 8
--total-ops 10000000 --burst-sz 32 --buffer-sz 1024
---
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 ) {
+ if (options->op_type != CPERF_AEAD) {
+ RTE_LOG(ERR, USER1, "Use --optype aead\n");
+ return -EINVAL;
+ }
+ }
+
return 0;
}
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index c1eaaff..fb3f72e 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -118,7 +118,8 @@ cperf_verify_devices_capabilities(struct cperf_options *opts,
if (opts->op_type == CPERF_AUTH_ONLY ||
opts->op_type == CPERF_CIPHER_THEN_AUTH ||
- opts->op_type == CPERF_AUTH_THEN_CIPHER) {
+ opts->op_type == CPERF_AUTH_THEN_CIPHER ||
+ opts->op_type == CPERF_AEAD) {
cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
cap_idx.algo.auth = opts->auth_algo;
@@ -139,7 +140,8 @@ cperf_verify_devices_capabilities(struct cperf_options *opts,
if (opts->op_type == CPERF_CIPHER_ONLY ||
opts->op_type == CPERF_CIPHER_THEN_AUTH ||
- opts->op_type == CPERF_AUTH_THEN_CIPHER) {
+ opts->op_type == CPERF_AUTH_THEN_CIPHER ||
+ opts->op_type == CPERF_AEAD) {
cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
cap_idx.algo.cipher = opts->cipher_algo;
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 alghorithms you should use aead flag.
+
* ``--sessionless``
Enable session-less crypto operations mode.
--
2.7.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] app/crypto-perf: fix for segfault when bad optype is used with gcm alghorithms
2017-02-16 10:48 [dpdk-dev] [PATCH] app/crypto-perf: fix for segfault when bad optype is used with gcm alghorithms Daniel Mrzyglod
@ 2017-02-16 10:55 ` De Lara Guarch, Pablo
2017-02-16 11:27 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
1 sibling, 0 replies; 7+ messages in thread
From: De Lara Guarch, Pablo @ 2017-02-16 10:55 UTC (permalink / raw)
To: Mrzyglod, DanielX T, Mrozowicz, SlawomirX, Doherty, Declan; +Cc: dev
Hi Daniel,
> -----Original Message-----
> From: Mrzyglod, DanielX T
> Sent: Thursday, February 16, 2017 10:49 AM
> To: Mrozowicz, SlawomirX; Doherty, Declan; De Lara Guarch, Pablo
> Cc: dev@dpdk.org; Mrzyglod, DanielX T
> Subject: [PATCH] app/crypto-perf: fix for segfault when bad optype is used
> with gcm alghorithms
>
> 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@intel.com>
There is a checkpatch error:
ERROR:SPACING: space prohibited before that close parenthesis ')'
#75: FILE: app/test-crypto-perf/cperf_options_parsing.c:834:
+ options->auth_algo == RTE_CRYPTO_AUTH_AES_GMAC ) {
Thanks,
Pablo
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v2] app/crypto-perf: fix for segfault when bad optype is used with gcm alghorithms
2017-02-16 10:48 [dpdk-dev] [PATCH] app/crypto-perf: fix for segfault when bad optype is used with gcm alghorithms Daniel Mrzyglod
2017-02-16 10:55 ` De Lara Guarch, Pablo
@ 2017-02-16 11:27 ` Daniel Mrzyglod
2017-03-06 13:26 ` De Lara Guarch, Pablo
2017-03-08 17:03 ` [dpdk-dev] [PATCH v3] app/crypto-perf: fix avoid wrong optype for AEAD algorithms Daniel Mrzyglod
1 sibling, 2 replies; 7+ messages in thread
From: Daniel Mrzyglod @ 2017-02-16 11:27 UTC (permalink / raw)
To: slawomirx.mrozowicz, declan.doherty, pablo.de.lara.guarch
Cc: dev, Daniel Mrzyglod
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@intel.com>
---
Changes for v2:
- fix checkpatch error related with whitespace
- fix spelling error
How to reproduce:
AESNI_GCM:
./build/app/dpdk-test-crypto-perf -c 0xc0 --vdev crypto_aesni_gcm_pmd
-w 0000:5e:00.0 -w 0000:3d:01.0 -- --ptest throughput
--devtype crypto_aesni_gcm --optype cipher-then-auth --cipher-algo aes-gcm
--cipher-op encrypt --cipher-key-sz 16 --cipher-iv-sz 12 --auth-algo aes-gcm
--auth-op generate --auth-key-sz 16 --auth-aad-sz 4 --auth-digest-sz 8
--total-ops 10000000 --burst-sz 32 --buffer-sz 1024
---
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) {
+ if (options->op_type != CPERF_AEAD) {
+ RTE_LOG(ERR, USER1, "Use --optype aead\n");
+ return -EINVAL;
+ }
+ }
+
return 0;
}
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index c1eaaff..fb3f72e 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -118,7 +118,8 @@ cperf_verify_devices_capabilities(struct cperf_options *opts,
if (opts->op_type == CPERF_AUTH_ONLY ||
opts->op_type == CPERF_CIPHER_THEN_AUTH ||
- opts->op_type == CPERF_AUTH_THEN_CIPHER) {
+ opts->op_type == CPERF_AUTH_THEN_CIPHER ||
+ opts->op_type == CPERF_AEAD) {
cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
cap_idx.algo.auth = opts->auth_algo;
@@ -139,7 +140,8 @@ cperf_verify_devices_capabilities(struct cperf_options *opts,
if (opts->op_type == CPERF_CIPHER_ONLY ||
opts->op_type == CPERF_CIPHER_THEN_AUTH ||
- opts->op_type == CPERF_AUTH_THEN_CIPHER) {
+ opts->op_type == CPERF_AUTH_THEN_CIPHER ||
+ opts->op_type == CPERF_AEAD) {
cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
cap_idx.algo.cipher = opts->cipher_algo;
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.
+
* ``--sessionless``
Enable session-less crypto operations mode.
--
2.7.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2] app/crypto-perf: fix for segfault when bad optype is used with gcm alghorithms
2017-02-16 11:27 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
@ 2017-03-06 13:26 ` De Lara Guarch, Pablo
2017-03-08 17:03 ` [dpdk-dev] [PATCH v3] app/crypto-perf: fix avoid wrong optype for AEAD algorithms Daniel Mrzyglod
1 sibling, 0 replies; 7+ messages in thread
From: De Lara Guarch, Pablo @ 2017-03-06 13:26 UTC (permalink / raw)
To: Mrzyglod, DanielX T, Mrozowicz, SlawomirX, Doherty, Declan; +Cc: dev
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@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@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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v3] app/crypto-perf: fix avoid wrong optype for AEAD algorithms
2017-02-16 11:27 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
2017-03-06 13:26 ` De Lara Guarch, Pablo
@ 2017-03-08 17:03 ` Daniel Mrzyglod
2017-03-09 21:34 ` De Lara Guarch, Pablo
1 sibling, 1 reply; 7+ messages in thread
From: Daniel Mrzyglod @ 2017-03-08 17:03 UTC (permalink / raw)
To: slawomirx.mrozowicz, declan.doherty, pablo.de.lara.guarch
Cc: dev, Daniel Mrzyglod
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@intel.com>
---
Changes for v3:
- fix headline of this patch
- add ccm alghorithm
Changes for v2:
- fix checkpatch error related with whitespace
- fix spelling error
How to reproduce:
AESNI_GCM:
./build/app/dpdk-test-crypto-perf -c 0xc0 --vdev crypto_aesni_gcm_pmd
-w 0000:5e:00.0 -w 0000:3d:01.0 -- --ptest throughput
--devtype crypto_aesni_gcm --optype cipher-then-auth --cipher-algo aes-gcm
--cipher-op encrypt --cipher-key-sz 16 --cipher-iv-sz 12 --auth-algo aes-gcm
--auth-op generate --auth-key-sz 16 --auth-aad-sz 4 --auth-digest-sz 8
--total-ops 10000000 --burst-sz 32 --buffer-sz 1024
---
app/test-crypto-perf/cperf_options_parsing.c | 11 +++++++++++
app/test-crypto-perf/main.c | 6 ++++--
doc/guides/tools/cryptoperf.rst | 2 ++
3 files changed, 17 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..c87ba67 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -829,6 +829,17 @@ cperf_options_check(struct cperf_options *options)
}
}
+ if (options->cipher_algo == RTE_CRYPTO_CIPHER_AES_GCM ||
+ options->cipher_algo == RTE_CRYPTO_CIPHER_AES_CCM ||
+ options->auth_algo == RTE_CRYPTO_AUTH_AES_GCM ||
+ options->auth_algo == RTE_CRYPTO_AUTH_AES_CCM ||
+ options->auth_algo == RTE_CRYPTO_AUTH_AES_GMAC) {
+ if (options->op_type != CPERF_AEAD) {
+ RTE_LOG(ERR, USER1, "Use --optype aead\n");
+ return -EINVAL;
+ }
+ }
+
return 0;
}
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index c1eaaff..fb3f72e 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -118,7 +118,8 @@ cperf_verify_devices_capabilities(struct cperf_options *opts,
if (opts->op_type == CPERF_AUTH_ONLY ||
opts->op_type == CPERF_CIPHER_THEN_AUTH ||
- opts->op_type == CPERF_AUTH_THEN_CIPHER) {
+ opts->op_type == CPERF_AUTH_THEN_CIPHER ||
+ opts->op_type == CPERF_AEAD) {
cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
cap_idx.algo.auth = opts->auth_algo;
@@ -139,7 +140,8 @@ cperf_verify_devices_capabilities(struct cperf_options *opts,
if (opts->op_type == CPERF_CIPHER_ONLY ||
opts->op_type == CPERF_CIPHER_THEN_AUTH ||
- opts->op_type == CPERF_AUTH_THEN_CIPHER) {
+ opts->op_type == CPERF_AUTH_THEN_CIPHER ||
+ opts->op_type == CPERF_AEAD) {
cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
cap_idx.algo.cipher = opts->cipher_algo;
diff --git a/doc/guides/tools/cryptoperf.rst b/doc/guides/tools/cryptoperf.rst
index 1117ebf..478d256 100644
--- a/doc/guides/tools/cryptoperf.rst
+++ b/doc/guides/tools/cryptoperf.rst
@@ -181,6 +181,8 @@ The following are the appication command-line options:
auth-then-cipher
aead
+ For GCM/CCM algorithms you should use aead flag.
+
* ``--sessionless``
Enable session-less crypto operations mode.
--
2.7.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v3] app/crypto-perf: fix avoid wrong optype for AEAD algorithms
2017-03-08 17:03 ` [dpdk-dev] [PATCH v3] app/crypto-perf: fix avoid wrong optype for AEAD algorithms Daniel Mrzyglod
@ 2017-03-09 21:34 ` De Lara Guarch, Pablo
2017-03-09 21:46 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 7+ messages in thread
From: De Lara Guarch, Pablo @ 2017-03-09 21:34 UTC (permalink / raw)
To: Mrzyglod, DanielX T, Mrozowicz, SlawomirX, Doherty, Declan
Cc: dev, Mrzyglod, DanielX T
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Daniel Mrzyglod
> Sent: Wednesday, March 08, 2017 5:03 PM
> To: Mrozowicz, SlawomirX; Doherty, Declan; De Lara Guarch, Pablo
> Cc: dev@dpdk.org; Mrzyglod, DanielX T
> Subject: [dpdk-dev] [PATCH v3] app/crypto-perf: fix avoid wrong optype for
> AEAD algorithms
>
> 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@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v3] app/crypto-perf: fix avoid wrong optype for AEAD algorithms
2017-03-09 21:34 ` De Lara Guarch, Pablo
@ 2017-03-09 21:46 ` De Lara Guarch, Pablo
0 siblings, 0 replies; 7+ messages in thread
From: De Lara Guarch, Pablo @ 2017-03-09 21:46 UTC (permalink / raw)
To: De Lara Guarch, Pablo, Mrzyglod, DanielX T, Mrozowicz, SlawomirX,
Doherty, Declan
Cc: dev, Mrzyglod, DanielX T, stable
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of De Lara Guarch,
> Pablo
> Sent: Thursday, March 09, 2017 9:35 PM
> To: Mrzyglod, DanielX T; Mrozowicz, SlawomirX; Doherty, Declan
> Cc: dev@dpdk.org; Mrzyglod, DanielX T
> Subject: Re: [dpdk-dev] [PATCH v3] app/crypto-perf: fix avoid wrong optype
> for AEAD algorithms
>
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Daniel Mrzyglod
> > Sent: Wednesday, March 08, 2017 5:03 PM
> > To: Mrozowicz, SlawomirX; Doherty, Declan; De Lara Guarch, Pablo
> > Cc: dev@dpdk.org; Mrzyglod, DanielX T
> > Subject: [dpdk-dev] [PATCH v3] app/crypto-perf: fix avoid wrong optype
> for
> > AEAD algorithms
> >
> > 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@intel.com>
>
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
CC'ing stable list.
Applied to dpdk-next-crypto.
Thanks,
Pablo
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-03-09 21:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-16 10:48 [dpdk-dev] [PATCH] app/crypto-perf: fix for segfault when bad optype is used with gcm alghorithms Daniel Mrzyglod
2017-02-16 10:55 ` De Lara Guarch, Pablo
2017-02-16 11:27 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
2017-03-06 13:26 ` De Lara Guarch, Pablo
2017-03-08 17:03 ` [dpdk-dev] [PATCH v3] app/crypto-perf: fix avoid wrong optype for AEAD algorithms Daniel Mrzyglod
2017-03-09 21:34 ` De Lara Guarch, Pablo
2017-03-09 21:46 ` De Lara Guarch, Pablo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).