EVP_EncryptInit_ex2() operation

Ken Goldman kgoldman at us.ibm.com
Mon Sep 27 19:15:27 UTC 2021


Does it make sense to initialize the context once and then use it multiple times, or is cleaner to create a new one from the raw key byte string each time?

I've seen sample code that uses this to 'reset' the context for a new encryption.

	EVP_EncryptInit_ex2(e, NULL, NULL, NULL, NULL);

1. Is this guaranteed?  Documented?
2. Does the iv get reset as well?
3. Is the padding retained, or must I call EVP_CIPHER_CTX_set_padding() again?



More information about the openssl-users mailing list