aboutsummaryrefslogtreecommitdiff
path: root/src/wrapper.c
diff options
context:
space:
mode:
authorJon Simons <jon@jonsimons.org>2017-07-14 15:34:10 -0400
committerAndreas Schneider <asn@cryptomilk.org>2017-07-18 09:30:19 +0200
commita5bc81d406abd174e1779253e8dc3c0accf7dd17 (patch)
tree0e1446ca9ae56dbd82f768fe5b289f1079e8ee01 /src/wrapper.c
parent2f42296edd1bcef93f4232c68b0f1630cb6b363e (diff)
downloadlibssh-a5bc81d406abd174e1779253e8dc3c0accf7dd17.tar.gz
libssh-a5bc81d406abd174e1779253e8dc3c0accf7dd17.tar.xz
libssh-a5bc81d406abd174e1779253e8dc3c0accf7dd17.zip
wrapper: fix gcrypt build error in ssh_cipher_clear
Fix a gcrypt build error introduced with 48e7b098f86207f8596651b5ba8242a3b834a868. The ssh_cipher_struct only contains a `ctx` field on the libcrypto builds, so it can't be referenced unless within HAVE_LIBCRYPTO. This build fix preserves the original spirit of the change in 48e7b098f86207f8596651b5ba8242a3b834a868: only call `EVP_CIPHER_CTX_free` when `cipher->ctx` is non-NULL. Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/wrapper.c')
-rw-r--r--src/wrapper.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/wrapper.c b/src/wrapper.c
index 60dc9fd1..8f30aeba 100644
--- a/src/wrapper.c
+++ b/src/wrapper.c
@@ -120,14 +120,16 @@ void ssh_cipher_clear(struct ssh_cipher_struct *cipher){
SAFE_FREE(cipher->key);
}
#endif
- if (cipher->ctx != NULL) {
- if (cipher->cleanup != NULL) {
- cipher->cleanup(cipher);
- }
+
+ if (cipher->cleanup != NULL) {
+ cipher->cleanup(cipher);
+ }
+
#ifdef HAVE_LIBCRYPTO
+ if (cipher->ctx != NULL) {
EVP_CIPHER_CTX_free(cipher->ctx);
-#endif
}
+#endif
}
static void cipher_free(struct ssh_cipher_struct *cipher) {