Search code examples
opensslevp-cipher

OpenSSL EVP_CIPHER free/release


I can't find any method like EVP_CIPHER_free in openssl/evp.h. Don't I need to release the EVP_CIPHERs?


Solution

  • No, you don't. The init function EVP_CipherInit_ex is actually initializing variables in EVP_CIPHER_CTX object ectx, which you pass as the first argument. Just remember to call EVP_CIPHER_CTX_cleanup(&ectx) when you're done.