summaryrefslogtreecommitdiffstats
path: root/src/dh.c
diff options
context:
space:
mode:
authorOliver Stöneberg <oliverst@online.de>2011-04-26 16:06:46 -0700
committerAndreas Schneider <asn@cryptomilk.org>2011-05-01 19:42:50 +0200
commit3ae01ff9f5b3e1f2ebded97ff36a705ae3b17b30 (patch)
tree823ecc62dcc3a7e01af2c85a852e5ba882393b94 /src/dh.c
parent040a543f57107efc267b7b5b7352293dcb7d87d5 (diff)
downloadlibssh-3ae01ff9f5b3e1f2ebded97ff36a705ae3b17b30.tar.gz
libssh-3ae01ff9f5b3e1f2ebded97ff36a705ae3b17b30.tar.xz
libssh-3ae01ff9f5b3e1f2ebded97ff36a705ae3b17b30.zip
init: Some initialization fixes.
- Check result of ssh_init() in privatekey_from_base64() - Moved code from ssh_finalize() to appropriate subroutines - Only initialize sockets once (caused mismatch of WSAStartup() and WSACleanup() calls and potential usage of bsd_poll when win_poll should be used)
Diffstat (limited to 'src/dh.c')
-rw-r--r--src/dh.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dh.c b/src/dh.c
index 62f4f0c8..30625db3 100644
--- a/src/dh.c
+++ b/src/dh.c
@@ -140,6 +140,7 @@ int ssh_crypto_init(void) {
}
bignum_bin2bn(p_value, P_LEN, p);
OpenSSL_add_all_algorithms();
+
#endif
ssh_crypto_initialized = 1;
@@ -154,8 +155,13 @@ void ssh_crypto_finalize(void) {
g = NULL;
bignum_free(p);
p = NULL;
+#ifdef HAVE_LIBGCRYPT
+ gcry_control(GCRYCTL_TERM_SECMEM);
+#elif defined HAVE_LIBCRYPTO
+ EVP_cleanup();
+ CRYPTO_cleanup_all_ex_data();
+#endif
ssh_crypto_initialized=0;
-
}
}