Markus Friedl wrote:
> 
> I think this change is needed if you want EVP_CipherInit() to have a
> similar semantic as in OpenSSL 0.9.6.
> 
> Index: evp/evp_enc.c
> ===================================================================
> RCS file: /cvs/openssl/crypto/evp/evp_enc.c,v
> retrieving revision 1.28
> diff -u -r1.28 evp_enc.c
> --- evp/evp_enc.c       17 Oct 2001 00:36:34 -0000      1.28
> +++ evp/evp_enc.c       13 Feb 2002 10:28:05 -0000
> @@ -77,7 +77,8 @@
>  int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
>              const unsigned char *key, const unsigned char *iv, int enc)
>         {
> -       EVP_CIPHER_CTX_init(ctx);
> +       if (cipher)
> +               EVP_CIPHER_CTX_init(ctx);
>         return EVP_CipherInit_ex(ctx,cipher,NULL,key,iv,enc);
>         }
> 
> 
> Otherwise you will break code like:
> 
>         EVP_CIPHER_CTX c;
> 
>         EVP_CIPHER_CTX_init(&c);
>         EVP_CipherInit(&c, cipher, NULL, iv, enc);
>         /* adjust keylength */
>         EVP_CIPHER_CTX_set_key_length(&c, keylen)
>         EVP_CipherInit(&c, NULL, key, NULL, -1);
> 

Oops, forgot to comment on that. Yes its definitely a bug, good catch!

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Gemplus: http://www.gemplus.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to