X-Git-Url: https://gerrit.fd.io/r/gitweb?p=deb_dpdk.git;a=blobdiff_plain;f=examples%2Fl2fwd-crypto%2Fmain.c;h=77af7e6a0397f0d91fd354298b1815b9f8ebe75f;hp=ff5752224b7abdd8bf2769cc2ac554b24737501c;hb=6e7cbd63706f3435b9d9a2057a37db1da01db9a7;hpb=e4df4d55df003957fc5afd7440e3d3192d7ce218 diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index ff575222..77af7e6a 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -439,7 +439,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, /* Zero pad data to be crypto'd so it is block aligned */ data_len = rte_pktmbuf_data_len(m) - ipdata_offset; - if (cparams->do_hash && cparams->hash_verify) + if ((cparams->do_hash || cparams->do_aead) && cparams->hash_verify) data_len -= cparams->digest_length; if (cparams->do_cipher) { @@ -2081,10 +2081,11 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, options->block_size = cap->sym.aead.block_size; - check_iv_param(&cap->sym.aead.iv_size, + if (check_iv_param(&cap->sym.aead.iv_size, options->aead_iv_param, options->aead_iv_random_size, - &options->aead_iv.length); + &options->aead_iv.length) < 0) + continue; /* * Check if length of provided AEAD key is supported @@ -2098,7 +2099,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, cap->sym.aead.key_size.increment) != 0) { printf("Unsupported aead key length\n"); - return -1; + continue; } /* * Check if length of the aead key to be randomly generated @@ -2111,7 +2112,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, cap->sym.aead.key_size.increment) != 0) { printf("Unsupported aead key length\n"); - return -1; + continue; } options->aead_xform.aead.key.length = options->aead_key_random_size; @@ -2136,7 +2137,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, cap->sym.aead.aad_size.increment) != 0) { printf("Unsupported AAD length\n"); - return -1; + continue; } /* * Check if length of AAD to be randomly generated @@ -2149,7 +2150,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, cap->sym.aead.aad_size.increment) != 0) { printf("Unsupported AAD length\n"); - return -1; + continue; } options->aad.length = options->aad_random_size; /* No size provided, use minimum size. */ @@ -2167,7 +2168,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, cap->sym.aead.digest_size.increment) != 0) { printf("Unsupported digest length\n"); - return -1; + continue; } options->aead_xform.aead.digest_length = options->digest_size; @@ -2189,10 +2190,11 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, options->block_size = cap->sym.cipher.block_size; - check_iv_param(&cap->sym.cipher.iv_size, + if (check_iv_param(&cap->sym.cipher.iv_size, options->cipher_iv_param, options->cipher_iv_random_size, - &options->cipher_iv.length); + &options->cipher_iv.length) < 0) + continue; /* * Check if length of provided cipher key is supported @@ -2206,7 +2208,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, cap->sym.cipher.key_size.increment) != 0) { printf("Unsupported cipher key length\n"); - return -1; + continue; } /* * Check if length of the cipher key to be randomly generated @@ -2219,7 +2221,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, cap->sym.cipher.key_size.increment) != 0) { printf("Unsupported cipher key length\n"); - return -1; + continue; } options->cipher_xform.cipher.key.length = options->ckey_random_size; @@ -2245,10 +2247,11 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, if (cap == NULL) continue; - check_iv_param(&cap->sym.auth.iv_size, + if (check_iv_param(&cap->sym.auth.iv_size, options->auth_iv_param, options->auth_iv_random_size, - &options->auth_iv.length); + &options->auth_iv.length) < 0) + continue; /* * Check if length of provided auth key is supported * by the algorithm chosen. @@ -2261,7 +2264,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, cap->sym.auth.key_size.increment) != 0) { printf("Unsupported auth key length\n"); - return -1; + continue; } /* * Check if length of the auth key to be randomly generated @@ -2274,7 +2277,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, cap->sym.auth.key_size.increment) != 0) { printf("Unsupported auth key length\n"); - return -1; + continue; } options->auth_xform.auth.key.length = options->akey_random_size; @@ -2296,7 +2299,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, cap->sym.auth.digest_size.increment) != 0) { printf("Unsupported digest length\n"); - return -1; + continue; } options->auth_xform.auth.digest_length = options->digest_size;