From 0b311eb1da975a3f846577cc9bd7150a7af54d29 Mon Sep 17 00:00:00 2001 From: Janne Peltonen Date: Tue, 4 Jul 2023 16:47:51 +0300 Subject: validation: crypto: allow OOP failure with non-zero null alg ranges MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jere Leppänen Reviewed-by: Anoob Joseph --- test/validation/api/crypto/crypto_op_test.c | 15 +++++++++++++-- 1 file 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 { -- cgit v1.2.3