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.
--- app/test/test_cryptodev.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
app/test/test_cryptodev.c +16 -8
@@ -4200,16 +4200,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(
@@ -4397,16 +4401,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(
Signature · 13 lines
2.17.1 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Zhang, Roy Fan
Acked-byQuoted 13 lines
-----Original Message-----
From: Ji, Kai <[email protected]>
Sent: Tuesday, May 4, 2021 3:20 PM
To: [email protected]
Cc: [email protected]; Zhang, Roy Fan <[email protected]>; Ji, Kai <[email protected]>
Subject: [dpdk-dev] test/crypto: fix auth-cipher compare length in oopFor out-of-place operations, comparing expected ciphertext with the operation result should skip
cipher_offsetbytes, as those will not be copied from source to the destination buffer, making the tests fail.
Quoted 9 lines
Fixes 02ed7b3871d6 ("test/crypto: add SNOW3G test cases for auth-cipher")Signed-off-by Kai Ji <[email protected]>Signed-off-by Damian Nowak <[email protected]>--- app/test/test_cryptodev.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
Welcome Kai!
Akhil Goyal
AppliedQuoted 18 lines
Quoted 8 lines
Subject: [dpdk-dev] test/crypto: fix auth-cipher compare length in oop
For out-of-place operations, comparing expected ciphertext with the operation result should skip
cipher_offsetbytes, 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")
Quoted 8 lines
Signed-off-by Kai Ji <[email protected]>Signed-off-by Damian Nowak <[email protected]>--- app/test/test_cryptodev.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
Quoted 3 lines
Welcome Kai!
Acked-by Fan Zhang <[email protected]>
Applied to dpdk-next-crypto
Thanks.
PS. This patch was posted twice without superseding. Please take care next time to avoid confusion.