diff options
author | Janne Peltonen <janne.peltonen@nokia.com> | 2023-02-01 19:54:39 +0200 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2023-02-13 15:45:20 +0200 |
commit | 32a684b42a99d55c9b2840ac12911e1bd71dded6 (patch) | |
tree | 88cfab5d3beee3dbd142c1c28a8d035afd6718d6 /test | |
parent | a9823897f0d5dfdbebc42ce5cffca9b450928031 (diff) |
validation: crypto: check output packet better after failed auth
Always check the parts of packets that are not supposed to be affected
by crypto operations. Do the checking now also after failed authentication.
Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Anoob Joseph <anoobj@marvell.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/validation/api/crypto/odp_crypto_test_inp.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index 7a27092c4..7d5e50c71 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -641,6 +641,15 @@ static void prepare_ignore_info(const alg_test_param_t *param, param->ref->digest_length); } } + + /* Decrypted bytes are undefined if authentication fails. */ + if (param->op == ODP_CRYPTO_OP_DECODE && + param->wrong_digest) { + add_ignored_range(ignore, cipher_offset + shift, cipher_len); + /* In OOP case, auth range may not get copied */ + if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP) + add_ignored_range(ignore, auth_offset + shift, auth_len); + } } /* Add room for bytes that are not included in ref->length */ @@ -848,11 +857,10 @@ static void alg_test_execute(const alg_test_param_t *param) if (param->wrong_digest) { CU_ASSERT(!ok); - /* output packet data is undefined, skip check */ } else { CU_ASSERT(ok); - check_output_packet_data(pkt_out, &expected); } + check_output_packet_data(pkt_out, &expected); odp_packet_free(pkt_out); } |