> -----Original Message----- > From: lng-odp [mailto:[email protected]] On Behalf Of > Balakrishna Garapati > Sent: Friday, May 19, 2017 5:24 PM > To: [email protected] > Subject: [lng-odp] [API-NEXT PATCHv4] api: crypto: change iv_len field to > feature min-max len > > dpdk pmd's require to minatain min, max, inc fields for all > crypto capabilitites. By making iv_len to feature like dpdk pmd's > it is easier to create cipher entires in odp based on key_len. > > Signed-off-by: Balakrishna Garapati <[email protected]> > --- > since v1: fixed comments from v1, > - updated the description about the patch > - Fixed the bug in crypto validation > since v2: if statement correction in validation "check_cipher_options" > since v3: updated doing key_len check prior to iv_len and corrected > iv_len > data type in validation "check_cipher_options" > > include/odp/api/spec/crypto.h | 12 +++- > platform/linux-generic/odp_crypto.c | 8 +-- > .../validation/api/crypto/odp_crypto_test_inp.c | 81 ++++++----------- > ----- > 3 files changed, 37 insertions(+), 64 deletions(-) > > diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h > index c47d314..a1b540a 100644 > --- a/include/odp/api/spec/crypto.h > +++ b/include/odp/api/spec/crypto.h > @@ -497,7 +497,17 @@ typedef struct odp_crypto_cipher_capability_t { > uint32_t key_len; > > /** IV length in bytes */ > - uint32_t iv_len; > + struct { > + /** Minimum iv length in bytes */ > + uint32_t min; > + > + /** Maximum iv length in bytes */ > + uint32_t max; > + > + /** Increment of supported lengths between min and > max > + * (in bytes) */ > + uint32_t inc; > + } iv_len;
I choose to not use this mechanism since: * number of key_len / iv_len combination should not be too large * this is inflexible if there are holes in the range: e.g. iv_len == 4, 8, 16 could not be expressed with min/max/inc * application should have an easy job to scroll through a sorted list of key/iv lengths * implementation can have predefined arrays sorted already at build time -Petri
