Created
January 24, 2020 03:05
-
-
Save neheb/508befec8ce0e106d64a50eb956fee6b to your computer and use it in GitHub Desktop.
libssh2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 73f0e186964126c9e2bfba43488f543ace54746b Mon Sep 17 00:00:00 2001 | |
From: Rosen Penev <[email protected]> | |
Date: Thu, 23 Jan 2020 18:54:51 -0800 | |
Subject: [PATCH 2/2] 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 <[email protected]> | |
--- | |
src/libcrypto.c | 9 ++++----- | |
1 file changed, 4 insertions(+), 5 deletions(-) | |
diff --git a/src/libcrypto.c b/src/libcrypto.c | |
index b3792264..7ce7d93a 100644 | |
--- a/src/libcrypto.c | |
+++ b/src/libcrypto.c | |
@@ -541,7 +541,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){ | |
@@ -574,7 +574,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){ | |
@@ -657,7 +657,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); | |
} | |
} | |
@@ -1481,11 +1480,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 | |
-- | |
2.24.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment