From b34a22c3080857dda092fcc722840c45cfcbf1d2 Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Mon, 5 Sep 2022 21:34:24 +0000 Subject: 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(-) (limited to 'regress') 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; -- cgit v1.2.3