From: Kai Ji Date: Tue, 4 May 2021 14:19:41 +0000 (+0100) Subject: test/crypto: fix auth-cipher compare length in OOP X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=91317c0155662fcf188fac2152f33c79f90c6433;p=dpdk.git test/crypto: fix auth-cipher compare length in OOP For out-of-place operations, comparing expected ciphertext with the operation result should skip cipher_offset bytes, as those will not be copied from source to the destination buffer, making the tests fail. Fixes: 02ed7b3871d6 ("test/crypto: add SNOW3G test cases for auth-cipher") Cc: stable@dpdk.org Signed-off-by: Kai Ji Signed-off-by: Damian Nowak Acked-by: Fan Zhang --- diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 32e64e2dd1..a677a21e36 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -4671,16 +4671,20 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata, /* Validate obuf */ if (verify) { - TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( + TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT_OFFSET( plaintext, tdata->plaintext.data, - tdata->plaintext.len >> 3, + (tdata->plaintext.len - tdata->cipher.offset_bits - + (tdata->digest.len << 3)), + tdata->cipher.offset_bits, "SNOW 3G Plaintext data not as expected"); } else { - TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( + TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT_OFFSET( ciphertext, tdata->ciphertext.data, - tdata->validDataLenInBits.len, + (tdata->validDataLenInBits.len - + tdata->cipher.offset_bits), + tdata->cipher.offset_bits, "SNOW 3G Ciphertext data not as expected"); TEST_ASSERT_BUFFERS_ARE_EQUAL( @@ -4882,16 +4886,20 @@ test_snow3g_auth_cipher_sgl(const struct snow3g_test_data *tdata, /* Validate obuf */ if (verify) { - TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( + TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT_OFFSET( plaintext, tdata->plaintext.data, - tdata->plaintext.len >> 3, + (tdata->plaintext.len - tdata->cipher.offset_bits - + (tdata->digest.len << 3)), + tdata->cipher.offset_bits, "SNOW 3G Plaintext data not as expected"); } else { - TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT( + TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT_OFFSET( ciphertext, tdata->ciphertext.data, - tdata->validDataLenInBits.len, + (tdata->validDataLenInBits.len - + tdata->cipher.offset_bits), + tdata->cipher.offset_bits, "SNOW 3G Ciphertext data not as expected"); TEST_ASSERT_BUFFERS_ARE_EQUAL(