diff options
author | Rosen Penev <rosenp@gmail.com> | 2020-01-25 20:54:40 -0800 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2020-05-05 14:32:23 +0200 |
commit | 5972d7a98e1092d31e3582a897ecd26d91eda7f5 (patch) | |
tree | 9114b7f5b8d06bbeef2fb9c5f1724ec8a2747102 | |
parent | d35fdfbdb4171331bfdf2ac3753fe4bc3fdf5407 (diff) | |
download | libssh-5972d7a98e1092d31e3582a897ecd26d91eda7f5.tar.gz libssh-5972d7a98e1092d31e3582a897ecd26d91eda7f5.tar.xz libssh-5972d7a98e1092d31e3582a897ecd26d91eda7f5.zip |
libcrypto: remove deprecated API usage
EVP_CIPHER_CTX_init was replaced with _reset.
Removed EVP_CIPHER_CTX_cleanup. The successive _free call handles that.
Removed old SSLeay function usage.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
(cherry picked from commit 54296787a79e96195a3b835c4ccbbfaae4f6189c)
-rw-r--r-- | src/libcrypto.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libcrypto.c b/src/libcrypto.c index eefc98dd..8ff8a02b 100644 --- a/src/libcrypto.c +++ b/src/libcrypto.c @@ -536,7 +536,7 @@ static int evp_cipher_set_encrypt_key(struct ssh_cipher_struct *cipher, int rc; evp_cipher_init(cipher); - EVP_CIPHER_CTX_init(cipher->ctx); + EVP_CIPHER_CTX_reset(cipher->ctx); rc = EVP_EncryptInit_ex(cipher->ctx, cipher->cipher, NULL, key, IV); if (rc != 1){ @@ -569,7 +569,7 @@ static int evp_cipher_set_decrypt_key(struct ssh_cipher_struct *cipher, int rc; evp_cipher_init(cipher); - EVP_CIPHER_CTX_init(cipher->ctx); + EVP_CIPHER_CTX_reset(cipher->ctx); rc = EVP_DecryptInit_ex(cipher->ctx, cipher->cipher, NULL, key, IV); if (rc != 1){ @@ -652,7 +652,6 @@ static void evp_cipher_decrypt(struct ssh_cipher_struct *cipher, static void evp_cipher_cleanup(struct ssh_cipher_struct *cipher) { if (cipher->ctx != NULL) { - EVP_CIPHER_CTX_cleanup(cipher->ctx); EVP_CIPHER_CTX_free(cipher->ctx); } } @@ -1084,11 +1083,11 @@ int ssh_crypto_init(void) if (libcrypto_initialized) { return SSH_OK; } - if (SSLeay() != OPENSSL_VERSION_NUMBER){ + if (OpenSSL_version_num() != OPENSSL_VERSION_NUMBER){ SSH_LOG(SSH_LOG_WARNING, "libssh compiled with %s " "headers, currently running with %s.", OPENSSL_VERSION_TEXT, - SSLeay_version(SSLeay()) + OpenSSL_version(OpenSSL_version_num()) ); } #ifdef CAN_DISABLE_AESNI |