]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/x509: SystemRootsError style tweaks, document in Verify
authorBrad Fitzpatrick <bradfitz@golang.org>
Sat, 16 Aug 2014 00:47:02 +0000 (17:47 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sat, 16 Aug 2014 00:47:02 +0000 (17:47 -0700)
In retrospect this should've been a variable instead of a type,
but oh well.

LGTM=agl
R=agl
CC=golang-codereviews
https://golang.org/cl/129250044

src/pkg/crypto/x509/verify.go

index 5fd8e371747d85dc6fb2fb838b8e8e3b17f763b7..ec1981423dba5af2c535bfd6199010bc7c8c63a8 100644 (file)
@@ -116,10 +116,9 @@ func (e UnknownAuthorityError) Error() string {
 }
 
 // SystemRootsError results when we fail to load the system root certificates.
-type SystemRootsError struct {
-}
+type SystemRootsError struct{}
 
-func (SystemRootsError) Error() string {
+func (SystemRootsError) Error() string {
        return "x509: failed to load system roots and no roots provided"
 }
 
@@ -206,6 +205,9 @@ func (c *Certificate) isValid(certType int, currentChain []*Certificate, opts *V
 // needed. If successful, it returns one or more chains where the first
 // element of the chain is c and the last element is from opts.Roots.
 //
+// If opts.Roots is nil and system roots are unavailable the returned error
+// will be of type SystemRootsError.
+//
 // WARNING: this doesn't do any revocation checking.
 func (c *Certificate) Verify(opts VerifyOptions) (chains [][]*Certificate, err error) {
        // Use Windows's own verification and chain building.