summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2022-09-05 21:34:24 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2022-09-05 21:34:24 +0000
commitb34a22c3080857dda092fcc722840c45cfcbf1d2 (patch)
tree1ddddfe20321a39573e6569806cd44de29ab50ca /regress
parentebf4c1594eaa51b3569d9d1efb4bae20fcd181fe (diff)
Plug leaks due to not resetting the EVP_CIPHER_CTX
Diffstat (limited to 'regress')
-rw-r--r--regress/lib/libcrypto/rc4/rc4_test.c12
1 files changed, 11 insertions, 1 deletions
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 <joshua@hypera.dev>
*
@@ -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;