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: [email protected]
Signed-off-by: Anoob Joseph <[email protected]>
---
Changes in v2:
- Made the skip applicable for in place also (comment from Pablo)
- Re-organized code as suggested by Pablo
- Made same change in test_mixed_auth_cipher_sgl (comment from Pablo)
app/test/test_cryptodev.c | 63 ++++++++++++++++++++++++++---------------------
1 file changed, 35 insertions(+), 28 deletions(-)
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 8137b8a..c223588 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -7343,27 +7343,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");
@@ -7560,19 +7563,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,
@@ -7580,6 +7571,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");
--
2.7.4