summary refs log tree commit diff
path: root/pkgs/development/compilers/go/ssl-cert-file-1.15.patch
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2020-07-02 17:14:53 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2020-07-02 17:14:53 +0200
commitc33ca7c5ce4d80246fd656dd8a5ab078cc90c03d (patch)
treed1a10ef8a3e8fe00ac12ac1437ec46a856521084 /pkgs/development/compilers/go/ssl-cert-file-1.15.patch
parent798c2d8bc1e947eb26e249b326bfaba49a91b735 (diff)
parent3ee58112693c11cd8157495e09714cf9ddb599b3 (diff)
downloadnixpkgs-c33ca7c5ce4d80246fd656dd8a5ab078cc90c03d.tar
nixpkgs-c33ca7c5ce4d80246fd656dd8a5ab078cc90c03d.tar.gz
nixpkgs-c33ca7c5ce4d80246fd656dd8a5ab078cc90c03d.tar.bz2
nixpkgs-c33ca7c5ce4d80246fd656dd8a5ab078cc90c03d.tar.lz
nixpkgs-c33ca7c5ce4d80246fd656dd8a5ab078cc90c03d.tar.xz
nixpkgs-c33ca7c5ce4d80246fd656dd8a5ab078cc90c03d.tar.zst
nixpkgs-c33ca7c5ce4d80246fd656dd8a5ab078cc90c03d.zip
Merge staging-next into staging
Diffstat (limited to 'pkgs/development/compilers/go/ssl-cert-file-1.15.patch')
-rw-r--r--pkgs/development/compilers/go/ssl-cert-file-1.15.patch76
1 files changed, 76 insertions, 0 deletions
diff --git a/pkgs/development/compilers/go/ssl-cert-file-1.15.patch b/pkgs/development/compilers/go/ssl-cert-file-1.15.patch
new file mode 100644
index 00000000000..cca48eb5705
--- /dev/null
+++ b/pkgs/development/compilers/go/ssl-cert-file-1.15.patch
@@ -0,0 +1,76 @@
+diff --git a/src/crypto/x509/root_darwin_amd64.go b/src/crypto/x509/root_darwin_amd64.go
+index 8ad5a9607d..1d6091cf83 100644
+--- a/src/crypto/x509/root_darwin_amd64.go
++++ b/src/crypto/x509/root_darwin_amd64.go
+@@ -8,6 +8,7 @@ import (
+ 	"bytes"
+ 	"crypto/x509/internal/macOS"
+ 	"fmt"
++	"io/ioutil"
+ 	"os"
+ 	"strings"
+ )
+@@ -23,6 +24,14 @@ func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate
+ var loadSystemRootsWithCgo func() (*CertPool, error)
+ 
+ func loadSystemRoots() (*CertPool, error) {
++	if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
++		data, err := ioutil.ReadFile(file)
++		if err == nil {
++			roots := NewCertPool()
++			roots.AppendCertsFromPEM(data)
++			return roots, nil
++		}
++	}
+ 	var trustedRoots []*Certificate
+ 	untrustedRoots := make(map[string]bool)
+ 
+diff --git a/src/crypto/x509/root_darwin_arm64.go b/src/crypto/x509/root_darwin_arm64.go
+index 2fb079ba66..6a072f3e78 100644
+--- a/src/crypto/x509/root_darwin_arm64.go
++++ b/src/crypto/x509/root_darwin_arm64.go
+@@ -6,6 +6,11 @@
+ 
+ package x509
+ 
++import (
++	"io/ioutil"
++	"os"
++)
++
+ func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
+ 	return nil, nil
+ }
+@@ -14,6 +19,14 @@ func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate
+ var loadSystemRootsWithCgo func() (*CertPool, error)
+ 
+ func loadSystemRoots() (*CertPool, error) {
++	if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
++		data, err := ioutil.ReadFile(file)
++		if err == nil {
++			roots := NewCertPool()
++			roots.AppendCertsFromPEM(data)
++			return roots, nil
++		}
++	}
+ 	p := NewCertPool()
+ 	p.AppendCertsFromPEM([]byte(systemRootsPEM))
+ 	return p, nil
+diff --git a/src/crypto/x509/root_unix.go b/src/crypto/x509/root_unix.go
+index b48e618a65..195c1ff25a 100644
+--- a/src/crypto/x509/root_unix.go
++++ b/src/crypto/x509/root_unix.go
+@@ -42,6 +42,13 @@ func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate
+ 
+ func loadSystemRoots() (*CertPool, error) {
+ 	roots := NewCertPool()
++	if file := os.Getenv("NIX_SSL_CERT_FILE"); file != "" {
++		data, err := ioutil.ReadFile(file)
++		if err == nil {
++			roots.AppendCertsFromPEM(data)
++			return roots, nil
++		}
++	}
+ 
+ 	files := certFiles
+ 	if f := os.Getenv(certFileEnv); f != "" {