examples/l2fwd-crypto: remove key size validation

Message ID 20210408084958.4443-1-shirik@nvidia.com (mailing list archive)
State Changes Requested, archived
Delegated to: akhil goyal
Headers
Series examples/l2fwd-crypto: remove key size validation |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Shiri Kuzin April 8, 2021, 8:49 a.m. UTC
  In the example application the key can be provided by the user or
generated randomly by the example application.

Then a validation is done in order to check if the key size is
supported in the algorithm capabilities.

As a result of patch [1] application should support the case where a
user supplies a wrapped key.

In order to align with this patch and be able to use the app with
wrapped keys, app should remove the validation of key size in the
application and rely on a PMD key size validation.

The validation is removed in case the key is provided by by user, and
kept in case the key should be generated by the application.

[1] https://www.mail-archive.com/dev@dpdk.org/msg201281.html

Signed-off-by: Shiri Kuzin <shirik@nvidia.com>
---
 examples/l2fwd-crypto/main.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
  

Comments

Matan Azrad April 8, 2021, 9:25 a.m. UTC | #1
From: Shiri Kuzin
> In the example application the key can be provided by the user or generated
> randomly by the example application.
> 
> Then a validation is done in order to check if the key size is supported in the
> algorithm capabilities.
> 
> As a result of patch [1] application should support the case where a user
> supplies a wrapped key.
> 
> In order to align with this patch and be able to use the app with wrapped keys,
> app should remove the validation of key size in the application and rely on a
> PMD key size validation.
> 
> The validation is removed in case the key is provided by by user, and kept in
> case the key should be generated by the application.
> 
> [1] https://www.mail-archive.com/dev@dpdk.org/msg201281.html
> 
> Signed-off-by: Shiri Kuzin <shirik@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
> ---
>  examples/l2fwd-crypto/main.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
> index a96cb94cc4..5ae2569065 100644
> --- a/examples/l2fwd-crypto/main.c
> +++ b/examples/l2fwd-crypto/main.c
> @@ -2111,13 +2111,11 @@ check_capabilities(struct l2fwd_crypto_options
> *options, uint8_t cdev_id)
>  					cap->sym.cipher.key_size.min,
>  					cap->sym.cipher.key_size.max,
>  					cap->sym.cipher.key_size.increment)
> -						!= 0) {
> +						!= 0)
>  				RTE_LOG(DEBUG, USER1,
> -					"Device %u does not support cipher "
> -					"key length\n",
> +					"Key length does not match the device
> "
> +					"%u capability\n",
>  					cdev_id);
> -				return -1;
> -			}
>  		/*
>  		 * Check if length of the cipher key to be randomly generated
>  		 * is supported by the algorithm chosen.
> --
> 2.21.0
  
Akhil Goyal April 13, 2021, 9:52 a.m. UTC | #2
> In the example application the key can be provided by the user or
> generated randomly by the example application.
> 
> Then a validation is done in order to check if the key size is
> supported in the algorithm capabilities.
> 
> As a result of patch [1] application should support the case where a
> user supplies a wrapped key.
> 
> In order to align with this patch and be able to use the app with
> wrapped keys, app should remove the validation of key size in the
> application and rely on a PMD key size validation.
> 
> The validation is removed in case the key is provided by by user, and
> kept in case the key should be generated by the application.
> 
> [1] https://www.mail-archive.com/dev@dpdk.org/msg201281.html 
> 
> Signed-off-by: Shiri Kuzin <shirik@nvidia.com>
> ---
This patch should be aligned as per the latest version of the patch.
http://patches.dpdk.org/project/dpdk/patch/20210413063718.3123698-1-matan@nvidia.com/


>  examples/l2fwd-crypto/main.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
> index a96cb94cc4..5ae2569065 100644
> --- a/examples/l2fwd-crypto/main.c
> +++ b/examples/l2fwd-crypto/main.c
> @@ -2111,13 +2111,11 @@ check_capabilities(struct l2fwd_crypto_options
> *options, uint8_t cdev_id)
>  					cap->sym.cipher.key_size.min,
>  					cap->sym.cipher.key_size.max,
>  					cap->sym.cipher.key_size.increment)
> -						!= 0) {
> +						!= 0)
>  				RTE_LOG(DEBUG, USER1,
> -					"Device %u does not support cipher "
> -					"key length\n",
> +					"Key length does not match the
> device "
> +					"%u capability\n",
>  					cdev_id);
> -				return -1;
> -			}
>  		/*
>  		 * Check if length of the cipher key to be randomly generated
>  		 * is supported by the algorithm chosen.
> --
> 2.21.0
  

Patch

diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index a96cb94cc4..5ae2569065 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -2111,13 +2111,11 @@  check_capabilities(struct l2fwd_crypto_options *options, uint8_t cdev_id)
 					cap->sym.cipher.key_size.min,
 					cap->sym.cipher.key_size.max,
 					cap->sym.cipher.key_size.increment)
-						!= 0) {
+						!= 0)
 				RTE_LOG(DEBUG, USER1,
-					"Device %u does not support cipher "
-					"key length\n",
+					"Key length does not match the device "
+					"%u capability\n",
 					cdev_id);
-				return -1;
-			}
 		/*
 		 * Check if length of the cipher key to be randomly generated
 		 * is supported by the algorithm chosen.