charon.plugins.openssl.fips_mode = 0
Set OpenSSL FIPS mode: disabled(0), enabled(1), Suite B enabled(2).
+
+charon.plugins.openssl.load_legacy = yes
+ Load the legacy provider in OpenSSL 3+ for algorithms like MD4, DES, or
+ Blowfish (the first two are required for EAP-MSCHAPv2). If disabled, the
+ default provider is loaded, or those configured in the OpenSSL config.
#include <library.h>
#include <utils/debug.h>
+#include <collections/array.h>
#include <threading/thread.h>
#include <threading/mutex.h>
#include <threading/thread_value.h>
#ifndef OPENSSL_NO_ECDH
#include <openssl/ec.h>
#endif
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+#include <openssl/provider.h>
+#endif
#include "openssl_plugin.h"
#include "openssl_util.h"
* public functions
*/
openssl_plugin_t public;
+
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ /**
+ * Loaded providers
+ */
+ array_t *providers;
+#endif
};
/**
METHOD(plugin_t, destroy, void,
private_openssl_plugin_t *this)
{
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ OSSL_PROVIDER *provider;
+ while (array_remove(this->providers, ARRAY_TAIL, &provider))
+ {
+ OSSL_PROVIDER_unload(provider);
+ }
+ array_destroy(this->providers);
+#endif /* OPENSSL_VERSION_NUMBER */
+
/* OpenSSL 1.1.0 cleans up itself at exit and while OPENSSL_cleanup() exists we
* can't call it as we couldn't re-initialize the library (as required by the
* unit tests and the Android app) */
#endif /* OPENSSL_NO_ENGINE */
#endif /* OPENSSL_VERSION_NUMBER */
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ if (lib->settings->get_bool(lib->settings, "%s.plugins.openssl.load_legacy",
+ TRUE, lib->ns))
+ {
+ /* load the legacy provider for algorithms like MD4, DES, BF etc. */
+ array_insert_create(&this->providers, ARRAY_TAIL,
+ OSSL_PROVIDER_load(NULL, "legacy"));
+ /* explicitly load the default provider, as mentioned by crypto(7) */
+ array_insert_create(&this->providers, ARRAY_TAIL,
+ OSSL_PROVIDER_load(NULL, "default"));
+ }
+#endif /* OPENSSL_VERSION_NUMBER */
+
#ifdef OPENSSL_FIPS
/* we do this here as it may have been enabled via openssl.conf */
fips_mode = FIPS_mode();