pkd: Cleanup OpenSSL context

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2025-07-24 19:19:51 +02:00
committed by Andreas Schneider
parent 961c79637c
commit 3df61a4e86
2 changed files with 9 additions and 3 deletions

View File

@@ -17,10 +17,8 @@ set(pkd_hello_src
) )
set(pkd_libs set(pkd_libs
${CMOCKA_LIBRARY} ${TORTURE_LINK_LIBRARIES}
ssh::static
${ARGP_LIBRARIES} ${ARGP_LIBRARIES}
pthread
) )
add_executable(pkd_hello ${pkd_hello_src}) add_executable(pkd_hello ${pkd_hello_src})

View File

@@ -22,6 +22,11 @@
#include "pkd_keyutil.h" #include "pkd_keyutil.h"
#include "pkd_util.h" #include "pkd_util.h"
#if defined(HAVE_LIBCRYPTO)
/* for OPENSSL_cleanup() of OpenSSL context */
#include <openssl/crypto.h>
#endif
#define DEFAULT_ITERATIONS 10 #define DEFAULT_ITERATIONS 10
static struct pkd_daemon_args pkd_dargs; static struct pkd_daemon_args pkd_dargs;
@@ -1019,6 +1024,9 @@ out_finalize:
if (rc != 0) { if (rc != 0) {
fprintf(stderr, "ssh_finalize: %d\n", rc); fprintf(stderr, "ssh_finalize: %d\n", rc);
} }
#if defined(HAVE_LIBCRYPTO)
OPENSSL_cleanup();
#endif
out: out:
return exit_code; return exit_code;
} }