github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/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  //go:build ((darwin && arm64) || (darwin && amd64 && ios)) && x509omitbundledroots
     6  // +build darwin,arm64 darwin,amd64,ios
     7  // +build x509omitbundledroots
     8  
     9  // This file provides the loadSystemRoots func when the
    10  // "x509omitbundledroots" build tag has disabled bundling a copy,
    11  // which currently on happens on darwin/arm64 (root_darwin_arm64.go).
    12  // This then saves 256 KiB of binary size and another 560 KiB of
    13  // runtime memory size retaining the parsed roots forever. Constrained
    14  // environments can construct minimal x509 root CertPools on the fly
    15  // in the crypto/tls.Config.VerifyPeerCertificate hook.
    16  
    17  package x509
    18  
    19  import "errors"
    20  
    21  func loadSystemRoots() (*CertPool, error) {
    22  	return nil, errors.New("x509: system root bundling disabled")
    23  }
    24  
    25  func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
    26  	return nil, nil
    27  }