ibmruntimes / openj9-openjdk-jdk11

Extensions for OpenJDK 11 for Eclipse OpenJ9
GNU General Public License v2.0
32 stars 111 forks source link

Cache openssl message digest contexts #701

Closed jasonkatonica closed 1 year ago

jasonkatonica commented 1 year ago

It has been identified that when using OpenSSL version 3.x the message digest context initialization is much more expensive than using OpenSSL version 1.x. This update optimizes the use of OpenSSL contexts by making use of a simple cache.

We will create a second initialized openssl digest context when the message digest cipher is initialized. This second context, defined as context->cachedInitalizedDigestContext, will be copied over the working context, context->ctx, using the EVP_MD_CTX_copy_ex API whenever we wish to re-initalize this cipher. The restoration of a context occurs whenever a cipher is explictly reset or whenever a final digest is computed.

Backported from:

https://github.com/ibmruntimes/openj9-openjdk-jdk/pull/643

Signed-off by: Jason Katonica katonica@us.ibm.com

keithc-ca commented 1 year ago

Jenkins compile osx jdk11