Code Review
/
deb_dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
New upstream version 17.11.4
[deb_dpdk.git]
/
examples
/
l2fwd-crypto
/
main.c
diff --git
a/examples/l2fwd-crypto/main.c
b/examples/l2fwd-crypto/main.c
index
ff57522
..
77af7e6
100644
(file)
--- 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;
/* 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) {
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;
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_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
/*
* 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");
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
}
/*
* 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");
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;
}
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");
cap->sym.aead.aad_size.increment)
!= 0) {
printf("Unsupported AAD length\n");
-
return -1
;
+
continue
;
}
/*
* Check if length of AAD to be randomly generated
}
/*
* 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");
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. */
}
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");
cap->sym.aead.digest_size.increment)
!= 0) {
printf("Unsupported digest length\n");
-
return -1
;
+
continue
;
}
options->aead_xform.aead.digest_length =
options->digest_size;
}
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;
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_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
/*
* 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");
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
}
/*
* 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");
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;
}
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;
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_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.
/*
* 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");
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
}
/*
* 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");
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;
}
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");
cap->sym.auth.digest_size.increment)
!= 0) {
printf("Unsupported digest length\n");
-
return -1
;
+
continue
;
}
options->auth_xform.auth.digest_length =
options->digest_size;
}
options->auth_xform.auth.digest_length =
options->digest_size;