Subject: Re: Patch to use aes_*_ctr in newer versions of OpenSSL and #if LIBSSH2_DSA for more DSA-code

Re: Patch to use aes_*_ctr in newer versions of OpenSSL and #if LIBSSH2_DSA for more DSA-code

From: Simon Josefsson <simon_at_josefsson.org>
Date: Mon, 01 Mar 2010 13:10:59 +0100

Tor Arntsen <tor_at_spacetec.no> writes:

> On Mon, Mar 1, 2010 at 12:30, Daniel Stenberg <daniel_at_haxx.se> wrote:
>> On Mon, 1 Mar 2010, Simon Josefsson wrote:
>>
>>> Great.  Btw, any particular reason you needed those fixes?  They don't
>>> look required to me.
>>
>> Because the first one caused a compiler failure, and the second a compiler
>> warning...
>
> But if it's this change:
>
> -#if LIBSSH2_AES_CTR && !HAVE_EVP_AES128_CTR
> +#if defined(LIBSSH2_AES_CTR) && !defined(HAVE_EVP_AES128_CTR)
>
> then there's something else wrong, because the code has:
>
> src/openssl.h:
> #if OPENSSL_VERSION_NUMBER >= 0x00907000L && !defined(OPENSSL_NO_AES)
> # define LIBSSH2_AES_CTR 1
> # define LIBSSH2_AES 1
> #else
> # define LIBSSH2_AES_CTR 0
> # define LIBSSH2_AES 0
> #endif
>
> so the test _should_ test for 1, and not just for defined (i.e. the
> change ef27023.. is wrong).
> If it fails then that means cpp didn't go through the path above -
> i.e. src/openssl.c didn't read src/openssl.h...

Good point -- I agree for LIBSSH2_AES_CTR, and fixed that. The change
actually made the code behave incorrectly.

The second (HAVE_EVP_AES128_CTR) is an aesthetic issue. While my
preference is to not have unnecessary defined checks, I don't care
strongly about it.

(While I'm at it, another aesthetic discussion is on the unnecessary
parenthesis after a 'defined' keyword...)

/Simon
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-03-01