<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>54279</bug_id>
          
          <creation_ts>2011-02-11 01:44:41 -0800</creation_ts>
          <short_desc>Use /dev/urandom as the OSRandomSource on OS(DARWIN)</short_desc>
          <delta_ts>2011-02-12 15:05:35 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Other</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Adam Barth">abarth</reporter>
          <assigned_to name="Adam Barth">abarth</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>eric</cc>
    
    <cc>mjs</cc>
    
    <cc>mrowe</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>349691</commentid>
    <comment_count>0</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-02-11 01:44:41 -0800</bug_when>
    <thetext>Use /dev/urandom as the OSRandomSource on OS(DARWIN)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>349692</commentid>
    <comment_count>1</comment_count>
      <attachid>82115</attachid>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-02-11 01:47:26 -0800</bug_when>
    <thetext>Created attachment 82115
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>350236</commentid>
    <comment_count>2</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2011-02-11 22:35:54 -0800</bug_when>
    <thetext>arc4random itself on Mac OS X seeds from /dev/random rather than /dev/urandom.  On Mac OS X and FreeBSD the two are equivalent, but on Linux platforms /dev/random contains strictly more entropy than /dev/urandom, with the latter not being recommended for certain long-term cryptographic purposes.  Is there a particular reason why the code uses /dev/random rather than /dev/urandom?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>350239</commentid>
    <comment_count>3</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-02-11 23:20:40 -0800</bug_when>
    <thetext>&gt; arc4random itself on Mac OS X seeds from /dev/random rather than /dev/urandom.

Does it?

http://www.opensource.apple.com/source/Libc/Libc-391.2.7/gen/arc4random.c says:

	fd = open(&quot;/dev/urandom&quot;, O_RDONLY, 0);

Perhaps that code is out of date?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>350240</commentid>
    <comment_count>4</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-02-11 23:27:58 -0800</bug_when>
    <thetext>In either case, my understanding is that this statement from wikipedia is accurate:

[[
A counterpart to /dev/random is /dev/urandom (&quot;unlocked&quot;/non-blocking random source[4]) which reuses the internal pool to produce more pseudo-random bits. This means that the call will not block, but the output may contain less entropy than the corresponding read from /dev/random. While it is still intended as a pseudorandom number generator suitable for most cryptographic purposes, it is not recommended for the generation of long-term cryptographic keys.
]]

For our purposes, the non-blocking nature of /dev/urandom is helpful (otherwise the browser will hang).  We&apos;re already re-using our entropy pool with RC4, so the net result is essentially the same.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>350254</commentid>
    <comment_count>5</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2011-02-12 02:51:09 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; &gt; arc4random itself on Mac OS X seeds from /dev/random rather than /dev/urandom.
&gt; 
&gt; Does it?
&gt; 
&gt; http://www.opensource.apple.com/source/Libc/Libc-391.2.7/gen/arc4random.c says:
&gt; 
&gt;     fd = open(&quot;/dev/urandom&quot;, O_RDONLY, 0);
&gt; 
&gt; Perhaps that code is out of date?

That code is certainly out of date.  Libc-391.2.7 looks to come from Mac OS X 10.4.x.  The version I was looking at is basically identical to what’s in current FreeBSD (&lt;http://svn.freebsd.org/base/head/lib/libc/gen/arc4random.c&gt;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>350255</commentid>
    <comment_count>6</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2011-02-12 02:52:30 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; For our purposes, the non-blocking nature of /dev/urandom is helpful (otherwise the browser will hang).  We&apos;re already re-using our entropy pool with RC4, so the net result is essentially the same.

If you’re convinced it’s good enough then that’s fine with me.  It’s obviously makes no difference on Mac OS X which we use as both /dev/urandom and /dev/random are backed by the same device.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>350306</commentid>
    <comment_count>7</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2011-02-12 13:34:02 -0800</bug_when>
    <thetext>The commit-queue encountered the following flaky tests while processing attachment 82115:

http/tests/websocket/tests/handshake-challenge-randomness.html bug 53738 (author: abarth@webkit.org)
The commit-queue is continuing to process your patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>350307</commentid>
    <comment_count>8</comment_count>
      <attachid>82115</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2011-02-12 13:35:40 -0800</bug_when>
    <thetext>Comment on attachment 82115
Patch

Clearing flags on attachment: 82115

Committed r78421: &lt;http://trac.webkit.org/changeset/78421&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>350308</commentid>
    <comment_count>9</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2011-02-12 13:35:45 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>350323</commentid>
    <comment_count>10</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2011-02-12 15:05:35 -0800</bug_when>
    <thetext>The commit-queue encountered the following flaky tests while processing attachment 82115:

http/tests/websocket/tests/multiple-connections.html bug 53825 (author: abarth@webkit.org)
The commit-queue is continuing to process your patch.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>82115</attachid>
            <date>2011-02-11 01:47:26 -0800</date>
            <delta_ts>2011-02-12 13:35:40 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-54279-20110211014725.patch</filename>
            <type>text/plain</type>
            <size>3107</size>
            <attacher name="Adam Barth">abarth</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gNzgzMjUpCisrKyBTb3VyY2Uv
SmF2YVNjcmlwdENvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBAIC0xLDMgKzEsMTggQEAK
KzIwMTEtMDItMTEgIEFkYW0gQmFydGggIDxhYmFydGhAd2Via2l0Lm9yZz4KKworICAgICAgICBS
ZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAgICBVc2UgL2Rldi91cmFuZG9tIGFz
IHRoZSBPU1JhbmRvbVNvdXJjZSBvbiBPUyhEQVJXSU4pCisgICAgICAgIGh0dHBzOi8vYnVncy53
ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD01NDI3OQorCisgICAgICAgIEknbSBub3Qgc3VyZSBp
dCBtYWtlcyBtdWNoIG9mIGEgZGlmZmVyZW5jZSB3aGV0aGVyIHdlI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9TWVNURU1fTUFMTE9DIDEKICNlbmRpZgogCi0jaWYgT1MoREFSV0lOKSB8fCBPUyhVTklYKSB8
fCBPUyhXSU5ET1dTKQorI2lmIE9TKFVOSVgpIHx8IE9TKFdJTkRPV1MpCiAjZGVmaW5lIFdURl9V
U0VfT1NfUkFORE9NTkVTUyAxCiAjZW5kaWYKIAo=
</data>

          </attachment>
      

    </bug>

</bugzilla>