aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2023-04-13 22:27:35 -0500
committerDenis Kenzior <denkenz@gmail.com>2023-04-16 11:26:22 -0500
commit1122d699c454ef26e2028dc7b8f50bd4a40d9bfd (patch)
tree60b76a4619de0e238f306787f75d6b46156b4c83
parent170aebefe451ffeb7badac2c30f8ce2af02b282c (diff)
unit: Remove use of zero-length array
Commit 9c3b89998923 ("unit: Add gcm(aes) test vectors") introduced a compound literal, which returned a zero length array in case plaintext or ciphertext members were NULL in the test. See: https://gcc.gnu.org/onlinedocs/gcc/Compound-Literals.html) Commit: bd8b27345c91 ("unit: Rewrite aead cipher test to be more paranoid") changed the compound literal to a more easy understood approach where the pt/ct pointers were initialized to a zero-length array. It is not clear why the zero length array is needed now at all since aead_cipher_encrypt does support NULL plaintext input if the plaintext length is 0. Since there's no apparent need, remove the zero length array use.
-rw-r--r--unit/test-cipher.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/unit/test-cipher.c b/unit/test-cipher.c
index 1e7dc1f0..a1fa5bc0 100644
--- a/unit/test-cipher.c
+++ b/unit/test-cipher.c
@@ -292,7 +292,6 @@ static const struct aead_test_vector gcm_test6 = {
static void test_aead(const void *data)
{
- static uint8_t empty[] = { };
struct l_aead_cipher *cipher;
char *encbuf;
size_t encbuflen;
@@ -303,7 +302,7 @@ static void test_aead(const void *data)
const struct aead_test_vector *tv = data;
size_t ptlen = 0;
- uint8_t *pt = empty;
+ uint8_t *pt = NULL;
size_t aadlen = 0;
uint8_t *aad = NULL;
size_t keylen;
@@ -311,7 +310,7 @@ static void test_aead(const void *data)
size_t noncelen;
uint8_t *nonce = l_util_from_hexstring(tv->nonce, &noncelen);
size_t ctlen = 0;
- uint8_t *ct = empty;
+ uint8_t *ct = NULL;
size_t taglen;
uint8_t *tag = l_util_from_hexstring(tv->tag, &taglen);