I couldn't make the new version work, but I installed 0.9.8g, from binaries, deleted everything related to OpenSSL, and recompiled the example. It now generated the same output, but in my actual project it still wasn't working. I found some errors in the key handling, and after I fixed that, the blowfish started working, but not the 3DES. I tried AES too, and they all worked, except the one I was using. It's not a problem tho, I use the AES now, and everything is working fine now, but with the older version of OpenSSL.
Thank you for your help. On Wed, Apr 15, 2009 at 9:16 PM, Victor Duchovni <victor.ducho...@morganstanley.com> wrote: > On Wed, Apr 15, 2009 at 08:19:34PM +0300, Atti wrote: > >> Okay, well as I said, I compiled and ran the example from the OpenSSL >> docs (http://openssl.org/docs/crypto/EVP_EncryptInit.html#EXAMPLES), >> which has an IV, and the application still behaves the same. > > What key and IV sizes does the following code variant report? On > a Unix system both 0.9.8i and 1.0.0-beta1 produce consistent > identical ciphertexts that decrypt via "openssl bf -in cipher.bin -K > 000102030405060708090A0B0C0D0E0F -iv 0102030405060708 -d" as advertised. > > #include <openssl/evp.h> > #include <stdio.h> > int do_crypt(char *outfile) > { > unsigned char outbuf[1024]; > int outlen, tmplen; > unsigned char key[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; > unsigned char iv[] = {1,2,3,4,5,6,7,8}; > char intext[] = "Some Crypto Text"; > EVP_CIPHER_CTX ctx; > FILE *out; > > EVP_CIPHER_CTX_init(&ctx); > EVP_EncryptInit_ex(&ctx, EVP_bf_cbc(), NULL, key, iv); > fprintf(stderr, "key length=%d, IV length=%d\n", > EVP_CIPHER_CTX_key_length(&ctx), > EVP_CIPHER_CTX_iv_length(&ctx)); > if(!EVP_EncryptUpdate(&ctx, outbuf, &outlen, intext, strlen(intext))) > return 0; > if(!EVP_EncryptFinal_ex(&ctx, outbuf + outlen, &tmplen)) > return 0; > outlen += tmplen; > EVP_CIPHER_CTX_cleanup(&ctx); > > out = fopen(outfile, "wb"); > fwrite(outbuf, 1, outlen, out); > fclose(out); > return 1; > } > int main(int argc, char *argv[]) { return !do_crypt(argv[1]); } > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List openssl-us...@openssl.org > Automated List Manager majord...@openssl.org > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org