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

Issue 463393002: Android Chromoting: Initialize SecureRandom generator. (Closed)

Created:
6 years, 4 months ago by Lambros
Modified:
6 years, 4 months ago
Reviewers:
palmer, kelvinp
CC:
chromium-reviews, chromoting-reviews_chromium.org
Project:
chromium
Visibility:
Public.

Description

Android Chromoting: Initialize SecureRandom generator. BUG=402732 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=289519

Patch Set 1 #

Total comments: 2

Patch Set 2 : Pull initialization code into a reusable class #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+56 lines, -1 line) Patch
A remoting/android/java/src/org/chromium/chromoting/SecureRandomInitializer.java View 1 1 chunk +41 lines, -0 lines 6 comments Download
M remoting/android/java/src/org/chromium/chromoting/ThirdPartyTokenFetcher.java View 1 3 chunks +15 lines, -1 line 2 comments Download

Messages

Total messages: 10 (0 generated)
Lambros
@kelvinp: PTAL @palmer: Do we actually need a secure random generator, given that we're only ...
6 years, 4 months ago (2014-08-13 00:58:29 UTC) #1
kelvinp
https://codereview.chromium.org/463393002/diff/1/remoting/android/java/src/org/chromium/chromoting/ThirdPartyTokenFetcher.java File remoting/android/java/src/org/chromium/chromoting/ThirdPartyTokenFetcher.java (right): https://codereview.chromium.org/463393002/diff/1/remoting/android/java/src/org/chromium/chromoting/ThirdPartyTokenFetcher.java#newcode57 remoting/android/java/src/org/chromium/chromoting/ThirdPartyTokenFetcher.java:57: sSecureRandom.setSeed(getRandomBytes(NUM_RANDOM_BYTES)); As discussed, maybe it is better to move ...
6 years, 4 months ago (2014-08-13 02:33:26 UTC) #2
chromium-reviews
Yes, XSRF tokens should be cryptographically strong. LGTM. But maybe this logic should go in ...
6 years, 4 months ago (2014-08-13 06:23:22 UTC) #3
Lambros
PTAL. I've moved the initialization code into a separate class. This will make it easier ...
6 years, 4 months ago (2014-08-13 23:48:51 UTC) #4
kelvinp
lgtm
6 years, 4 months ago (2014-08-14 00:21:53 UTC) #5
Lambros
The CQ bit was checked by lambroslambrou@chromium.org
6 years, 4 months ago (2014-08-14 01:06:04 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/lambroslambrou@chromium.org/463393002/20001
6 years, 4 months ago (2014-08-14 01:11:47 UTC) #7
commit-bot: I haz the power
Committed patchset #2 (20001) as 289519
6 years, 4 months ago (2014-08-14 11:02:03 UTC) #8
palmer
https://codereview.chromium.org/463393002/diff/20001/remoting/android/java/src/org/chromium/chromoting/SecureRandomInitializer.java File remoting/android/java/src/org/chromium/chromoting/SecureRandomInitializer.java (right): https://codereview.chromium.org/463393002/diff/20001/remoting/android/java/src/org/chromium/chromoting/SecureRandomInitializer.java#newcode5 remoting/android/java/src/org/chromium/chromoting/SecureRandomInitializer.java:5: package org.chromium.chromoting; Is there some more general place we ...
6 years, 4 months ago (2014-08-18 17:47:52 UTC) #9
Lambros
6 years, 4 months ago (2014-08-18 20:31:31 UTC) #10
Message was sent while issue was closed.
Thanks @Palmer for the comments. I'm going away for 3 weeks so I'll take another
look when I get back (if someone else hasn't moved it already!)

https://codereview.chromium.org/463393002/diff/20001/remoting/android/java/sr...
File
remoting/android/java/src/org/chromium/chromoting/SecureRandomInitializer.java
(right):

https://codereview.chromium.org/463393002/diff/20001/remoting/android/java/sr...
remoting/android/java/src/org/chromium/chromoting/SecureRandomInitializer.java:5:
package org.chromium.chromoting;
On 2014/08/18 17:47:52, Chromium Palmer wrote:
> Is there some more general place we can put this so that all the code can use
> it?

Probably base/android, to be accessible to our app. We don't use content/ or
chrome/. We do use net/ and ui/ but this code probably doesn't belong there.

https://codereview.chromium.org/463393002/diff/20001/remoting/android/java/sr...
remoting/android/java/src/org/chromium/chromoting/SecureRandomInitializer.java:23:
FileInputStream fis = null;
On 2014/08/18 17:47:52, Chromium Palmer wrote:
> Nit: Reference types are always initialized to null by default.

Acknowledged.

https://codereview.chromium.org/463393002/diff/20001/remoting/android/java/sr...
remoting/android/java/src/org/chromium/chromoting/SecureRandomInitializer.java:26:
byte[] bytes = new byte[NUM_RANDOM_BYTES];
On 2014/08/18 17:47:52, Chromium Palmer wrote:
> Nit: You could optimize a bit by making the array be a field in this class,
> rather than allocating on each call.

Acknowledged.

https://codereview.chromium.org/463393002/diff/20001/remoting/android/java/sr...
File
remoting/android/java/src/org/chromium/chromoting/ThirdPartyTokenFetcher.java
(right):

https://codereview.chromium.org/463393002/diff/20001/remoting/android/java/sr...
remoting/android/java/src/org/chromium/chromoting/ThirdPartyTokenFetcher.java:52:
SecureRandomInitializer.initialize(sSecureRandom);
On 2014/08/18 17:47:52, Chromium Palmer wrote:
> I almost wonder if the interface should instead be:
> 
>     sSecureRandom = SecureRandomInitializer.getInstance();

I thought about that, but there are a lot of SecureRandom ctors and factory
methods to override. I'm open to persuasion though - maybe there should be One
True Way for all of Chromium code to get a SecureRandom object?

Powered by Google App Engine
This is Rietveld 408576698