Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(297)

Issue 5700087: code review 5700087: crypto/x509: new home for root fetchers; build chains u... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 2 months ago by mkrautz
Modified:
13 years, 2 months ago
Reviewers:
CC:
agl1, golang-dev, brainman, rsc, mikkel_krautz.dk
Visibility:
Public.

Description

crypto/x509: new home for root fetchers; build chains using Windows API This moves the various CA root fetchers from crypto/tls into crypto/x509. The move was brought about by issue 2997. Windows doesn't ship with all its root certificates, but will instead download them as-needed when using CryptoAPI for certificate verification. This CL changes crypto/x509 to verify a certificate using the system root CAs when VerifyOptions.RootCAs == nil. On Windows, this verification is now implemented using Windows's CryptoAPI. All other root fetchers are unchanged, and still use Go's own verification code. The CL also fixes the hostname matching logic in crypto/tls/tls.go, in order to be able to test whether hostname mismatches are honored by the Windows verification code. The move to crypto/x509 also allows other packages to use the OS-provided root certificates, instead of hiding them inside the crypto/tls package. Fixes issue 2997.

Patch Set 1 #

Patch Set 2 : diff -r c4bd8c697c5b https://code.google.com/p/go/ #

Patch Set 3 : diff -r c4bd8c697c5b https://code.google.com/p/go/ #

Total comments: 23

Patch Set 4 : code review 5700087: crypto/x509: new home for root fetchers; build chains u... #

Patch Set 5 : diff -r 30fa4e16a80a https://code.google.com/p/go/ #

Patch Set 6 : diff -r 30fa4e16a80a https://code.google.com/p/go/ #

Patch Set 7 : diff -r 30fa4e16a80a https://code.google.com/p/go/ #

Patch Set 8 : diff -r 30fa4e16a80a https://code.google.com/p/go/ #

Patch Set 9 : diff -r 30fa4e16a80a https://code.google.com/p/go/ #

Patch Set 10 : diff -r 30fa4e16a80a https://code.google.com/p/go/ #

Patch Set 11 : diff -r 30fa4e16a80a https://code.google.com/p/go/ #

Patch Set 12 : diff -r 30fa4e16a80a https://code.google.com/p/go/ #

Patch Set 13 : diff -r 30fa4e16a80a https://code.google.com/p/go/ #

Patch Set 14 : diff -r 30fa4e16a80a https://code.google.com/p/go/ #

Patch Set 15 : diff -r 57e356028f01 https://code.google.com/p/go/ #

Total comments: 7

Patch Set 16 : diff -r 677b60c6d1e7 https://code.google.com/p/go/ #

Patch Set 17 : diff -r 3d22f43c0b98 https://code.google.com/p/go/ #

Patch Set 18 : diff -r 3d22f43c0b98 https://code.google.com/p/go/ #

Patch Set 19 : diff -r 3d22f43c0b98 https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+855 lines, -329 lines) Patch
M src/pkg/crypto/tls/common.go View 1 2 3 4 2 chunks +5 lines, -25 lines 0 comments Download
M src/pkg/crypto/tls/handshake_client.go View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/crypto/tls/root_test.go View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +31 lines, -6 lines 0 comments Download
M src/pkg/crypto/tls/tls.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +3 lines, -1 line 0 comments Download
A src/pkg/crypto/x509/root.go View 1 2 3 4 1 chunk +17 lines, -0 lines 0 comments Download
A src/pkg/crypto/x509/root_darwin.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +9 lines, -8 lines 0 comments Download
A src/pkg/crypto/x509/root_stub.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +7 lines, -2 lines 0 comments Download
A src/pkg/crypto/x509/root_unix.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +10 lines, -8 lines 0 comments Download
A src/pkg/crypto/x509/root_windows.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +173 lines, -27 lines 0 comments Download
M src/pkg/crypto/x509/verify.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +14 lines, -2 lines 0 comments Download
M src/pkg/crypto/x509/verify_test.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 7 chunks +34 lines, -19 lines 0 comments Download
M src/pkg/syscall/syscall_windows.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +7 lines, -0 lines 0 comments Download
M src/pkg/syscall/zsyscall_windows_386.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 4 chunks +201 lines, -115 lines 0 comments Download
M src/pkg/syscall/zsyscall_windows_amd64.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 4 chunks +201 lines, -115 lines 0 comments Download
M src/pkg/syscall/ztypes_windows.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +142 lines, -0 lines 0 comments Download

Messages

Total messages: 29
mkrautz
Hello agl@golang.org, brainman@gmail.com, golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go/
13 years, 2 months ago (2012-02-28 00:10:35 UTC) #1
mkrautz
On 2012/02/28 00:10:35, mkrautz wrote: > Hello mailto:agl@golang.org, mailto:brainman@gmail.com, mailto:golang-dev@googlegroups.com (cc: > mailto:golang-dev@googlegroups.com), > > ...
13 years, 2 months ago (2012-02-28 00:12:03 UTC) #2
agl1
I'll have to leave the Windows specific stuff to someone else, but the x509 stuff ...
13 years, 2 months ago (2012-02-28 00:51:16 UTC) #3
mkrautz
On 2012/02/28 00:51:16, agl1 wrote: > I'll have to leave the Windows specific stuff to ...
13 years, 2 months ago (2012-02-28 01:02:51 UTC) #4
agl1
On 2012/02/28 01:02:51, mkrautz wrote: > roots != nil && roots == systemRoots && runtime.GOOS() ...
13 years, 2 months ago (2012-02-28 01:08:29 UTC) #5
brainman
It is much cleaner this way. Alex http://codereview.appspot.com/5700087/diff/5001/src/pkg/crypto/x509/root_windows.go File src/pkg/crypto/x509/root_windows.go (right): http://codereview.appspot.com/5700087/diff/5001/src/pkg/crypto/x509/root_windows.go#newcode23 src/pkg/crypto/x509/root_windows.go:23: para.RequestedUsage.Usage.UsageIdentifier = ...
13 years, 2 months ago (2012-02-28 05:17:07 UTC) #6
rsc
This is an enormous change to be making right now. Is there a more limited ...
13 years, 2 months ago (2012-02-28 17:20:16 UTC) #7
mkrautz
On 2012/02/28 17:20:16, rsc wrote: > This is an enormous change to be making right ...
13 years, 2 months ago (2012-02-28 17:22:23 UTC) #8
agl1
On Tue, Feb 28, 2012 at 9:20 AM, Russ Cox <rsc@golang.org> wrote: > This is ...
13 years, 2 months ago (2012-02-28 17:24:44 UTC) #9
rsc
Do the changes here modify or delete any APIs? One thing that I liked about ...
13 years, 2 months ago (2012-02-28 18:36:26 UTC) #10
mkrautz
On 2012/02/28 18:36:26, rsc wrote: > Do the changes here modify or delete any APIs? ...
13 years, 2 months ago (2012-02-29 17:24:13 UTC) #11
mkrautz
On 2012/02/28 00:51:16, agl1 wrote: > I'll have to leave the Windows specific stuff to ...
13 years, 2 months ago (2012-02-29 17:57:44 UTC) #12
agl1
On 2012/02/29 17:57:44, mkrautz wrote: > Am I correct in assuming that *Certificate.Verify() > is ...
13 years, 2 months ago (2012-03-02 16:22:27 UTC) #13
mkrautz
On 2012/03/02 16:22:27, agl1 wrote: > On 2012/02/29 17:57:44, mkrautz wrote: > > Am I ...
13 years, 2 months ago (2012-03-02 17:29:58 UTC) #14
agl1
On Fri, Mar 2, 2012 at 9:29 AM, <krautz@gmail.com> wrote: > No, I simply meant ...
13 years, 2 months ago (2012-03-02 17:57:47 UTC) #15
mkrautz
On 2012/03/02 17:57:47, agl1 wrote: > On Fri, Mar 2, 2012 at 9:29 AM, <mailto:krautz@gmail.com> ...
13 years, 2 months ago (2012-03-02 18:06:49 UTC) #16
mkrautz
PTAL. I got rid of x509.SystemRoots() and instead use VerifyOptions.RootCAs == nil to mean 'verify ...
13 years, 2 months ago (2012-03-03 00:14:13 UTC) #17
mkrautz
PTAL. Stumbled upon a few issues in root_darwin.go and root_stub.go in the last one I ...
13 years, 2 months ago (2012-03-03 12:19:27 UTC) #18
brainman
LGTM Leaving for others to make final call. Alex
13 years, 2 months ago (2012-03-05 02:00:52 UTC) #19
rsc
This seems okay to me, but please update the CL so that the moved files ...
13 years, 2 months ago (2012-03-05 21:31:49 UTC) #20
mkrautz
PTAL. On 2012/03/05 21:31:49, rsc wrote: > This seems okay to me, but please update ...
13 years, 2 months ago (2012-03-05 22:16:23 UTC) #21
agl1
I've sent out http://codereview.appspot.com/5753060/ to alter the deps to allow this to land. http://codereview.appspot.com/5700087/diff/26002/src/pkg/crypto/x509/verify_test.go File ...
13 years, 2 months ago (2012-03-06 18:11:20 UTC) #22
rsc
LGTM The per-file diffs don't seem to be working but 'view raw patch set' seems ...
13 years, 2 months ago (2012-03-06 18:19:10 UTC) #23
mkrautz
PTAL http://codereview.appspot.com/5700087/diff/26002/src/pkg/crypto/x509/verify_test.go File src/pkg/crypto/x509/verify_test.go (right): http://codereview.appspot.com/5700087/diff/26002/src/pkg/crypto/x509/verify_test.go#newcode109 src/pkg/crypto/x509/verify_test.go:109: // can only return a single chain to ...
13 years, 2 months ago (2012-03-06 19:11:07 UTC) #24
mikkel_krautz.dk
On Tue, Mar 6, 2012 at 7:19 PM, Russ Cox <rsc@golang.org> wrote: > LGTM > ...
13 years, 2 months ago (2012-03-06 19:14:53 UTC) #25
agl1
http://codereview.appspot.com/5700087/diff/26002/src/pkg/crypto/x509/verify_test.go File src/pkg/crypto/x509/verify_test.go (right): http://codereview.appspot.com/5700087/diff/26002/src/pkg/crypto/x509/verify_test.go#newcode236 src/pkg/crypto/x509/verify_test.go:236: Intermediates: nil, On 2012/03/06 19:11:07, mkrautz wrote: > The ...
13 years, 2 months ago (2012-03-06 20:31:31 UTC) #26
rsc
On Tue, Mar 6, 2012 at 14:14, Mikkel Krautz <mikkel@krautz.dk> wrote: > Yeah, I made ...
13 years, 2 months ago (2012-03-06 20:32:52 UTC) #27
mkrautz
PTAL. Now honors opts.Intermediates in the Windows system verification code.
13 years, 2 months ago (2012-03-07 00:10:25 UTC) #28
agl1
13 years, 2 months ago (2012-03-07 18:12:52 UTC) #29
*** Submitted as http://code.google.com/p/go/source/detail?r=cab9aee7fb70 ***

crypto/x509: new home for root fetchers; build chains using Windows API

This moves the various CA root fetchers from crypto/tls into crypto/x509.

The move was brought about by issue 2997. Windows doesn't ship with all
its root certificates, but will instead download them as-needed when using
CryptoAPI for certificate verification.

This CL changes crypto/x509 to verify a certificate using the system root
CAs when VerifyOptions.RootCAs == nil. On Windows, this verification is
now implemented using Windows's CryptoAPI. All other root fetchers are
unchanged, and still use Go's own verification code.

The CL also fixes the hostname matching logic in crypto/tls/tls.go, in
order to be able to test whether hostname mismatches are honored by the
Windows verification code.

The move to crypto/x509 also allows other packages to use the OS-provided
root certificates, instead of hiding them inside the crypto/tls package.

Fixes issue 2997.

R=agl, golang-dev, alex.brainman, rsc, mikkel
CC=golang-dev
http://codereview.appspot.com/5700087

Committer: Adam Langley <agl@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b