From fa5d125b5cfa5c935e46d27a2cbcd71ae37687ac Mon Sep 17 00:00:00 2001 From: ian Date: Wed, 26 Oct 2011 23:57:58 +0000 Subject: Update Go library to last weekly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180552 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/crypto/tls/root_unix.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 libgo/go/crypto/tls/root_unix.go (limited to 'libgo/go/crypto/tls/root_unix.go') diff --git a/libgo/go/crypto/tls/root_unix.go b/libgo/go/crypto/tls/root_unix.go new file mode 100644 index 00000000000..095beec104a --- /dev/null +++ b/libgo/go/crypto/tls/root_unix.go @@ -0,0 +1,29 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package tls + +import ( + "crypto/x509" + "io/ioutil" +) + +// Possible certificate files; stop after finding one. +var certFiles = []string{ + "/etc/ssl/certs/ca-certificates.crt", // Linux etc + "/etc/pki/tls/certs/ca-bundle.crt", // Fedora/RHEL + "/etc/ssl/ca-bundle.pem", // OpenSUSE +} + +func initDefaultRoots() { + roots := x509.NewCertPool() + for _, file := range certFiles { + data, err := ioutil.ReadFile(file) + if err == nil { + roots.AppendCertsFromPEM(data) + break + } + } + varDefaultRoots = roots +} -- cgit v1.2.3