]> granicus.if.org Git - apache/commitdiff
Only init the RNG once at startup. This saves some entropy and works around the APR bug
authorStefan Fritsch <sf@apache.org>
Mon, 7 Nov 2011 20:57:02 +0000 (20:57 +0000)
committerStefan Fritsch <sf@apache.org>
Mon, 7 Nov 2011 20:57:02 +0000 (20:57 +0000)
fixed in r1198921

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1198930 13f79535-47bb-0310-9956-ffa450edef68

include/mod_core.h
server/core.c
server/main.c

index 8e822d9b20af6de403ad547fe00d3a7b118e64a9..5d8b83c14ccd7fd6ead8dec8b7f8b52e7fe0443a 100644 (file)
@@ -90,6 +90,8 @@ AP_DECLARE(int) ap_send_http_options(request_rec *r);
 /* Used for multipart/byteranges boundary string */
 extern AP_DECLARE_DATA const char *ap_multipart_boundary;
 
+/* Init RNG at startup */
+AP_CORE_DECLARE(void) ap_init_rng(apr_pool_t *p);
 /* Update RNG state in parent after fork */
 AP_CORE_DECLARE(void) ap_random_parent_after_fork(void);
 
index 56e48d3215c0c0a5eecedfe9d5adec8e6ee8d116..d5eadf3c9004e1f6f8a4481537da317a2d2f4f02 100644 (file)
@@ -4632,7 +4632,7 @@ AP_CORE_DECLARE(void) ap_random_parent_after_fork(void)
     apr_random_insecure_bytes(rng, &data, sizeof(data));
 }
 
-static void rng_init(apr_pool_t *p)
+AP_CORE_DECLARE(void) ap_init_rng(apr_pool_t *p)
 {
     unsigned char seed[8];
     apr_status_t rv;
@@ -4741,7 +4741,6 @@ static void register_hooks(apr_pool_t *p)
     ap_register_log_hooks(p);
     ap_register_config_hooks(p);
     ap_expr_init(p);
-    rng_init(p);
 
     /* create_connection and pre_connection should always be hooked
      * APR_HOOK_REALLY_LAST by core to give other modules the opportunity
index 70e698b4283bdd72debf453527548987e329cd0d..6c2685dbeeded1e8c155b284761d866e572dfb91 100644 (file)
@@ -34,6 +34,7 @@
 #include "http_log.h"
 #include "http_config.h"
 #include "http_core.h"
+#include "mod_core.h"
 #include "http_request.h"
 #include "http_vhost.h"
 #include "apr_uri.h"
@@ -459,6 +460,7 @@ int main(int argc, const char * const argv[])
     ap_pglobal = process->pool;
     pconf = process->pconf;
     ap_server_argv0 = process->short_name;
+    ap_init_rng(ap_pglobal);
 
     /* Set up the OOM callback in the global pool, so all pools should
      * by default inherit it. */