diff --git a/configure.ac b/configure.ac index 3c86a21..a9b54b0 100644 --- a/configure.ac +++ b/configure.ac @@ -111,6 +111,14 @@ if test "$ac_cv_libgcrypt" = "yes"; then fi AM_CONDITIONAL(LIBGCRYPT, test "$ac_cv_libgcrypt" = "yes") +# Not all OpenSSL have AES-CTR functions. +if test "$ac_cv_libssl" = "yes"; then + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $LIBSSL" + AC_CHECK_FUNCS(EVP_aes128_ctr) + LDFLAGS="$save_LDFLAGS" +fi + # Look for Libz if test "$use_libz" != "no"; then AC_LIB_HAVE_LINKFLAGS([z], [], [#include ]) diff --git a/src/openssl.c b/src/openssl.c index 3cc0c02..9dfc487 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -201,7 +201,7 @@ _libssh2_cipher_crypt(_libssh2_cipher_ctx * ctx, return ret == 1 ? 0 : 1; } -#if LIBSSH2_AES_CTR && OPENSSL_VERSION_NUMBER < 0x0090808fL +#if LIBSSH2_AES_CTR && !HAVE_EVP_AES128_CTR #include diff --git a/src/openssl.h b/src/openssl.h index aade7b8..3440410 100644 --- a/src/openssl.h +++ b/src/openssl.h @@ -198,7 +198,7 @@ int _libssh2_dsa_sha1_sign(libssh2_dsa_ctx * dsactx, #define _libssh2_cipher_aes256 EVP_aes_256_cbc #define _libssh2_cipher_aes192 EVP_aes_192_cbc #define _libssh2_cipher_aes128 EVP_aes_128_cbc -#if OPENSSL_VERSION_NUMBER >= 0x0090808fL +#if HAVE_EVP_AES128_CTR #define _libssh2_cipher_aes128ctr EVP_aes_128_ctr #define _libssh2_cipher_aes192ctr EVP_aes_192_ctr #define _libssh2_cipher_aes256ctr EVP_aes_256_ctr