Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Issue 109323006: Pool 64 bits of entropy instead of calling OpenSSL's RNG for one bit (Closed)

Created:
7 years ago by ramant (doing other things)
Modified:
7 years ago
Reviewers:
Ryan Hamilton
CC:
chromium-reviews, cbentzel+watch_chromium.org
Visibility:
Public.

Description

Pool 64 bits of entropy instead of calling OpenSSL's RNG for one bit when creating packets. Clean up the entropy bit while I'm at it. Changes: 1. QuicPacketCreator buffers 64 bits of entropy and consumes them one-at-a-time. This should resolve the performance issue. Covered this with a unit test. Removed the RandBool call from QuicRandom. 2. The first packet gets a random entropy bit. We used to never set it because we failed to test it properly. This was sad because the first packet deserves the most protection. 3. The entropy hash computation had a TODO to make it stronger, but I'm convinced the current algorithm is in fact sound. Removed the TODO and tightened up the implementation to avoid an unpredictable branch (no behavior change!) Also covered by the test. 4. Fixed the bugs in QuicConnectionTest that prevented setting the bit in the first packet. Switched tests to properly use MockRandom. Merge internal change: 57908681 R=rch@chromium.org

Patch Set 1 #

Total comments: 3

Patch Set 2 : Deleted the second MockRandom #

Unified diffs Side-by-side diffs Delta from patch set Stats (+121 lines, -55 lines) Patch
M net/quic/crypto/quic_random.h View 1 chunk +0 lines, -3 lines 0 comments Download
M net/quic/crypto/quic_random.cc View 2 chunks +0 lines, -7 lines 0 comments Download
M net/quic/quic_connection_test.cc View 14 chunks +27 lines, -6 lines 0 comments Download
M net/quic/quic_framer.cc View 2 chunks +4 lines, -9 lines 0 comments Download
M net/quic/quic_http_stream_test.cc View 1 3 chunks +3 lines, -3 lines 0 comments Download
M net/quic/quic_network_transaction_unittest.cc View 4 chunks +4 lines, -3 lines 0 comments Download
M net/quic/quic_packet_creator.h View 2 chunks +2 lines, -1 line 0 comments Download
M net/quic/quic_packet_creator.cc View 2 chunks +38 lines, -8 lines 0 comments Download
M net/quic/quic_packet_creator_test.cc View 4 chunks +26 lines, -2 lines 0 comments Download
M net/quic/quic_stream_factory_test.cc View 4 chunks +5 lines, -4 lines 0 comments Download
M net/quic/test_tools/mock_random.h View 2 chunks +4 lines, -3 lines 0 comments Download
M net/quic/test_tools/mock_random.cc View 2 chunks +8 lines, -6 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
ramant (doing other things)
7 years ago (2013-12-12 22:30:33 UTC) #1
Ryan Hamilton
lgtm, modulo one question. https://codereview.chromium.org/109323006/diff/1/net/quic/quic_http_stream_test.cc File net/quic/quic_http_stream_test.cc (right): https://codereview.chromium.org/109323006/diff/1/net/quic/quic_http_stream_test.cc#newcode136 net/quic/quic_http_stream_test.cc:136: random_generator_(0), Do we need 2 ...
7 years ago (2013-12-12 22:43:33 UTC) #2
ramant (doing other things)
https://codereview.chromium.org/109323006/diff/1/net/quic/quic_http_stream_test.cc File net/quic/quic_http_stream_test.cc (right): https://codereview.chromium.org/109323006/diff/1/net/quic/quic_http_stream_test.cc#newcode136 net/quic/quic_http_stream_test.cc:136: random_generator_(0), On 2013/12/12 22:43:33, Ryan Hamilton wrote: > Do ...
7 years ago (2013-12-12 22:53:47 UTC) #3
ramant (doing other things)
https://codereview.chromium.org/109323006/diff/1/net/quic/quic_http_stream_test.cc File net/quic/quic_http_stream_test.cc (right): https://codereview.chromium.org/109323006/diff/1/net/quic/quic_http_stream_test.cc#newcode136 net/quic/quic_http_stream_test.cc:136: random_generator_(0), On 2013/12/12 22:43:33, Ryan Hamilton wrote: > Do ...
7 years ago (2013-12-12 23:00:10 UTC) #4
Ryan Hamilton
7 years ago (2013-12-13 00:40:47 UTC) #5
On 2013/12/12 23:00:10, ramant wrote:
>
https://codereview.chromium.org/109323006/diff/1/net/quic/quic_http_stream_te...
> File net/quic/quic_http_stream_test.cc (right):
> 
>
https://codereview.chromium.org/109323006/diff/1/net/quic/quic_http_stream_te...
> net/quic/quic_http_stream_test.cc:136: random_generator_(0),
> On 2013/12/12 22:43:33, Ryan Hamilton wrote:
> > Do we need 2 MockRandoms?
> 
> I wasn't sure when I did the merge. Tested the code with one MockRandom and
all
> tests have passed. Deleted the public MockRandom. thanks.

lgtm

Powered by Google App Engine
This is Rietveld 408576698