From cebb127ac3d42dab9f5996dcf01df1631e06bdd8 Mon Sep 17 00:00:00 2001 From: Marco Oliverio Date: Mon, 31 Jan 2022 16:32:52 +0100 Subject: [PATCH] test: don't free AesXts struct in-between tests that reuse the key --- wolfcrypt/test/test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 56818857b..8bcfb85a5 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -7909,7 +7909,6 @@ static int aes_xts_128_test(void) ERROR_OUT(-5410, out); if (XMEMCMP(p1, buf, AES_BLOCK_SIZE)) ERROR_OUT(-5411, out); - wc_AesXtsFree(aes); /* fail case with decrypting using wrong key */ XMEMSET(buf, 0, sizeof(buf)); @@ -7922,6 +7921,8 @@ static int aes_xts_128_test(void) if (XMEMCMP(p2, buf, sizeof(p2)) == 0) /* fail case with wrong key */ ERROR_OUT(-5413, out); + wc_AesXtsFree(aes); + /* set correct key and retest */ XMEMSET(buf, 0, sizeof(buf)); if (wc_AesXtsSetKey(aes, k2, sizeof(k2), AES_DECRYPTION,