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

Issue 10384140: Use system crypto in pref-pane IsPinValid() (Closed)

Created:
8 years, 7 months ago by Lambros
Modified:
8 years, 7 months ago
Reviewers:
Wez, Ryan Sleevi, Jamie, dcaiafa
CC:
chromium-reviews, jamiewalch+watch_chromium.org, dcaiafa+watch_chromium.org, simonmorris+watch_chromium.org, hclam+watch_chromium.org, wez+watch_chromium.org, amit, sanjeevr, garykac+watch_chromium.org, lambroslambrou+watch_chromium.org, alexeypa+watch_chromium.org, sergeyu+watch_chromium.org
Visibility:
Public.

Description

Use system crypto in pref-pane IsPinValid() Use system-provided HMAC library to remove dependency of Mac pref-pane on Chrome crypto code. This is to enable the pref-pane to be built as a Mac universal binary, even though Chrome code is only built for 32-bit on Mac OS X. Linking to individual files in base/ is not feasible, since any calls to the logging facility cause many files to be pulled in as dependencies, creating a burden for any maintainers of those files. So we prefer to avoid using base/ entirely, until Chrome supports building for 64-bit on Mac OS X. BUG=125116 TEST=manual Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=137278

Patch Set 1 #

Total comments: 4

Patch Set 2 : Use CC_SHA256_DIGEST_LENGTH #

Total comments: 3

Patch Set 3 : Add TODO comment to IsPinValid() #

Patch Set 4 : Fix DEPS #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -8 lines) Patch
M remoting/host/DEPS View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M remoting/host/me2me_preference_pane.mm View 1 2 3 chunks +36 lines, -8 lines 8 comments Download

Messages

Total messages: 16 (0 generated)
Lambros
8 years, 7 months ago (2012-05-12 01:52:24 UTC) #1
dcaiafa
drive-by. http://codereview.chromium.org/10384140/diff/1/remoting/host/me2me_preference_pane.mm File remoting/host/me2me_preference_pane.mm (right): http://codereview.chromium.org/10384140/diff/1/remoting/host/me2me_preference_pane.mm#newcode80 remoting/host/me2me_preference_pane.mm:80: computed_hash.resize(32); s/32/CC_SHA256_DIGEST_LENGTH/
8 years, 7 months ago (2012-05-14 15:04:43 UTC) #2
Wez
Can you briefly elaborate on why we want to break that dependency? Does it trigger ...
8 years, 7 months ago (2012-05-14 16:42:52 UTC) #3
Jamie
http://codereview.chromium.org/10384140/diff/1/remoting/host/me2me_preference_pane.mm File remoting/host/me2me_preference_pane.mm (left): http://codereview.chromium.org/10384140/diff/1/remoting/host/me2me_preference_pane.mm#oldcode54 remoting/host/me2me_preference_pane.mm:54: remoting::protocol::SharedSecretHash hash; Would it be possible to define a ...
8 years, 7 months ago (2012-05-14 17:37:49 UTC) #4
Lambros
On 2012/05/14 16:42:52, Wez wrote: > Can you briefly elaborate on why we want to ...
8 years, 7 months ago (2012-05-14 17:43:25 UTC) #5
Lambros
http://codereview.chromium.org/10384140/diff/1/remoting/host/me2me_preference_pane.mm File remoting/host/me2me_preference_pane.mm (left): http://codereview.chromium.org/10384140/diff/1/remoting/host/me2me_preference_pane.mm#oldcode54 remoting/host/me2me_preference_pane.mm:54: remoting::protocol::SharedSecretHash hash; On 2012/05/14 17:37:49, Jamie wrote: > Would ...
8 years, 7 months ago (2012-05-14 19:58:33 UTC) #6
Wez
On 2012/05/14 17:43:25, Lambros wrote: > On 2012/05/14 16:42:52, Wez wrote: > > Can you ...
8 years, 7 months ago (2012-05-14 20:02:11 UTC) #7
Lambros
On 2012/05/14 20:02:11, Wez wrote: > On 2012/05/14 17:43:25, Lambros wrote: > > On 2012/05/14 ...
8 years, 7 months ago (2012-05-14 20:35:42 UTC) #8
Jamie
lgtm, but I'm not an expert on HMAC. If the code here is pretty much ...
8 years, 7 months ago (2012-05-14 20:59:34 UTC) #9
Lambros
http://codereview.chromium.org/10384140/diff/5002/remoting/host/me2me_preference_pane.mm File remoting/host/me2me_preference_pane.mm (right): http://codereview.chromium.org/10384140/diff/5002/remoting/host/me2me_preference_pane.mm#newcode61 remoting/host/me2me_preference_pane.mm:61: LOG(ERROR) << "Authentication method '" << method << "' ...
8 years, 7 months ago (2012-05-15 01:08:33 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/lambroslambrou@chromium.org/10384140/4002
8 years, 7 months ago (2012-05-15 21:00:59 UTC) #11
commit-bot: I haz the power
Change committed as 137278
8 years, 7 months ago (2012-05-15 22:49:02 UTC) #12
Ryan Sleevi
https://chromiumcodereview.appspot.com/10384140/diff/4002/remoting/host/me2me_preference_pane.mm File remoting/host/me2me_preference_pane.mm (right): https://chromiumcodereview.appspot.com/10384140/diff/4002/remoting/host/me2me_preference_pane.mm#newcode73 remoting/host/me2me_preference_pane.mm:73: hash.resize(modp_b64_decode_len(hash_base64_size)); Security? You don't check if hash.empty() before attempting ...
8 years, 7 months ago (2012-05-16 03:10:34 UTC) #13
Lambros
https://chromiumcodereview.appspot.com/10384140/diff/4002/remoting/host/me2me_preference_pane.mm File remoting/host/me2me_preference_pane.mm (right): https://chromiumcodereview.appspot.com/10384140/diff/4002/remoting/host/me2me_preference_pane.mm#newcode73 remoting/host/me2me_preference_pane.mm:73: hash.resize(modp_b64_decode_len(hash_base64_size)); On 2012/05/16 03:10:34, Ryan Sleevi wrote: > Security? ...
8 years, 7 months ago (2012-05-16 18:48:56 UTC) #14
Ryan Sleevi
https://chromiumcodereview.appspot.com/10384140/diff/4002/remoting/host/me2me_preference_pane.mm File remoting/host/me2me_preference_pane.mm (right): https://chromiumcodereview.appspot.com/10384140/diff/4002/remoting/host/me2me_preference_pane.mm#newcode73 remoting/host/me2me_preference_pane.mm:73: hash.resize(modp_b64_decode_len(hash_base64_size)); On 2012/05/16 18:48:57, Lambros wrote: > On 2012/05/16 ...
8 years, 7 months ago (2012-05-16 19:26:14 UTC) #15
Wez
8 years, 7 months ago (2012-05-16 20:09:26 UTC) #16
https://chromiumcodereview.appspot.com/10384140/diff/4002/remoting/host/me2me...
File remoting/host/me2me_preference_pane.mm (right):

https://chromiumcodereview.appspot.com/10384140/diff/4002/remoting/host/me2me...
remoting/host/me2me_preference_pane.mm:73:
hash.resize(modp_b64_decode_len(hash_base64_size));
On 2012/05/16 19:26:14, Ryan Sleevi wrote:
> On 2012/05/16 18:48:57, Lambros wrote:
> > On 2012/05/16 03:10:34, Ryan Sleevi wrote:
> > > Security? You don't check if hash.empty() before attempting to do
&hash[0].
> As
> > > far as STL goes, this is undefined, and typically debug STLs will assert
> here,
> > > to prevent scribbling into memory you don't own.
> > Ah, good point!  I lifted this from base/base64.cc, and it looks like that
> might
> > have the same problem.  Does that need patching as well?
> 
> Ah, looks like modp_b64_decode_len will always return at least 1, so short of
> overflow issues, this should be fine. Subtle, but fine :)

Sufficiently subtle that a short comment to explain the fact is probably
advisable. :)

https://chromiumcodereview.appspot.com/10384140/diff/4002/remoting/host/me2me...
remoting/host/me2me_preference_pane.mm:90: return computed_hash == hash;
On 2012/05/16 19:26:14, Ryan Sleevi wrote:
> On 2012/05/16 18:48:57, Lambros wrote:
> > On 2012/05/16 03:10:34, Ryan Sleevi wrote:
> > > Security? This is not a constant time comparison, as implemented by
crypto/,
> > and
> > > thus leaks timing information.
> > > 
> > > Please see the referenced information in crypto/ about why this is
generally
> > > bad.
> > Thanks.  At the moment, the hash is already readable for the user supplying
> > input to this routine, so I don't know if a constant-time operation gains us
> > anything here?  I'll see if I can improve this anyway.
> 
> Nope, should be fine then.

Again, as discussed offline, a short comment to explain why this is OK would
help keep reviewers happy!

Powered by Google App Engine
This is Rietveld 408576698