You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.0 KiB

  1. From 73f0e186964126c9e2bfba43488f543ace54746b Mon Sep 17 00:00:00 2001
  2. From: Rosen Penev <rosenp@gmail.com>
  3. Date: Thu, 23 Jan 2020 18:54:51 -0800
  4. Subject: [PATCH 2/2] libcrypto: remove deprecated API usage
  5. EVP_CIPHER_CTX_init was replaced with _reset.
  6. Removed EVP_CIPHER_CTX_cleanup. The successive _free call handles that.
  7. Removed old SSLeay function usage.
  8. Signed-off-by: Rosen Penev <rosenp@gmail.com>
  9. ---
  10. src/libcrypto.c | 9 ++++-----
  11. 1 file changed, 4 insertions(+), 5 deletions(-)
  12. diff --git a/src/libcrypto.c b/src/libcrypto.c
  13. index b3792264..7ce7d93a 100644
  14. --- a/src/libcrypto.c
  15. +++ b/src/libcrypto.c
  16. @@ -541,7 +541,7 @@ static int evp_cipher_set_encrypt_key(struct ssh_cipher_struct *cipher,
  17. int rc;
  18. evp_cipher_init(cipher);
  19. - EVP_CIPHER_CTX_init(cipher->ctx);
  20. + EVP_CIPHER_CTX_reset(cipher->ctx);
  21. rc = EVP_EncryptInit_ex(cipher->ctx, cipher->cipher, NULL, key, IV);
  22. if (rc != 1){
  23. @@ -574,7 +574,7 @@ static int evp_cipher_set_decrypt_key(struct ssh_cipher_struct *cipher,
  24. int rc;
  25. evp_cipher_init(cipher);
  26. - EVP_CIPHER_CTX_init(cipher->ctx);
  27. + EVP_CIPHER_CTX_reset(cipher->ctx);
  28. rc = EVP_DecryptInit_ex(cipher->ctx, cipher->cipher, NULL, key, IV);
  29. if (rc != 1){
  30. @@ -657,7 +657,6 @@ static void evp_cipher_decrypt(struct ssh_cipher_struct *cipher,
  31. static void evp_cipher_cleanup(struct ssh_cipher_struct *cipher) {
  32. if (cipher->ctx != NULL) {
  33. - EVP_CIPHER_CTX_cleanup(cipher->ctx);
  34. EVP_CIPHER_CTX_free(cipher->ctx);
  35. }
  36. }
  37. @@ -1481,11 +1480,11 @@ int ssh_crypto_init(void)
  38. if (libcrypto_initialized) {
  39. return SSH_OK;
  40. }
  41. - if (SSLeay() != OPENSSL_VERSION_NUMBER){
  42. + if (OpenSSL_version_num() != OPENSSL_VERSION_NUMBER){
  43. SSH_LOG(SSH_LOG_WARNING, "libssh compiled with %s "
  44. "headers, currently running with %s.",
  45. OPENSSL_VERSION_TEXT,
  46. - SSLeay_version(SSLeay())
  47. + OpenSSL_version(OpenSSL_version_num())
  48. );
  49. }
  50. #ifdef CAN_DISABLE_AESNI
  51. --
  52. 2.24.1