1717namespace CppUtilities {
1818
1919namespace Detail {
20- // / \brief Initializes OpenSSL.
21- // / \remarks This function is an implementation detail and must not be called by users this library.
22- inline void initOpenSsl ()
23- {
24- ERR_load_crypto_strings ();
25- OpenSSL_add_all_algorithms ();
26- }
27-
2820// / \brief Returns the current OpenSSL error.
2921// / \remarks This function is an implementation detail and must not be called by users this library.
3022inline std::string getOpenSslError ()
@@ -83,7 +75,10 @@ inline std::string parsePemSignature(std::string_view pemSignature, std::pair<st
8375 * \remarks
8476 * - The digest algorithm is assumed to be SHA256.
8577 * - The key and signature must both be provided in PEM format.
86- * - This function requires linking with the OpenSSL crypto library and will initialize OpenSSL.
78+ * - This function requires linking with the OpenSSL crypto library. It will *not* initialize the OpenSSL crypto library
79+ * explicitly assuming OpenSSL version 1.1.0 or higher is used (which no longer requires explicit initialization). If
80+ * you are using an older version of OpenSSL you may need to call ERR_load_crypto_strings() and OpenSSL_add_all_algorithms()
81+ * before invoking this function.
8782 * - This function is experimental and might be changed in incompatible ways (API and ABI wise) or be completely removed
8883 * in further minor/patch releases.
8984 *
@@ -109,7 +104,6 @@ inline std::string parsePemSignature(std::string_view pemSignature, std::pair<st
109104inline std::string verifySignature (std::string_view publicKeyPem, std::string_view signaturePem, std::string_view data)
110105{
111106 auto error = std::string ();
112- Detail::initOpenSsl ();
113107
114108 auto derSignature = std::pair<std::unique_ptr<std::uint8_t []>, std::uint32_t >();
115109 if (error = Detail::parsePemSignature (signaturePem, derSignature); !error.empty ()) {
0 commit comments