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

Issue 412263003: Add SHA-256 fingerprint functions to x509 certs. (Closed)

Created:
6 years, 5 months ago by jww
Modified:
6 years, 4 months ago
Reviewers:
wtc, Ryan Sleevi
CC:
chromium-reviews, cbentzel+watch_chromium.org
Project:
chromium
Visibility:
Public.

Description

Add SHA-256 fingerprint functions to x509 certs. Previously, the x509 cert implementation only had SHA-1 based fingerprinting for quickly creating indexing appropriate hashes. Since SHA-1 is likely cryptographically broken, these fingerprints should not be used for any security decisions. This adds slow SHA-256 fingerprint support for when fingerprints are needed for security decisions. R=rsleevi@chromium.org BUG=262615 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=285851

Patch Set 1 #

Patch Set 2 : Add comment to CalculateCAFingerprint256 #

Total comments: 5

Patch Set 3 : sleevi nit fix #

Patch Set 4 : Small fix from trybot failures #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+131 lines, -0 lines) Patch
M net/cert/x509_certificate.h View 1 2 1 chunk +24 lines, -0 lines 6 comments Download
M net/cert/x509_certificate.cc View 1 2 3 3 chunks +33 lines, -0 lines 2 comments Download
M net/cert/x509_certificate_unittest.cc View 1 2 1 chunk +74 lines, -0 lines 2 comments Download

Messages

Total messages: 20 (0 generated)
jww
Ryan, this is the CL we discussed adding SHA-256 fingerprints.
6 years, 5 months ago (2014-07-24 20:56:43 UTC) #1
jww
On 2014/07/24 20:56:43, jww wrote: > Ryan, this is the CL we discussed adding SHA-256 ...
6 years, 5 months ago (2014-07-24 22:24:03 UTC) #2
Ryan Sleevi
https://codereview.chromium.org/412263003/diff/20001/net/cert/x509_certificate.cc File net/cert/x509_certificate.cc (right): https://codereview.chromium.org/412263003/diff/20001/net/cert/x509_certificate.cc#newcode721 net/cert/x509_certificate.cc:721: if (!GetDEREncoded(intermediates[i], &der_encoded)) The only benefit to the platform ...
6 years, 5 months ago (2014-07-25 00:21:34 UTC) #3
jww
On 2014/07/25 00:21:34, Ryan Sleevi wrote: > https://codereview.chromium.org/412263003/diff/20001/net/cert/x509_certificate.cc > File net/cert/x509_certificate.cc (right): > > https://codereview.chromium.org/412263003/diff/20001/net/cert/x509_certificate.cc#newcode721 ...
6 years, 5 months ago (2014-07-25 00:25:22 UTC) #4
Ryan Sleevi
On 2014/07/25 00:25:22, jww wrote: > On 2014/07/25 00:21:34, Ryan Sleevi wrote: > > > ...
6 years, 5 months ago (2014-07-25 00:40:12 UTC) #5
wtc
Review comments on patch set 2: https://codereview.chromium.org/412263003/diff/20001/net/cert/x509_certificate.cc File net/cert/x509_certificate.cc (right): https://codereview.chromium.org/412263003/diff/20001/net/cert/x509_certificate.cc#newcode711 net/cert/x509_certificate.cc:711: SHA256HashValue X509Certificate::CalculateCAFingerprint256( You ...
6 years, 5 months ago (2014-07-26 01:25:12 UTC) #6
jww
https://codereview.chromium.org/412263003/diff/20001/net/cert/x509_certificate.cc File net/cert/x509_certificate.cc (right): https://codereview.chromium.org/412263003/diff/20001/net/cert/x509_certificate.cc#newcode711 net/cert/x509_certificate.cc:711: SHA256HashValue X509Certificate::CalculateCAFingerprint256( On 2014/07/26 01:25:12, wtc wrote: > > ...
6 years, 5 months ago (2014-07-26 01:30:47 UTC) #7
Ryan Sleevi
On 2014/07/26 01:30:47, jww wrote: > https://codereview.chromium.org/412263003/diff/20001/net/cert/x509_certificate.cc > File net/cert/x509_certificate.cc (right): > > https://codereview.chromium.org/412263003/diff/20001/net/cert/x509_certificate.cc#newcode711 > ...
6 years, 5 months ago (2014-07-26 01:54:56 UTC) #8
Ryan Sleevi
LGTM (keeping it here in //net) Sorry for the many reviewers. I'll take it on ...
6 years, 5 months ago (2014-07-26 01:56:22 UTC) #9
jww
https://codereview.chromium.org/412263003/diff/20001/net/cert/x509_certificate.h File net/cert/x509_certificate.h (right): https://codereview.chromium.org/412263003/diff/20001/net/cert/x509_certificate.h#newcode419 net/cert/x509_certificate.h:419: static SHA256HashValue CalculateFullChainFingerprint256( On 2014/07/26 01:56:21, Ryan Sleevi wrote: ...
6 years, 5 months ago (2014-07-26 02:33:25 UTC) #10
jww
The CQ bit was checked by jww@chromium.org
6 years, 5 months ago (2014-07-26 02:33:28 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jww@chromium.org/412263003/40001
6 years, 5 months ago (2014-07-26 05:00:33 UTC) #12
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_gpu on tryserver.chromium.gpu ...
6 years, 5 months ago (2014-07-26 11:08:19 UTC) #13
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 5 months ago (2014-07-26 11:13:43 UTC) #14
commit-bot: I haz the power
Try jobs failed on following builders: win8_chromium_rel on tryserver.chromium.win (http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_rel/builds/71)
6 years, 5 months ago (2014-07-26 11:13:43 UTC) #15
jww
The CQ bit was checked by jww@chromium.org
6 years, 4 months ago (2014-07-27 16:33:20 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jww@chromium.org/412263003/60001
6 years, 4 months ago (2014-07-27 16:34:14 UTC) #17
commit-bot: I haz the power
Change committed as 285851
6 years, 4 months ago (2014-07-28 00:28:02 UTC) #18
wtc
Review comments on patch set 4: 1. These SHA-256 fingerprint functions don't seem to belong ...
6 years, 4 months ago (2014-07-28 17:29:52 UTC) #19
jww
6 years, 4 months ago (2014-07-28 18:36:14 UTC) #20
Message was sent while issue was closed.
I've uploaded a new CL to address the nits:
https://codereview.chromium.org/421243003/

I explicitly didn't change anything regarding the two higher level points as I
think they probably need more discussion, which we should probably have on the
new CL. I'll respond on them there.

https://codereview.chromium.org/412263003/diff/60001/net/cert/x509_certificat...
File net/cert/x509_certificate.cc (right):

https://codereview.chromium.org/412263003/diff/60001/net/cert/x509_certificat...
net/cert/x509_certificate.cc:723: hash->Update(der_encoded.c_str(),
der_encoded.length());
On 2014/07/28 17:29:52, wtc wrote:
> 
> Nit: use data() instead of c_str() because we don't need a C string here.

Done.

https://codereview.chromium.org/412263003/diff/60001/net/cert/x509_certificate.h
File net/cert/x509_certificate.h (right):

https://codereview.chromium.org/412263003/diff/60001/net/cert/x509_certificat...
net/cert/x509_certificate.h:408: // The implementation currently relies on the
crypto::SecureHash utilities,
On 2014/07/28 17:29:52, wtc wrote:
> 
> Nit: it seems that the performance issue is caused by the need to copy the
> certificate bytes into local variables, rather than the use of
> crypto::SecureHash.

Done.

https://codereview.chromium.org/412263003/diff/60001/net/cert/x509_certificat...
net/cert/x509_certificate.h:419: static SHA256HashValue
CalculateChainFingerprint256(
On 2014/07/28 17:29:52, wtc wrote:
> 
> For a minimal API, this method can be subsumed by the previous method, and the
> previous method can be renamed to avoid reference to CA certificates, for
> example,
> 
>   static SHA256HashValue CalculateCertArrayFingerprint256(
>       const OSCertHandles& cert_handles);
> 
> or
> 
>   static SHA256HashValue CalculateOSCertListFingerprint256(
>       const OSCertHandles& cert_handles);

This would make it inconsistent with the SHA1 API, so I'll let you and rsleevi
duke it out on the new CL :-)

https://codereview.chromium.org/412263003/diff/60001/net/cert/x509_certificat...
net/cert/x509_certificate.h:420: const OSCertHandle& leaf,
On 2014/07/28 17:29:52, wtc wrote:
> 
> Please pass a single OSCertHandle by value. It is a (platform-dependent)
pointer
> type.

Done.

https://codereview.chromium.org/412263003/diff/60001/net/cert/x509_certificat...
File net/cert/x509_certificate_unittest.cc (right):

https://codereview.chromium.org/412263003/diff/60001/net/cert/x509_certificat...
net/cert/x509_certificate_unittest.cc:416: static const uint8
cert_chain1_full_chain_fingerprint_256[32] = {
On 2014/07/28 17:29:52, wtc wrote:
> 
> Nit: since you renamed the CalculateFullChainFingerprint256 function
> (s/FullChain/Chain), these variable names should also be renamed to match.

Done.

Powered by Google App Engine
This is Rietveld 408576698