1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-27 13:21:11 +03:00

wrapper: fix gcrypt build error in ssh_cipher_clear

Fix a gcrypt build error introduced with
48e7b098f8.

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 48e7b098f8:
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>
This commit is contained in:
Jon Simons
2017-07-14 15:34:10 -04:00
committed by Andreas Schneider
parent 2f42296edd
commit a5bc81d406

View File

@@ -120,14 +120,16 @@ void ssh_cipher_clear(struct ssh_cipher_struct *cipher){
SAFE_FREE(cipher->key); SAFE_FREE(cipher->key);
} }
#endif #endif
if (cipher->ctx != NULL) {
if (cipher->cleanup != NULL) { if (cipher->cleanup != NULL) {
cipher->cleanup(cipher); cipher->cleanup(cipher);
}
#ifdef HAVE_LIBCRYPTO
EVP_CIPHER_CTX_free(cipher->ctx);
#endif
} }
#ifdef HAVE_LIBCRYPTO
if (cipher->ctx != NULL) {
EVP_CIPHER_CTX_free(cipher->ctx);
}
#endif
} }
static void cipher_free(struct ssh_cipher_struct *cipher) { static void cipher_free(struct ssh_cipher_struct *cipher) {