From: Anoob Joseph Date: Wed, 10 Nov 2021 13:04:08 +0000 (+0530) Subject: test/crypto: skip plain text compare for null cipher X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9fc69835feb33d0e155076163ecc2f5479cf1bc2;p=dpdk.git test/crypto: skip plain text compare for null cipher NULL cipher is used for validating auth only cases. With NULL cipher, validating plain text should not be done as the PMD is only expected to update auth data. Fixes: e847fc512817 ("test/crypto: add encrypted digest case for AES-CTR-CMAC") Cc: stable@dpdk.org Signed-off-by: Anoob Joseph Acked-by: Ciara Power Acked-by: Pablo de Lara --- diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 52457596e2..1b68d7c43b 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -7484,27 +7484,30 @@ test_mixed_auth_cipher(const struct mixed_cipher_auth_test_data *tdata, tdata->digest_enc.len); } - /* Validate obuf */ - if (verify) { - TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( - plaintext, - tdata->plaintext.data, - tdata->plaintext.len_bits >> 3, - "Plaintext data not as expected"); - } else { - TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( - ciphertext, - tdata->ciphertext.data, - tdata->validDataLen.len_bits, - "Ciphertext data not as expected"); - + if (!verify) { TEST_ASSERT_BUFFERS_ARE_EQUAL( ut_params->digest, tdata->digest_enc.data, - DIGEST_BYTE_LENGTH_SNOW3G_UIA2, + tdata->digest_enc.len, "Generated auth tag not as expected"); } + if (tdata->cipher_algo != RTE_CRYPTO_CIPHER_NULL) { + if (verify) { + TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( + plaintext, + tdata->plaintext.data, + tdata->plaintext.len_bits >> 3, + "Plaintext data not as expected"); + } else { + TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( + ciphertext, + tdata->ciphertext.data, + tdata->validDataLen.len_bits, + "Ciphertext data not as expected"); + } + } + TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, "crypto op processing failed"); @@ -7701,19 +7704,7 @@ test_mixed_auth_cipher_sgl(const struct mixed_cipher_auth_test_data *tdata, tdata->digest_enc.data, tdata->digest_enc.len); } - /* Validate obuf */ - if (verify) { - TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( - plaintext, - tdata->plaintext.data, - tdata->plaintext.len_bits >> 3, - "Plaintext data not as expected"); - } else { - TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( - ciphertext, - tdata->ciphertext.data, - tdata->validDataLen.len_bits, - "Ciphertext data not as expected"); + if (!verify) { TEST_ASSERT_BUFFERS_ARE_EQUAL( digest, tdata->digest_enc.data, @@ -7721,6 +7712,22 @@ test_mixed_auth_cipher_sgl(const struct mixed_cipher_auth_test_data *tdata, "Generated auth tag not as expected"); } + if (tdata->cipher_algo != RTE_CRYPTO_CIPHER_NULL) { + if (verify) { + TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( + plaintext, + tdata->plaintext.data, + tdata->plaintext.len_bits >> 3, + "Plaintext data not as expected"); + } else { + TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( + ciphertext, + tdata->ciphertext.data, + tdata->validDataLen.len_bits, + "Ciphertext data not as expected"); + } + } + TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, "crypto op processing failed");