bdaebd
diff --git a/modules/ssl/mod_ssl.c b/modules/ssl/mod_ssl.c
bdaebd
index 37947e7..b50c259 100644
bdaebd
--- a/modules/ssl/mod_ssl.c
bdaebd
+++ b/modules/ssl/mod_ssl.c
bdaebd
@@ -331,9 +331,6 @@ static apr_status_t ssl_cleanup_pre_config(void *data)
bdaebd
     /*
bdaebd
      * Try to kill the internals of the SSL library.
bdaebd
      */
bdaebd
-#ifdef HAVE_FIPS
bdaebd
-    FIPS_mode_set(0);
bdaebd
-#endif
bdaebd
     /* Corresponds to OBJ_create()s */
bdaebd
     OBJ_cleanup();
bdaebd
     /* Corresponds to OPENSSL_load_builtin_modules() */
bdaebd
diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c
bdaebd
index 5063a72..21e41e2 100644
bdaebd
--- a/modules/ssl/ssl_engine_init.c
bdaebd
+++ b/modules/ssl/ssl_engine_init.c
bdaebd
@@ -183,6 +183,14 @@ int ssl_is_challenge(conn_rec *c, const char *servername,
bdaebd
     return 0;
bdaebd
 }
bdaebd
 
bdaebd
+#ifdef HAVE_FIPS
bdaebd
+static apr_status_t ssl_fips_cleanup(void *data)
bdaebd
+{
bdaebd
+    FIPS_mode_set(0);
bdaebd
+    return APR_SUCCESS;
bdaebd
+}
bdaebd
+#endif
bdaebd
+
bdaebd
 /*
bdaebd
  *  Per-module initialization
bdaebd
  */
bdaebd
@@ -316,6 +324,8 @@ apr_status_t ssl_init_Module(apr_pool_t *p, apr_pool_t *plog,
bdaebd
             if (FIPS_mode_set(1)) {
bdaebd
                 ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, APLOGNO(01884)
bdaebd
                              "Operating in SSL FIPS mode");
bdaebd
+                apr_pool_cleanup_register(p, NULL, ssl_fips_cleanup,
bdaebd
+                                          apr_pool_cleanup_null);
bdaebd
             }
bdaebd
             else {
bdaebd
                 ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(01885) "FIPS mode failed");