I generate an RSA key using RSA_generate_key in one process. I then take the RSA structure that is generated and serialize it and send it to another process via an RPC mechanism. In the other process I then de-serialize the RSA data and use that as input to an RSA_private_decrypt function to decrypt some data that was previously encrypted with the RSA public key.
This works fine and I am able to decrypt the data successful, HOWEVER, it takes a long time to do so, like up to 2 seconds. It is almost as if it is doing another key generation in the background. Note that if I do this RSA_private_decrypt in the same process as the one that generated the key, it takes around 20-30 ms. This leads me to think that maybe there is some static data that the openssl library uses in RSA_private_decrypt that was cached when I generated the key and now is not available since it is a new process. Can anyone enlighten me on this?