]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
[PORT] Take advantage of OpenBSD's arc4random() function for the
authorMartin Kraemer <martin@apache.org>
Mon, 25 Nov 2002 10:31:31 +0000 (10:31 +0000)
committerMartin Kraemer <martin@apache.org>
Mon, 25 Nov 2002 10:31:31 +0000 (10:31 +0000)
initial secret

Submitted by: Henning Brauer <hb-apache-dev@bsws.de>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@97643 13f79535-47bb-0310-9956-ffa450edef68

src/CHANGES
src/modules/experimental/mod_auth_digest.c

index 1d451ed3568018d44816464946a0b3a396f8b208..a05c482d66082c78994b2ed6642552265cd7ff74 100644 (file)
@@ -1,5 +1,8 @@
 Changes with Apache 1.3.28
 
+  *) PORT: Take advantage of OpenBSD's arc4random() function for the
+     initial secret [Henning Brauer <hb-apache-dev at bsws.de>]
+
   *) If Listen directive is not a port, but just an IP, emit an
      error condition as this case is ambiguous.
      [Rich Bowen, Justin Erenkrantz, Cliff Woolley]
index 5d4ae6f047ac8e8df311c17e92764259caff50b5..dc13e57197bf488ea417d136d0da4a969ce9c5aa 100644 (file)
@@ -291,7 +291,24 @@ static void cleanup_tables(void *not_used)
 }
 #endif /* HAVE_SHMEM_MM */
 
-#ifdef WIN32
+#ifdef __OpenBSD__
+static void initialize_secret(server_rec *s)
+{
+    u_int32_t rnd = 0, i;
+
+    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, s,
+                "Digest: generating secret for digest authentication ...");
+
+    for (i = 0; i < sizeof(secret); i++) {
+       if (i % 4 == 0)
+           rnd = arc4random();
+       secret[i] = rnd;
+       rnd >>= 8;
+    }
+    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, s,
+                "Digest: done");
+}
+#elif defined(WIN32)
 /* TODO: abstract out the random number generation. APR? */
 static void initialize_secret(server_rec *s)
 {
@@ -358,6 +375,7 @@ static void initialize_secret(server_rec *s)
     ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, s, "Digest: done");
 }
 #endif
+#endif
 
 #ifdef HAVE_SHMEM_MM
 static void initialize_tables(server_rec *s)