Openssl bugs administrator, I believe I found a bug in EVP_DecryptInit and EVP_EncryptInit. The documentation at: http://www.openssl.org/docs/crypto/EVP_EncryptInit.html says that those two functions and EVP_CipherInit do not need the EVP_CIPHER_CTX to be initialized, but that is not true. Only EVP_CipherInit allows the EVP_CIPHER_CTX to be un-initialized. You can see the problem in openssl-0.9.7/crypto/evp/evp_enc.c, line 227 and 239. They should call the non-_ex functions, but do not. This causes an un-initialized CTX to be used without an init, which usually causes a segfault. Here is a test program that shows the problem: #include <memory.h> #include <openssl/evp.h> int main( int argc, char *argv[] ) { EVP_CIPHER_CTX x; char key[32], iv[16]; printf( "memset(0) works...\n" ); memset( &x, 0, sizeof(x) ); EVP_DecryptInit( &x, EVP_aes_256_cbc(), key, iv ); printf( "memset(0xff) fails...\n" ); memset( &x, 0xff, sizeof(x) ); EVP_DecryptInit( &x, EVP_aes_256_cbc(), key, iv ); printf( "does not get here\n" ); return 0; } My output is: memset(0) works... memset(0xff) fails... Segmentation fault To fix, just change evp_enc.c to call EVP_CipherInit instead of EVP_CipherInit_ex on lines 227 and 239.
If you have any questions, please contact me. Thank you, Noah Gintis. ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
