aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJon Simons <jon@jonsimons.org>2017-07-14 19:47:48 -0400
committerAndreas Schneider <asn@cryptomilk.org>2017-07-18 09:30:57 +0200
commite66f370682927ca8bd7ae0e7544754c6f4ac4969 (patch)
tree264bb953195fc5289bd4d20dfead3fc5d4370b16 /src
parenta5bc81d406abd174e1779253e8dc3c0accf7dd17 (diff)
downloadlibssh-e66f370682927ca8bd7ae0e7544754c6f4ac4969.tar.gz
libssh-e66f370682927ca8bd7ae0e7544754c6f4ac4969.tar.xz
libssh-e66f370682927ca8bd7ae0e7544754c6f4ac4969.zip
wrapper: move EVP_CIPHER_CTX_free call to libcrypto.c
With this change, a HAVE_LIBCRYPTO #ifdef is removed from wrapper.c. Now, the libcrypto-specific logic for EVP_CIPHER_CTX_free is moved into the ssh_cipher_struct cleanup callback handler for those ciphers. Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r--src/libcrypto.c3
-rw-r--r--src/wrapper.c6
2 files changed, 3 insertions, 6 deletions
diff --git a/src/libcrypto.c b/src/libcrypto.c
index 3bed5042..6a29c6e7 100644
--- a/src/libcrypto.c
+++ b/src/libcrypto.c
@@ -554,6 +554,9 @@ static void evp_cipher_decrypt(struct ssh_cipher_struct *cipher,
static void evp_cipher_cleanup(struct ssh_cipher_struct *cipher) {
EVP_CIPHER_CTX_cleanup(cipher->ctx);
+ if (cipher->ctx != NULL) {
+ EVP_CIPHER_CTX_free(cipher->ctx);
+ }
}
#ifndef HAVE_OPENSSL_EVP_AES_CTR
diff --git a/src/wrapper.c b/src/wrapper.c
index 8f30aeba..8ee04b49 100644
--- a/src/wrapper.c
+++ b/src/wrapper.c
@@ -124,12 +124,6 @@ void ssh_cipher_clear(struct ssh_cipher_struct *cipher){
if (cipher->cleanup != NULL) {
cipher->cleanup(cipher);
}
-
-#ifdef HAVE_LIBCRYPTO
- if (cipher->ctx != NULL) {
- EVP_CIPHER_CTX_free(cipher->ctx);
- }
-#endif
}
static void cipher_free(struct ssh_cipher_struct *cipher) {