github.com/geraldss/go/src@v0.0.0-20210511222824-ac7d0ebfc235/crypto/x509/root_omit.go (about)

     1  // Copyright 2020 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build darwin,arm64 darwin,amd64,ios
     6  // +build x509omitbundledroots
     7  
     8  // This file provides the loadSystemRoots func when the
     9  // "x509omitbundledroots" build tag has disabled bundling a copy,
    10  // which currently on happens on darwin/arm64 (root_darwin_arm64.go).
    11  // This then saves 256 KiB of binary size and another 560 KiB of
    12  // runtime memory size retaining the parsed roots forever. Constrained
    13  // environments can construct minimal x509 root CertPools on the fly
    14  // in the crypto/tls.Config.VerifyPeerCertificate hook.
    15  
    16  package x509
    17  
    18  import "errors"
    19  
    20  func loadSystemRoots() (*CertPool, error) {
    21  	return nil, errors.New("x509: system root bundling disabled")
    22  }
    23  
    24  func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
    25  	return nil, nil
    26  }