Thanks Dr S N Henson. It works for us now after we did following two changes.

--Wanda Zeng--


At 12:22 AM 1/19/2002 +0000, you wrote:
>Wanda Zeng wrote:
> >
> > Hi Dr S N Henson,
> > Thanks for your quick response. Please see following two C programs.
> > We really appreciate your help.
> >
>
>[code]
>
>OK, couple of problems. Firstly the 'key' parameter needs to match the
>required key length. For the cipher you are using EVP_bf_cbc() it should
>be 16 bytes. You are only copying 4 bytes into (3 characters + null)
>into an 8 byte buffer. As a result when the encrypt routines attempt to
>load the key they are reading undefined values from memory.
>
>Your other problem is using strlen() in the decrypt routine to determine
>the length of the encrypted data. Since this is binary data and it could
>contain embedded nulls (though it doesn't in this case) this is a bad
>idea. You should pass the length as a separate parameter.
>
>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
>User Support Mailing List                    [EMAIL PROTECTED]
>Automated List Manager                           [EMAIL PROTECTED]

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to