Hello OpenSSL folks,
*** I am trying to use the AES OFB cipher in OpenSSL, but I am hitting issues. A look at the source and the web FAQ haven't helped so far, so I'd appreciate your help a lot.

I have a message in the buffer 'buf'. I need to encrypt it, decrypt it right back and then check if I got the original back. I am doing this code:
*** int aes_ofb_state = 0;
*** AES_ofb128_encrypt(buf, buf, buf_length, &aes_enc_key, initvec, &aes_ofb_state);
*** aes_ofb_state = 0;
*** AES_ofb128_encrypt(buf, buf, buf_length, &aes_dec_key, initvec_copy, &aes_ofb_state);
At the end, buf does not match the orig_buf.

Some details:
* The initvec and initvec_copy are each "unsigned char [32]", a list of 32 zeroes.
* The aes_enc_key and aes_dec_key (of type AES_KEY) were derived like this:
*** ret = AES_set_encrypt_key(key, 256 /*key length*/, &aes_enc_key);
*** ret = AES_set_decrypt_key(key, 256 /*key length*/, &aes_dec_key);
*The key is also "unsigned char [32]", where index i has the value i.

Any ideas?

Also, I see that the "openssl enc -?" lists "-aes-256-ofb" as a possible cipher, but I couldn't locate the call to AES_ofb128_encrypt( ). That would have helped.

Thanks very much in advance.


"Imagination is more important than knowledge." -- Albert Einstein