OSDN Git Service

libgo: Update to weekly.2011-12-14.
[pf3gnuchains/gcc-fork.git] / libgo / go / crypto / tls / root_unix.go
1 // Copyright 2011 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 freebsd linux openbsd netbsd
6
7 package tls
8
9 import (
10         "crypto/x509"
11         "io/ioutil"
12 )
13
14 // Possible certificate files; stop after finding one.
15 var certFiles = []string{
16         "/etc/ssl/certs/ca-certificates.crt", // Linux etc
17         "/etc/pki/tls/certs/ca-bundle.crt",   // Fedora/RHEL
18         "/etc/ssl/ca-bundle.pem",             // OpenSUSE
19         "/etc/ssl/cert.pem",                  // OpenBSD
20 }
21
22 func initDefaultRoots() {
23         roots := x509.NewCertPool()
24         for _, file := range certFiles {
25                 data, err := ioutil.ReadFile(file)
26                 if err == nil {
27                         roots.AppendCertsFromPEM(data)
28                         break
29                 }
30         }
31         varDefaultRoots = roots
32 }