On Thu, Jul 26, 2012, Cristiano Toninato wrote:

> This simple test program should print always the same result, but
> with openSSL 0.9.8o and gcc 4.5.2 output is
> 
> From http://www.schneier.com/code/vectors.txt, cipher bytes should
> be 51866FD5B85ECB8A
> Test BF_ecb_encrypt(): 51866FD5B85ECB8A
> Test EVP_bf_ecb(): 5AACFB5A8DC0155D
> Test EVP_bf_ecb() with 128 bit key: 5AACFB5A8DC0155D
> 
> as if EVP_CIPHER_CTX_set_key_length had no effect.
> I searched with google if anyone had similar problem, but I found
> only
> http://www.mail-archive.com/openssl-users@openssl.org/msg25808.html,
> and the discussion ends without useful information.
> I suspect something in my code being wrong, but I cannot understand what.

You need to make two call to EVP_EncryptInit_ex etc if you want a non-default
key length. Check out the examples in the manual page:

http://www.openssl.org/docs/crypto/EVP_EncryptInit.html

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to