From a5bc81d406abd174e1779253e8dc3c0accf7dd17 Mon Sep 17 00:00:00 2001 From: Jon Simons Date: Fri, 14 Jul 2017 15:34:10 -0400 Subject: 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 Reviewed-by: Andreas Schneider --- src/wrapper.c | 12 +++++++----- 1 file 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) { -- cgit v1.2.3