Skip to content

Commit

Permalink
test/crypto: skip plain text compare for null cipher
Browse files Browse the repository at this point in the history
[ upstream commit 9fc6983 ]

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: e847fc5 ("test/crypto: add encrypted digest case for AES-CTR-CMAC")

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Ciara Power <ciara.power@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
  • Loading branch information
anoobj authored and cpaelzer committed Nov 30, 2021
1 parent 91f6ce9 commit 6bf2029
Showing 1 changed file with 35 additions and 28 deletions.
63 changes: 35 additions & 28 deletions app/test/test_cryptodev.c
Expand Up @@ -6789,27 +6789,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");

Expand Down Expand Up @@ -7006,26 +7009,30 @@ 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,
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");

Expand Down

0 comments on commit 6bf2029

Please sign in to comment.