From e04c7e8e4e565d2a09ac9892622b93107deb16c4 Mon Sep 17 00:00:00 2001 From: tb Date: Mon, 5 Sep 2022 21:34:23 +0000 Subject: [PATCH] Plug leaks due to not resetting the EVP_CIPHER_CTX --- regress/lib/libcrypto/rc4/rc4_test.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/regress/lib/libcrypto/rc4/rc4_test.c b/regress/lib/libcrypto/rc4/rc4_test.c index 6c938344f2a..f5750603824 100644 --- a/regress/lib/libcrypto/rc4/rc4_test.c +++ b/regress/lib/libcrypto/rc4/rc4_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rc4_test.c,v 1.1 2022/09/03 17:43:14 tb Exp $ */ +/* $OpenBSD: rc4_test.c,v 1.2 2022/09/05 21:34:23 tb Exp $ */ /* * Copyright (c) 2022 Joshua Sing * @@ -395,6 +395,11 @@ rc4_test(void) goto failed; } + if (!EVP_CIPHER_CTX_reset(ctx)) { + fprintf(stderr, "FAIL: EVP_CIPHER_CTX_reset failed\n"); + goto failed; + } + if (memcmp(rt->out, out, rt->len) != 0) { fprintf(stderr, "FAIL: EVP encryption mismatch\n"); goto failed; @@ -427,6 +432,11 @@ rc4_test(void) goto failed; } + if (!EVP_CIPHER_CTX_reset(ctx)) { + fprintf(stderr, "FAIL: EVP_CIPHER_CTX_reset failed\n"); + goto failed; + } + if (memcmp(rt->out, out, rt->len) != 0) { fprintf(stderr, "FAIL: EVP decryption mismatch\n"); goto failed; -- 2.20.1