1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

B #6445: Make RSA (de)encryption thread safe (#2882)

Co-authored-by: Ruben S. Montero <rsmontero@opennebula.org>
(cherry picked from commit 5966e8d60def2d8a20f6e0ad5669f78800115104)
This commit is contained in:
Pavel Czerný 2024-01-03 10:58:18 +01:00 committed by Jan Orel
parent edcf221e64
commit 92a6150105
No known key found for this signature in database
GPG Key ID: C7B901ABAF4CFF1B

View File

@ -255,6 +255,9 @@ namespace ssl_util
int rsa_public_encrypt(const std::string& in, std::string& out)
{
static RSA * rsa = nullptr;
static std::mutex m;
std::lock_guard lock(m);
if ( rsa == nullptr) //initialize RSA structure
{
@ -297,6 +300,9 @@ namespace ssl_util
int rsa_private_decrypt(const std::string& in, std::string& out)
{
static RSA * rsa = nullptr;
static std::mutex m;
std::lock_guard lock(m);
if ( rsa == nullptr) //initialize RSA structure
{