Better seed support for (random)
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 1 Sep 2012 04:11:04 +0000 (04:11 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Sat, 1 Sep 2012 04:11:04 +0000 (04:11 +0000)
lisp/ChangeLog
lisp/gnus-sync.el
lisp/message.el
lisp/sasl.el

index 44adea5..77baac1 100644 (file)
@@ -1,3 +1,10 @@
+2012-09-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Better seeds for (random).
+       * gnus-sync.el (gnus-sync-lesync-setup):
+       * message.el (message-canlock-generate, message-unique-id):
+       Change (random t) to (random), now that the latter is more random.
+
 2012-08-31  Dave Abrahams  <dave@boostpro.com>
 
        * auth-source.el (auth-sources): Fix macos keychain access.
index 7e13b88..510e858 100644 (file)
@@ -236,7 +236,7 @@ When SALT is nil, a random one will be generated using `random'."
          (security-object (concat url "/_security"))
          (user-record `((names . [,user]) (roles . [])))
          (couch-user-name (format "org.couchdb.user:%s" user))
-         (salt (or salt (sha1 (format "%s" (random t)))))
+         (salt (or salt (sha1 (format "%s" (random)))))
          (couch-user-record
           `((_id . ,couch-user-name)
             (type . user)
index 1e4436a..1fea5f9 100644 (file)
@@ -4864,9 +4864,7 @@ Do not use this for anything important, it is cryptographically weak."
   (require 'sha1)
   (let (sha1-maximum-internal-length)
     (sha1 (concat (message-unique-id)
-                 (format "%x%x%x" (random)
-                         (progn (random t) (random))
-                         (random))
+                 (format "%x%x%x" (random) (random) (random))
                  (prin1-to-string (recent-keys))
                  (prin1-to-string (garbage-collect))))))
 
@@ -5569,7 +5567,6 @@ In posting styles use `(\"Expires\" (make-expires-date 30))'."
 ;; You might for example insert a "." somewhere (not next to another dot
 ;; or string boundary), or modify the "fsf" string.
 (defun message-unique-id ()
-  (random t)
   ;; Don't use microseconds from (current-time), they may be unsupported.
   ;; Instead we use this randomly inited counter.
   (setq message-unique-id-char
index c6e9597..4e759a4 100644 (file)
@@ -183,7 +183,7 @@ It contain at least 64 bits of entropy."
   ;; Don't use microseconds from (current-time), they may be unsupported.
   ;; Instead we use this randomly inited counter.
   (setq sasl-unique-id-char
-       (% (1+ (or sasl-unique-id-char (logand (random t) (1- (lsh 1 20)))))
+       (% (1+ (or sasl-unique-id-char (logand (random) (1- (lsh 1 20)))))
           ;; (current-time) returns 16-bit ints,
           ;; and 2^16*25 just fits into 4 digits i base 36.
           (* 25 25)))