aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Peltonen <janne.peltonen@nokia.com>2023-07-04 16:47:51 +0300
committerPetri Savolainen <petri.savolainen@nokia.com>2023-07-10 13:08:12 +0300
commit0b311eb1da975a3f846577cc9bd7150a7af54d29 (patch)
tree3b9eaba5ef2c207a31b0b72d776aaf660fa3d552
parent95e4221faad20a71c4a1a93f626322cc747ec5ed (diff)
validation: crypto: allow OOP failure with non-zero null alg ranges
Allow out-of-place crypto operations to fail if the null cipher or auth algorithm has non-zero-length range. Allow failure indication only via odp_crypto_op_result(). Allowing odp_crypto_op()/odp_crypto_op_enq() returning a failure can be done later if actually needed by some implementation. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Anoob Joseph <anoobj@marvell.com>
-rw-r--r--test/validation/api/crypto/crypto_op_test.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/validation/api/crypto/crypto_op_test.c b/test/validation/api/crypto/crypto_op_test.c
index b54300c84..1d883f6b8 100644
--- a/test/validation/api/crypto/crypto_op_test.c
+++ b/test/validation/api/crypto/crypto_op_test.c
@@ -498,6 +498,7 @@ void test_crypto_op(const crypto_op_test_param_t *param)
.aad_ptr = param->ref->aad,
.dst_offset_shift = param->oop_shift,
};
+ odp_bool_t failure_allowed = false;
/*
* Test detection of wrong digest value in input packet
@@ -518,6 +519,14 @@ void test_crypto_op(const crypto_op_test_param_t *param)
pkt_copy = odp_packet_copy(pkt, suite_context.pool);
CU_ASSERT_FATAL(pkt_copy != ODP_PACKET_INVALID);
test_packet_get_md(pkt_out, &md_out_orig);
+
+ /* Non-zero-length ranges do not have to be supported. */
+ if ((param->ref->cipher == ODP_CIPHER_ALG_NULL &&
+ op_params.cipher_range.length != 0))
+ failure_allowed = true;
+ if ((param->ref->auth == ODP_AUTH_ALG_NULL &&
+ op_params.auth_range.length != 0))
+ failure_allowed = true;
}
prepare_expected_data(param, &op_params.cipher_range, &op_params.auth_range,
@@ -564,10 +573,12 @@ void test_crypto_op(const crypto_op_test_param_t *param)
* range, so allow crypto op failure without further checks
* in this case.
*/
- if (!ok)
- goto out;
+ failure_allowed = true;
}
+ if (!ok && failure_allowed)
+ goto out;
+
if (param->wrong_digest) {
CU_ASSERT(!ok);
} else {