From: Doug MacEachern Date: Thu, 29 Nov 2001 05:17:38 +0000 (+0000) Subject: SSL_rand() does a mutex lock/unlock with threaded MPMs, so collapse X-Git-Tag: 2.0.30~346 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1497bb60539458709017d74b44278eefa0f4b3b1;p=apache SSL_rand() does a mutex lock/unlock with threaded MPMs, so collapse two calls that seed pid and time into one. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92233 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/ssl/ssl_engine_rand.c b/modules/ssl/ssl_engine_rand.c index 36a57bce05..7b41ae0ef9 100644 --- a/modules/ssl/ssl_engine_rand.c +++ b/modules/ssl/ssl_engine_rand.c @@ -81,8 +81,6 @@ int ssl_rand_seed(server_rec *s, apr_pool_t *p, ssl_rsctx_t nCtx, char *prefix) int nReq, nDone; apr_file_t *fp; int i, n, l; - time_t t; - pid_t pid; mc = myModConfig(s); nReq = 0; @@ -125,20 +123,23 @@ int ssl_rand_seed(server_rec *s, apr_pool_t *p, ssl_rsctx_t nCtx, char *prefix) } #endif else if (pRandSeed->nSrc == SSL_RSSRC_BUILTIN) { + struct { + time_t t; + pid_t pid; + } my_seed; + /* * seed in the current time (usually just 4 bytes) */ - t = time(NULL); - l = sizeof(time_t); - RAND_seed((unsigned char *)&t, l); - nDone += l; + my_seed.t = time(NULL); /* * seed in the current process id (usually just 4 bytes) */ - pid = mc->pid; - l = sizeof(pid_t); - RAND_seed((unsigned char *)&pid, l); + my_seed.pid = mc->pid; + + l = sizeof(my_seed); + RAND_seed((unsigned char *)&my_seed, l); nDone += l; /*