[openssl-users] How to do AES-256-CBC encryption with EVP_CIPHER_CTX now opaque?

Matt Caswell matt at openssl.org
Fri Nov 25 14:49:40 UTC 2016



On 25/11/16 14:42, Dave Poirier wrote:
> *Question 1: Are there other functions I should have been using to
> implement AES-256-CBC than the EVP methods above?*

EVP is the correct thing to be using.

> 
> Question 2: If EVP is the way to go for implementing AES-256-CBC, which
> functions should I be looking at to not require EVP_CIPHER_CTX variable
> declaration?

You still use an EVP_CIPHER_CTX, you just don't allocate it on the stack
like you have in your code:

EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();

if (ctx == NULL)
	/* Do some error handling */

...do your crypto stuff....

/* Free the allocated EVP_CIPHER_CTX */
EVP_CIPHER_CTX_free(ctx);



Matt


More information about the openssl-users mailing list