summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2022-09-28 20:31:16 +0300
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2022-10-02 16:53:06 +0300
commit6419fbb1d3dd365a89623a94448a0335ae4a8554 (patch)
treeb05061f5d420a104786790c89e7ca716316fa88a /tests
parent335b8eb1211b3b67541c689da949101db3b669fd (diff)
downloadlibgcrypt-6419fbb1d3dd365a89623a94448a0335ae4a8554.tar.gz
tests/benchmark: remove VLA usage
* cipher/benchmark.c (ccm_aead_init): Avoid VLA in stack array. -- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'tests')
-rw-r--r--tests/benchmark.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/benchmark.c b/tests/benchmark.c
index a23cf74b..e9223f5a 100644
--- a/tests/benchmark.c
+++ b/tests/benchmark.c
@@ -719,15 +719,16 @@ mac_bench ( const char *algoname )
static void ccm_aead_init(gcry_cipher_hd_t hd, size_t buflen, int authlen)
{
- const int _L = 4;
- const int noncelen = 15 - _L;
- char nonce[noncelen];
+ const char _L[4];
+ char nonce[15 - sizeof(_L)];
u64 params[3];
gcry_error_t err = GPG_ERR_NO_ERROR;
- memset (nonce, 0x33, noncelen);
+ (void)_L;
- err = gcry_cipher_setiv (hd, nonce, noncelen);
+ memset (nonce, 0x33, sizeof(nonce));
+
+ err = gcry_cipher_setiv (hd, nonce, sizeof(nonce));
if (err)
{
fprintf (stderr, "gcry_cipher_setiv failed: %s\n",