From: Shiri Kuzin Date: Tue, 13 Apr 2021 16:24:52 +0000 (+0300) Subject: examples/l2fwd-crypto: remove key size validation X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3ea6ee38ec7a7e88499d30ad86d7821b72ce3abc;p=dpdk.git examples/l2fwd-crypto: remove key size validation 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. A new feature flag is added in crypto PMDs to allow wrapped keys, hence, to allow 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 user and the RTE_CRYPTODEV_FF_CIPHER_WRAPPED_KEY feature flag is set, and kept in case the key should be generated by the application or RTE_CRYPTODEV_FF_CIPHER_WRAPPED_KEY is not set. Signed-off-by: Shiri Kuzin Acked-by: Matan Azrad Acked-by: Akhil Goyal --- diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 23a398043e..a957df05db 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -2126,12 +2126,21 @@ check_capabilities(struct l2fwd_crypto_options *options, uint8_t cdev_id) cap->sym.cipher.key_size.max, cap->sym.cipher.key_size.increment) != 0) { - RTE_LOG(DEBUG, USER1, - "Device %u does not support cipher " - "key length\n", + if (dev_info.feature_flags & + RTE_CRYPTODEV_FF_CIPHER_WRAPPED_KEY) { + RTE_LOG(DEBUG, USER1, + "Key length does not match the device " + "%u capability. Key may be wrapped\n", cdev_id); - return -1; + } else { + RTE_LOG(DEBUG, USER1, + "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.