[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] wrapper: fix gcrypt build error in ssh_cipher_clear
[Thread Prev] | [Thread Next]
- Subject: [PATCH 2/3] wrapper: fix gcrypt build error in ssh_cipher_clear
- From: Jon Simons <jon@xxxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Fri, 14 Jul 2017 17:08:46 -0700
- To: libssh@xxxxxxxxxx
From bf85cff3f2ddf7fb8f8674f249171ab3fe3d0bd8 Mon Sep 17 00:00:00 2001 From: Jon Simons <jon@xxxxxxxxxxxxx> Date: Fri, 14 Jul 2017 15:34:10 -0400 Subject: [PATCH 2/3] 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@xxxxxxxxxxxxx> --- 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) { -- 2.13.2
Archive administrator: postmaster@lists.cynapses.org