1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-20 02:42:09 +03:00

openssl.c: Fix EVP_Cipher interface change in openssl 3 #463

File:
openssl.c

Notes:
Fixes building with OpenSSL 3, #463.

The change is described there:
f7397f0d58

Credit:
Laurent Stacul, reported by Sergei
This commit is contained in:
Laurent Stacul
2021-05-03 23:47:06 +02:00
committed by GitHub
parent b5c071d180
commit 35695772d0

View File

@@ -427,10 +427,19 @@ _libssh2_cipher_crypt(_libssh2_cipher_ctx * ctx,
#else
ret = EVP_Cipher(ctx, buf, block, blocksize);
#endif
#if defined(OPENSSL_VERSION_MAJOR) && OPENSSL_VERSION_MAJOR >= 3
if(ret != -1) {
#else
if(ret == 1) {
#endif
memcpy(block, buf, blocksize);
}
#if defined(OPENSSL_VERSION_MAJOR) && OPENSSL_VERSION_MAJOR >= 3
return ret != -1 ? 0 : 1;
#else
return ret == 1 ? 0 : 1;
#endif
}
#if LIBSSH2_AES_CTR && !defined(HAVE_EVP_AES_128_CTR)