From 3d43d66033f8bca2f3187a3a195624aaaa9e6535 Mon Sep 17 00:00:00 2001 From: Jack Del Vecchio Date: Thu, 5 Dec 2024 14:23:03 -0500 Subject: [PATCH] Hash Private/Public keys instead of using original string as key --- plugins/openssl/openssl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/openssl/openssl.cpp b/plugins/openssl/openssl.cpp index a39c66fd867..ab334337cdb 100644 --- a/plugins/openssl/openssl.cpp +++ b/plugins/openssl/openssl.cpp @@ -148,7 +148,7 @@ class PKeyCache { for (auto& c : cache) { - if (strncmp(std::get<0>(c).c_str(), key, keyLen) == 0) + if (hashc(reinterpret_cast(key), keyLen, 0) == std::get<0>(c)) { hits++; return std::get<1>(c); @@ -170,7 +170,7 @@ class PKeyCache BIO_free(bio); if (pkey) { - cache.emplace_front(std::string(key, keyLen), pkey); + cache.emplace_front(hashc(reinterpret_cast(key), keyLen, 0), pkey); if (cache.size() > OPENSSL_MAX_CACHE_SIZE) { EVP_PKEY_free(std::get<1>(cache.back())); @@ -195,7 +195,7 @@ class PKeyCache private: int hits; int misses; - std::list> cache; + std::list> cache; };