mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.boringcrypto] all: merge master into dev.boringcrypto
Change-Id: I61d6a6d4959fdea8339b9d666385bf6b4ed49d03
This commit is contained in:
commit
d85ef2b979
20 changed files with 155 additions and 52 deletions
1
AUTHORS
1
AUTHORS
|
|
@ -563,6 +563,7 @@ Hitoshi Mitake <mitake.hitoshi@gmail.com>
|
|||
Holden Huang <ttyh061@gmail.com>
|
||||
Hong Ruiqi <hongruiqi@gmail.com>
|
||||
Hongfei Tan <feilengcui008@gmail.com>
|
||||
Hootsuite Inc.
|
||||
Hsin-Ho Yeh <yhh92u@gmail.com>
|
||||
Hu Keping <hukeping@huawei.com>
|
||||
Hugues Bruant <hugues.bruant@gmail.com>
|
||||
|
|
|
|||
|
|
@ -1303,6 +1303,7 @@ Kshitij Saraogi <kshitijsaraogi@gmail.com>
|
|||
Kun Li <likunarmstrong@gmail.com>
|
||||
Kunpei Sakai <namusyaka@gmail.com>
|
||||
Kuntal Majumder <hellozee@disroot.org>
|
||||
Kush Patel <kush.patel@hootsuite.com>
|
||||
Kyle Consalus <consalus@gmail.com>
|
||||
Kyle Isom <kyle@gokyle.net>
|
||||
Kyle Jones <kyle@kyledj.com>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ editing, navigation, testing, and debugging experience.
|
|||
|
||||
<ul>
|
||||
<li><a href="https://github.com/fatih/vim-go">vim</a>: vim-go plugin provides Go programming language support</li>
|
||||
<li><a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.Go">Visual Studio Code</a>:
|
||||
<li><a href="https://marketplace.visualstudio.com/items?itemName=golang.go">Visual Studio Code</a>:
|
||||
Go extension provides support for the Go programming language</li>
|
||||
<li><a href="https://www.jetbrains.com/go">GoLand</a>: GoLand is distributed either as a standalone IDE
|
||||
or as a plugin for IntelliJ IDEA Ultimate</li>
|
||||
|
|
|
|||
|
|
@ -553,11 +553,11 @@ Do not send CLs removing the interior tags from such phrases.
|
|||
|
||||
<dl id="crypto/x509/pkix"><dt><a href="/pkg/crypto/x509/pkix/">crypto/x509/pkix</a></dt>
|
||||
<dd>
|
||||
<p><!-- CL 229864 -->
|
||||
<p><!-- CL 229864, CL 240543 -->
|
||||
<a href="/pkg/crypto/x509/pkix/#Name.String"><code>Name.String</code></a>
|
||||
now prints non-standard attributes from
|
||||
<a href="/pkg/crypto/x509/pkix/#Name.Names"><code>Names</code></a> if
|
||||
<a href="/pkg/crypto/x509/pkix/#Name.ExtraNames"><code>ExtraNames</code></a> is empty.
|
||||
<a href="/pkg/crypto/x509/pkix/#Name.ExtraNames"><code>ExtraNames</code></a> is nil.
|
||||
</p>
|
||||
</dd>
|
||||
</dl><!-- crypto/x509/pkix -->
|
||||
|
|
@ -666,6 +666,17 @@ Do not send CLs removing the interior tags from such phrases.
|
|||
</dd>
|
||||
</dl><!-- go/printer -->
|
||||
|
||||
<dl id="html/template"><dt><a href="/pkg/html/template/">html/template</a></dt>
|
||||
<dd>
|
||||
<p><!-- CL 226097 -->
|
||||
The package now uses Unicode escapes (<code>\uNNNN</code>) in all
|
||||
JavaScript and JSON contexts. This fixes escaping errors in
|
||||
<code>application/ld+json</code> and <code>application/json</code>
|
||||
contexts.
|
||||
</p>
|
||||
</dd>
|
||||
</dl><!-- html/template -->
|
||||
|
||||
<dl id="io/ioutil"><dt><a href="/pkg/io/ioutil/">io/ioutil</a></dt>
|
||||
<dd>
|
||||
<p><!-- CL 212597 -->
|
||||
|
|
@ -950,6 +961,16 @@ Do not send CLs removing the interior tags from such phrases.
|
|||
</dd>
|
||||
</dl><!-- testing -->
|
||||
|
||||
<dl id="text/template"><dt><a href="/pkg/text/template/">text/template</a></dt>
|
||||
<dd>
|
||||
<p><!-- CL 226097 -->
|
||||
<a href="/pkg/text/template/#JSEscape"><code>JSEscape</code></a> now
|
||||
consistently uses Unicode escapes (<code>\u00XX</code>), which are
|
||||
compatible with JSON.
|
||||
</p>
|
||||
</dd>
|
||||
</dl><!-- text/template -->
|
||||
|
||||
<dl id="time"><dt><a href="/pkg/time/">time</a></dt>
|
||||
<dd>
|
||||
<p><!-- CL 220424, CL 217362, golang.org/issue/33184 -->
|
||||
|
|
|
|||
|
|
@ -600,12 +600,12 @@ type Config struct {
|
|||
// by the policy in ClientAuth.
|
||||
ClientCAs *x509.CertPool
|
||||
|
||||
// InsecureSkipVerify controls whether a client verifies the
|
||||
// server's certificate chain and host name.
|
||||
// If InsecureSkipVerify is true, TLS accepts any certificate
|
||||
// presented by the server and any host name in that certificate.
|
||||
// In this mode, TLS is susceptible to machine-in-the-middle attacks.
|
||||
// This should be used only for testing.
|
||||
// InsecureSkipVerify controls whether a client verifies the server's
|
||||
// certificate chain and host name. If InsecureSkipVerify is true, crypto/tls
|
||||
// accepts any certificate presented by the server and any host name in that
|
||||
// certificate. In this mode, TLS is susceptible to machine-in-the-middle
|
||||
// attacks unless custom verification is used. This should be used only for
|
||||
// testing or in combination with VerifyConnection or VerifyPeerCertificate.
|
||||
InsecureSkipVerify bool
|
||||
|
||||
// CipherSuites is a list of supported cipher suites for TLS versions up to
|
||||
|
|
|
|||
|
|
@ -247,20 +247,26 @@ func (n Name) ToRDNSequence() (ret RDNSequence) {
|
|||
// String returns the string form of n, roughly following
|
||||
// the RFC 2253 Distinguished Names syntax.
|
||||
func (n Name) String() string {
|
||||
if len(n.ExtraNames) == 0 {
|
||||
var rdns RDNSequence
|
||||
// If there are no ExtraNames, surface the parsed value (all entries in
|
||||
// Names) instead.
|
||||
if n.ExtraNames == nil {
|
||||
for _, atv := range n.Names {
|
||||
t := atv.Type
|
||||
if len(t) == 4 && t[0] == 2 && t[1] == 5 && t[2] == 4 {
|
||||
switch t[3] {
|
||||
case 3, 5, 6, 7, 8, 9, 10, 11, 17:
|
||||
// These attributes are already parsed into named fields.
|
||||
// These attributes were already parsed into named fields.
|
||||
continue
|
||||
}
|
||||
}
|
||||
n.ExtraNames = append(n.ExtraNames, atv)
|
||||
// Place non-standard parsed values at the beginning of the sequence
|
||||
// so they will be at the end of the string. See Issue 39924.
|
||||
rdns = append(rdns, []AttributeTypeAndValue{atv})
|
||||
}
|
||||
}
|
||||
return n.ToRDNSequence().String()
|
||||
rdns = append(rdns, n.ToRDNSequence()...)
|
||||
return rdns.String()
|
||||
}
|
||||
|
||||
// oidInAttributeTypeAndValue reports whether a type with the given OID exists
|
||||
|
|
|
|||
|
|
@ -2076,10 +2076,31 @@ func TestPKIXNameString(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Check that parsed non-standard attributes are printed.
|
||||
rdns := pkix.Name{
|
||||
Locality: []string{"Gophertown"},
|
||||
ExtraNames: []pkix.AttributeTypeAndValue{
|
||||
{Type: asn1.ObjectIdentifier([]int{1, 2, 3, 4, 5}), Value: "golang.org"}},
|
||||
}.ToRDNSequence()
|
||||
nn := pkix.Name{}
|
||||
nn.FillFromRDNSequence(&rdns)
|
||||
|
||||
// Check that zero-length non-nil ExtraNames hide Names.
|
||||
extra := []pkix.AttributeTypeAndValue{
|
||||
{Type: asn1.ObjectIdentifier([]int{1, 2, 3, 4, 5}), Value: "backing array"}}
|
||||
extraNotNil := pkix.Name{
|
||||
Locality: []string{"Gophertown"},
|
||||
ExtraNames: extra[:0],
|
||||
Names: []pkix.AttributeTypeAndValue{
|
||||
{Type: asn1.ObjectIdentifier([]int{1, 2, 3, 4, 5}), Value: "golang.org"}},
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
dn pkix.Name
|
||||
want string
|
||||
}{
|
||||
{nn, "L=Gophertown,1.2.3.4.5=#130a676f6c616e672e6f7267"},
|
||||
{extraNotNil, "L=Gophertown"},
|
||||
{pkix.Name{
|
||||
CommonName: "Steve Kille",
|
||||
Organization: []string{"Isode Limited"},
|
||||
|
|
@ -2108,6 +2129,20 @@ func TestPKIXNameString(t *testing.T) {
|
|||
ExtraNames: []pkix.AttributeTypeAndValue{
|
||||
{Type: asn1.ObjectIdentifier([]int{1, 2, 3, 4, 5}), Value: "golang.org"}},
|
||||
}, "1.2.3.4.5=#130a676f6c616e672e6f7267,L=Gophertown"},
|
||||
// If there are no ExtraNames, the Names are printed instead.
|
||||
{pkix.Name{
|
||||
Locality: []string{"Gophertown"},
|
||||
Names: []pkix.AttributeTypeAndValue{
|
||||
{Type: asn1.ObjectIdentifier([]int{1, 2, 3, 4, 5}), Value: "golang.org"}},
|
||||
}, "L=Gophertown,1.2.3.4.5=#130a676f6c616e672e6f7267"},
|
||||
// If there are both, print only the ExtraNames.
|
||||
{pkix.Name{
|
||||
Locality: []string{"Gophertown"},
|
||||
ExtraNames: []pkix.AttributeTypeAndValue{
|
||||
{Type: asn1.ObjectIdentifier([]int{1, 2, 3, 4, 5}), Value: "golang.org"}},
|
||||
Names: []pkix.AttributeTypeAndValue{
|
||||
{Type: asn1.ObjectIdentifier([]int{1, 2, 3, 4, 6}), Value: "example.com"}},
|
||||
}, "1.2.3.4.5=#130a676f6c616e672e6f7267,L=Gophertown"},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
|
|
@ -2115,6 +2150,10 @@ func TestPKIXNameString(t *testing.T) {
|
|||
t.Errorf("#%d: String() = \n%s\n, want \n%s", i, got, test.want)
|
||||
}
|
||||
}
|
||||
|
||||
if extra[0].Value != "backing array" {
|
||||
t.Errorf("the backing array of an empty ExtraNames got modified by String")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRDNSequenceString(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ func parsePlan9Addr(s string) (ip IP, iport int, err error) {
|
|||
return addr, p, nil
|
||||
}
|
||||
|
||||
func readPlan9Addr(proto, filename string) (addr Addr, err error) {
|
||||
func readPlan9Addr(net, filename string) (addr Addr, err error) {
|
||||
var buf [128]byte
|
||||
|
||||
f, err := os.Open(filename)
|
||||
|
|
@ -83,13 +83,19 @@ func readPlan9Addr(proto, filename string) (addr Addr, err error) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
switch proto {
|
||||
case "tcp":
|
||||
switch net {
|
||||
case "tcp4", "udp4":
|
||||
if ip.Equal(IPv6zero) {
|
||||
ip = ip[:IPv4len]
|
||||
}
|
||||
}
|
||||
switch net {
|
||||
case "tcp", "tcp4", "tcp6":
|
||||
addr = &TCPAddr{IP: ip, Port: port}
|
||||
case "udp":
|
||||
case "udp", "udp4", "udp6":
|
||||
addr = &UDPAddr{IP: ip, Port: port}
|
||||
default:
|
||||
return nil, UnknownNetworkError(proto)
|
||||
return nil, UnknownNetworkError(net)
|
||||
}
|
||||
return addr, nil
|
||||
}
|
||||
|
|
@ -213,7 +219,7 @@ func dialPlan9Blocking(ctx context.Context, net string, laddr, raddr Addr) (fd *
|
|||
f.Close()
|
||||
return nil, err
|
||||
}
|
||||
laddr, err = readPlan9Addr(proto, netdir+"/"+proto+"/"+name+"/local")
|
||||
laddr, err = readPlan9Addr(net, netdir+"/"+proto+"/"+name+"/local")
|
||||
if err != nil {
|
||||
data.Close()
|
||||
f.Close()
|
||||
|
|
@ -233,7 +239,7 @@ func listenPlan9(ctx context.Context, net string, laddr Addr) (fd *netFD, err er
|
|||
f.Close()
|
||||
return nil, &OpError{Op: "announce", Net: net, Source: laddr, Addr: nil, Err: err}
|
||||
}
|
||||
laddr, err = readPlan9Addr(proto, netdir+"/"+proto+"/"+name+"/local")
|
||||
laddr, err = readPlan9Addr(net, netdir+"/"+proto+"/"+name+"/local")
|
||||
if err != nil {
|
||||
f.Close()
|
||||
return nil, err
|
||||
|
|
|
|||
29
src/net/ipsock_plan9_test.go
Normal file
29
src/net/ipsock_plan9_test.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2020 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 net
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestTCP4ListenZero(t *testing.T) {
|
||||
l, err := Listen("tcp4", "0.0.0.0:0")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer l.Close()
|
||||
if a := l.Addr(); isNotIPv4(a) {
|
||||
t.Errorf("address does not contain IPv4: %v", a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUDP4ListenZero(t *testing.T) {
|
||||
c, err := ListenPacket("udp4", "0.0.0.0:0")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer c.Close()
|
||||
if a := c.LocalAddr(); isNotIPv4(a) {
|
||||
t.Errorf("address does not contain IPv4: %v", a)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue