When initializing crypto devices within the app,
the provided key sizes are checked against the supported
sizes from the crypto device capabilities.
When the supported sizes are not a range, but a single value,
the check may become an infinite loop (when size is not supported).
Fixes:
a061e50a0d97 ("examples/l2fwd-crypto: fix ambiguous input key size")
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Tested-by: Min Cao <min.cao@intel.com>
{
uint16_t supp_size;
+ /* Single value */
+ if (increment == 0) {
+ if (length == min)
+ return 0;
+ else
+ return -1;
+ }
+
+ /* Range of values */
for (supp_size = min; supp_size <= max; supp_size += increment) {
if (length == supp_size)
return 0;