On Sun, 18 Mar 2012 11:20:44 +0100 (CET)
Daniel Stenberg <dan...@haxx.se> wrote:

> On Sun, 18 Mar 2012, Paul Howarth wrote:
> 
> >> I simply cannot find any public docs for this strangeness from
> >> openssl (and it annoys me a lot). I guess we can instead switch to
> >> always use our implementation if AES_CTR is desired. See my second
> >> take on a patch (ditch the previous).
> >
> > That didn't work either. I think you'll need to kill the 
> > HAVE_EVP_AES_128_CTR bit in openssl.h too.
> 
> Care to suggest a patch you think would work?

This one works for me.

Paul.
>From 24577937c36b32472d4bfff449d5e173192eec05 Mon Sep 17 00:00:00 2001
From: Paul Howarth <p...@city-fan.org>
Date: Sun, 18 Mar 2012 12:07:27 +0000
Subject: [PATCH] aes: the init function fails when OpenSSL has AES support

The internal init function only worked fine when the configure script
didn't detect the OpenSSL AES_CTR function!

Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0111.shtml
Reported by: Paul Howarth
---
 src/openssl.c |    4 +++-
 src/openssl.h |    6 ------
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/openssl.c b/src/openssl.c
index 40818c0..481982c 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 && !defined(HAVE_EVP_AES_128_CTR)
+#if LIBSSH2_AES_CTR
 
 #include <openssl/aes.h>
 #include <openssl/evp.h>
@@ -362,6 +362,8 @@ void _libssh2_init_aes_ctr(void)
     _libssh2_EVP_aes_256_ctr();
 }
 
+#else
+void _libssh2_init_aes_ctr(void) {}
 #endif /* LIBSSH2_AES_CTR */
 
 /* TODO: Optionally call a passphrase callback specified by the
diff --git a/src/openssl.h b/src/openssl.h
index a196184..6d2aeed 100644
--- a/src/openssl.h
+++ b/src/openssl.h
@@ -148,15 +148,9 @@ void libssh2_md5(const unsigned char *message, unsigned long len, unsigned char
 #define _libssh2_cipher_aes256 EVP_aes_256_cbc
 #define _libssh2_cipher_aes192 EVP_aes_192_cbc
 #define _libssh2_cipher_aes128 EVP_aes_128_cbc
-#ifdef HAVE_EVP_AES_128_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
-#else
 #define _libssh2_cipher_aes128ctr _libssh2_EVP_aes_128_ctr
 #define _libssh2_cipher_aes192ctr _libssh2_EVP_aes_192_ctr
 #define _libssh2_cipher_aes256ctr _libssh2_EVP_aes_256_ctr
-#endif
 #define _libssh2_cipher_blowfish EVP_bf_cbc
 #define _libssh2_cipher_arcfour EVP_rc4
 #define _libssh2_cipher_cast5 EVP_cast5_cbc
-- 
1.7.7.6

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to