Dr S N Henson wrote:
>
> 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!
This is in my queue to commit, btw.
Cheers,
Ben.
--
http://www.apache-ssl.org/ben.html http://www.thebunker.net/
"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]