With EVP/AES I cannot change encrypt/decrypt after setting KEY
bool ok = EVP_CipherInit_ex( &ctx, type, impl, key, iv, enc );

I am calling EVP_CipherInit_ex()  more than once.
I set the key early then later set enc (or change it after a default CTOR).
The DOCS says simply leave things NULL for them to be unchanged.

This worked fine for a range of ciphers, but not AES.
The source file .../crypto/evp/e_aes.c  shows different functions
which presumably do slightly different things (it drops into asm)
and would need to be redone, if changing mode.

ret=AES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data);
ret=AES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data);

THEN setting enc before setting the key stopped it failing.
Cannot change encrypt-flag to decrypt-mode without setting KEY again.

Graham
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to