diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 0000000000..35995eeb68
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,13 @@
+# Security Policy
+
+## Supported Versions
+
+We support the past two Go releases (for example, Go 1.11.x and Go 1.12.x).
+
+See https://golang.org/wiki/Go-Release-Cycle and in particular the
+[Release Maintenance](https://github.com/golang/go/wiki/Go-Release-Cycle#release-maintenance)
+part of that page.
+
+## Reporting a Vulnerability
+
+See https://golang.org/security for how to report a vulnerability.
diff --git a/doc/contribute.html b/doc/contribute.html
index 6f2287b410..471eeef536 100644
--- a/doc/contribute.html
+++ b/doc/contribute.html
@@ -26,7 +26,7 @@ see Contributing to gccgo.
The first step is registering as a Go contributor and configuring your environment.
@@ -261,7 +261,7 @@ a new issue or by claiming
an existing one.
-
Whether you already know what contribution to make, or you are searching for
@@ -398,7 +398,7 @@ It's different but powerful and familiarity with it will help you understand
the flow.
-
This is an overview of the overall process:
@@ -666,7 +666,7 @@ The algorithm is described at https://wikipedia.org/wiki/McGillicutty_Algorithm
Fixes #159
-
The first line of the change description is conventionally a short one-line
@@ -684,7 +684,7 @@ and actually summarizes the result of the change.
Follow the first line by a blank line.
-
The rest of the description elaborates and should provide context for the
@@ -702,7 +702,7 @@ tool is conventionally used to format
benchmark data for change descriptions.
-
The special notation "Fixes #12345" associates the change with issue 12345 in the
diff --git a/doc/devel/release.html b/doc/devel/release.html
index 69eec330a8..6ab1c1b878 100644
--- a/doc/devel/release.html
+++ b/doc/devel/release.html
@@ -69,6 +69,14 @@ the go command, the runtime, and the os package. See the
1.12.5 milestone on our issue tracker for details.
+
+go1.12.6 (released 2019/06/11) includes fixes to the compiler, the linker,
+the go command, and the crypto/x509, net/http, and
+os packages. See the
+Go
+1.12.6 milestone on our issue tracker for details.
+
+
diff --git a/doc/go1.13.html b/doc/go1.13.html
index ef37c92775..02c0adf32b 100644
--- a/doc/go1.13.html
+++ b/doc/go1.13.html
@@ -24,6 +24,16 @@ Do not send CLs removing the interior tags from such phrases.
+
+ As of Go 1.13, the go command by default downloads and authenticates
+ modules using the Go module mirror and Go checksum database run by Google. See
+ https://proxy.golang.org/privacy
+ for privacy information about these services and the
+ go command documentation
+ for configuration details including how to disable the use of these servers or use
+ different ones.
+
+
+ These language changes were implemented by changes to the compiler, and corresponding internal changes to the library
+ packages go/scanner and
+ text/scanner (number literals),
+ and go/types (signed shift counts).
+
+
+
+ The Windows version specified by internally-linked Windows binaries
+ is now Windows 7 rather than NT 4.0. This was already the minimum
+ required version for Go, but can affect the behavior of system calls
+ that have a backwards-compatibility mode. These will now behave as
+ documented. Externally-linked binaries (any program using cgo) have
+ always specified a more recent Windows version.
+
+
+ The compiler has a new implementation of escape analysis that is
+ more precise. For most Go code should be an improvement (in other
+ words, more Go variables and expressions allocated on the stack
+ instead of heap). However, this increased precision may also break
+ invalid code that happened to work before (for example, code that
+ violates
+ the unsafe.Pointer
+ safety rules). If you notice any regressions that appear
+ related, the old escape analysis pass can be re-enabled
+ with go build -gcflags=all=-newescape=false.
+ The option to use the old escape analysis will be removed in a
+ future release.
+
+ The assembler now supports many of the atomic instructions
+ introduced in ARM v8.1.
+
+
+
+ Out of range panic messages now include the index that was out of
+ bounds and the length (or capacity) of the slice. For
+ example, s[3] on a slice of length 1 will panic with
+ "runtime error: index out of range [3] with length 1".
+
+
+
+ The runtime is now more aggressive at returning memory to the
+ operating system to make it available to co-tenant applications.
+ Previously, the runtime could retain memory for five or more minutes
+ following a spike in the heap size. It will now begin returning it
+ promptly after the heap shrinks. However, on many OSes, including
+ Linux, the OS itself reclaims memory lazily, so process RSS will not
+ decrease until the system is under memory pressure.
+
The Go project's official Twitter account.
-A Google+ community for Go enthusiasts.
-
Go will be installed in the directory where it is checked out. For example,
+if Go is checked out in $HOME/goroot, executables will be installed
+in $HOME/goroot/bin. The directory may have any name, but note
+that if Go is checked out in $HOME/go, it will conflict with
+the default location of $GOPATH.
+See GOPATH below.
+
If you intend to modify the go source code, and
@@ -441,6 +447,43 @@ but move it elsewhere after the build, set
+$GO386 (for 386 only, default is auto-detected
if built on either 386 or amd64, 387 otherwise)
diff --git a/misc/cgo/errors/ptr_test.go b/misc/cgo/errors/ptr_test.go
index ba4f4ade64..d1ef191bf5 100644
--- a/misc/cgo/errors/ptr_test.go
+++ b/misc/cgo/errors/ptr_test.go
@@ -440,7 +440,6 @@ func TestPointerChecks(t *testing.T) {
atomic.AddInt32(&pending, +1)
defer func() {
if atomic.AddInt32(&pending, -1) == 0 {
- println("removing", dir)
os.RemoveAll(dir)
}
}()
@@ -554,18 +553,23 @@ func main() {
}
`
+var csem = make(chan bool, 16)
+
func testOne(t *testing.T, pt ptrTest, exe string) {
t.Parallel()
- newcmd := func(cgocheck string) *exec.Cmd {
+ // Run the tests in parallel, but don't run too many
+ // executions in parallel, to avoid overloading the system.
+ runcmd := func(cgocheck string) ([]byte, error) {
+ csem <- true
+ defer func() { <-csem }()
cmd := exec.Command(exe, pt.name)
cmd.Env = append(os.Environ(), "GODEBUG=cgocheck="+cgocheck)
- return cmd
+ return cmd.CombinedOutput()
}
if pt.expensive {
- cmd := newcmd("1")
- buf, err := cmd.CombinedOutput()
+ buf, err := runcmd("1")
if err != nil {
t.Logf("%s", buf)
if pt.fail {
@@ -577,12 +581,12 @@ func testOne(t *testing.T, pt ptrTest, exe string) {
}
- cmd := newcmd("")
+ cgocheck := ""
if pt.expensive {
- cmd = newcmd("2")
+ cgocheck = "2"
}
- buf, err := cmd.CombinedOutput()
+ buf, err := runcmd(cgocheck)
if pt.fail {
if err == nil {
t.Logf("%s", buf)
@@ -599,8 +603,7 @@ func testOne(t *testing.T, pt ptrTest, exe string) {
if !pt.expensive {
// Make sure it passes with the expensive checks.
- cmd := newcmd("2")
- buf, err := cmd.CombinedOutput()
+ buf, err := runcmd("2")
if err != nil {
t.Logf("%s", buf)
t.Fatalf("failed unexpectedly with expensive checks: %v", err)
@@ -609,8 +612,7 @@ func testOne(t *testing.T, pt ptrTest, exe string) {
}
if pt.fail {
- cmd := newcmd("0")
- buf, err := cmd.CombinedOutput()
+ buf, err := runcmd("0")
if err != nil {
t.Logf("%s", buf)
t.Fatalf("failed unexpectedly with GODEBUG=cgocheck=0: %v", err)
diff --git a/misc/cgo/test/cgo_test.go b/misc/cgo/test/cgo_test.go
index 7f886bad68..2d6d269608 100644
--- a/misc/cgo/test/cgo_test.go
+++ b/misc/cgo/test/cgo_test.go
@@ -56,7 +56,6 @@ func Test25143(t *testing.T) { test25143(t) }
func Test26066(t *testing.T) { test26066(t) }
func Test27660(t *testing.T) { test27660(t) }
func Test28896(t *testing.T) { test28896(t) }
-func Test29878(t *testing.T) { test29878(t) }
func Test30065(t *testing.T) { test30065(t) }
func TestAlign(t *testing.T) { testAlign(t) }
func TestAtol(t *testing.T) { testAtol(t) }
diff --git a/misc/cgo/test/test.go b/misc/cgo/test/test.go
index b23fca0d0f..cc940da211 100644
--- a/misc/cgo/test/test.go
+++ b/misc/cgo/test/test.go
@@ -849,9 +849,8 @@ static int f29748(S29748 *p) { return 0; }
static void issue29781F(char **p, int n) {}
#define ISSUE29781C 0
-// issue 29878
-uint64_t issue29878exported(int8_t); // prototype must match
-int16_t issue29878function(uint32_t arg) { return issue29878exported(arg); }
+// issue 31093
+static uint16_t issue31093F(uint16_t v) { return v; }
*/
import "C"
@@ -2054,14 +2053,6 @@ func issue29781G() {
X))
}
-func test29878(t *testing.T) {
- const arg uint32 = 123 // fits into all integer types
- var ret int16 = C.issue29878function(arg) // no conversions needed
- if int64(ret) != int64(arg) {
- t.Errorf("return value unexpected: got %d, want %d", ret, arg)
- }
-}
-
// issue 30065
func test30065(t *testing.T) {
@@ -2085,3 +2076,10 @@ func test30065(t *testing.T) {
t.Errorf("&d[0] failed: got %c, want %c", d[0], 'c')
}
}
+
+// issue 31093
+// No runtime test; just make sure it compiles.
+
+func Issue31093() {
+ C.issue31093F(C.ushort(0))
+}
diff --git a/misc/cgo/test/testx.go b/misc/cgo/test/testx.go
index b0b23e3011..27c7040307 100644
--- a/misc/cgo/test/testx.go
+++ b/misc/cgo/test/testx.go
@@ -535,8 +535,3 @@ func test20910(t *testing.T) {
// issue 28772 part 2
const issue28772Constant2 = C.issue28772Constant2
-
-//export issue29878exported
-func issue29878exported(arg int8) uint64 {
- return uint64(arg)
-}
diff --git a/misc/cgo/testsanitizers/tsan_test.go b/misc/cgo/testsanitizers/tsan_test.go
index 1d769a98b6..ec4e0033fb 100644
--- a/misc/cgo/testsanitizers/tsan_test.go
+++ b/misc/cgo/testsanitizers/tsan_test.go
@@ -5,15 +5,11 @@
package sanitizers_test
import (
- "runtime"
"strings"
"testing"
)
func TestTSAN(t *testing.T) {
- if runtime.GOARCH == "arm64" {
- t.Skip("skipping test; see https://golang.org/issue/25682")
- }
t.Parallel()
requireOvercommit(t)
config := configure("thread")
diff --git a/misc/ios/README b/misc/ios/README
index b9952dc11d..d7df191414 100644
--- a/misc/ios/README
+++ b/misc/ios/README
@@ -40,7 +40,7 @@ To use the go tool directly to run programs and tests, put $GOROOT/bin into PATH
the go_darwin_$GOARCH_exec wrapper is found. For example, to run the archive/tar tests
export PATH=$GOROOT/bin:$PATH
- GOARCH=arm64 go test archive/tar
+ GOARCH=arm64 CGO_ENABLED=1 go test archive/tar
Note that the go_darwin_$GOARCH_exec wrapper uninstalls any existing app identified by
the bundle id before installing a new app. If the uninstalled app is the last app by
diff --git a/misc/wasm/wasm_exec.js b/misc/wasm/wasm_exec.js
index a1d88e6eac..a54bb9a95d 100644
--- a/misc/wasm/wasm_exec.js
+++ b/misc/wasm/wasm_exec.js
@@ -387,6 +387,34 @@
mem().setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16));
},
+ // func copyBytesToGo(dst []byte, src ref) (int, bool)
+ "syscall/js.copyBytesToGo": (sp) => {
+ const dst = loadSlice(sp + 8);
+ const src = loadValue(sp + 32);
+ if (!(src instanceof Uint8Array)) {
+ mem().setUint8(sp + 48, 0);
+ return;
+ }
+ const toCopy = src.subarray(0, dst.length);
+ dst.set(toCopy);
+ setInt64(sp + 40, toCopy.length);
+ mem().setUint8(sp + 48, 1);
+ },
+
+ // func copyBytesToJS(dst ref, src []byte) (int, bool)
+ "syscall/js.copyBytesToJS": (sp) => {
+ const dst = loadValue(sp + 8);
+ const src = loadSlice(sp + 16);
+ if (!(dst instanceof Uint8Array)) {
+ mem().setUint8(sp + 48, 0);
+ return;
+ }
+ const toCopy = src.subarray(0, dst.length);
+ dst.set(toCopy);
+ setInt64(sp + 40, toCopy.length);
+ mem().setUint8(sp + 48, 1);
+ },
+
"debug": (value) => {
console.log(value);
},
@@ -403,7 +431,6 @@
true,
false,
global,
- this._inst.exports.mem,
this,
];
this._refs = new Map();
diff --git a/src/bytes/buffer.go b/src/bytes/buffer.go
index 190c468162..f19a4cfff0 100644
--- a/src/bytes/buffer.go
+++ b/src/bytes/buffer.go
@@ -21,9 +21,6 @@ type Buffer struct {
buf []byte // contents are the bytes buf[off : len(buf)]
off int // read at &buf[off], write at &buf[len(buf)]
lastRead readOp // last read operation, so that Unread* can work correctly.
-
- // FIXME: it would be advisable to align Buffer to cachelines to avoid false
- // sharing.
}
// The readOp constants describe the last action performed on
diff --git a/src/cmd/cgo/doc.go b/src/cmd/cgo/doc.go
index 2ca77fe8be..f227d7f850 100644
--- a/src/cmd/cgo/doc.go
+++ b/src/cmd/cgo/doc.go
@@ -148,8 +148,6 @@ C.long, C.ulong (unsigned long), C.longlong (long long),
C.ulonglong (unsigned long long), C.float, C.double,
C.complexfloat (complex float), and C.complexdouble (complex double).
The C type void* is represented by Go's unsafe.Pointer.
-The C sized integer types (int8_t, uint8_t, …) are represented by their Go
-counterparts (int8, uint8, …).
The C types __int128_t and __uint128_t are represented by [16]byte.
A few special C types which would normally be represented by a pointer
@@ -298,7 +296,7 @@ Go functions can be exported for use by C code in the following way:
They will be available in the C code as:
- extern int64_t MyFunction(int arg1, int arg2, GoString arg3);
+ extern GoInt64 MyFunction(int arg1, int arg2, GoString arg3);
extern struct MyFunction2_return MyFunction2(int arg1, int arg2, GoString arg3);
found in the _cgo_export.h generated header, after any preambles
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index 941f1db832..9428ffd3bf 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -23,7 +23,6 @@ import (
"internal/xcoff"
"math"
"os"
- "regexp"
"strconv"
"strings"
"unicode"
@@ -2047,8 +2046,6 @@ type typeConv struct {
ptrSize int64
intSize int64
-
- exactWidthIntegerTypes map[string]*Type
}
var tagGen int
@@ -2091,21 +2088,6 @@ func (c *typeConv) Init(ptrSize, intSize int64) {
} else {
c.goVoidPtr = c.Ident("unsafe.Pointer")
}
-
- c.exactWidthIntegerTypes = make(map[string]*Type)
- for _, t := range []ast.Expr{
- c.int8, c.int16, c.int32, c.int64,
- c.uint8, c.uint16, c.uint32, c.uint64,
- } {
- name := t.(*ast.Ident).Name
- u := new(Type)
- *u = *goTypes[name]
- if u.Align > ptrSize {
- u.Align = ptrSize
- }
- u.Go = t
- c.exactWidthIntegerTypes[name] = u
- }
}
// base strips away qualifiers and typedefs to get the underlying type
@@ -2477,26 +2459,6 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type {
t.Align = c.ptrSize
break
}
- // Exact-width integer types. These are always compatible with
- // the corresponding Go types since the C standard requires
- // them to have no padding bit and use the two’s complement
- // representation.
- if exactWidthIntegerType.MatchString(dt.Name) {
- sub := c.Type(dt.Type, pos)
- goname := strings.TrimPrefix(dt.Name, "__")
- goname = strings.TrimSuffix(goname, "_t")
- u := c.exactWidthIntegerTypes[goname]
- if sub.Size != u.Size {
- fatalf("%s: unexpected size: %d vs. %d – %s", lineno(pos), sub.Size, u.Size, dtype)
- }
- if sub.Align != u.Align {
- fatalf("%s: unexpected alignment: %d vs. %d – %s", lineno(pos), sub.Align, u.Align, dtype)
- }
- t.Size = u.Size
- t.Align = u.Align
- t.Go = u.Go
- break
- }
name := c.Ident("_Ctype_" + dt.Name)
goIdent[name.Name] = name
sub := c.Type(dt.Type, pos)
@@ -2632,8 +2594,6 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type {
return t
}
-var exactWidthIntegerType = regexp.MustCompile(`^(__)?u?int(8|16|32|64)_t$`)
-
// isStructUnionClass reports whether the type described by the Go syntax x
// is a struct, union, or class with a tag.
func isStructUnionClass(x ast.Expr) bool {
diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go
index 5b3a7cb9c1..488db52c2e 100644
--- a/src/cmd/cgo/out.go
+++ b/src/cmd/cgo/out.go
@@ -1367,19 +1367,19 @@ func c(repr string, args ...interface{}) *TypeRepr {
// Map predeclared Go types to Type.
var goTypes = map[string]*Type{
- "bool": {Size: 1, Align: 1, C: c("uint8_t")},
- "byte": {Size: 1, Align: 1, C: c("uint8_t")},
+ "bool": {Size: 1, Align: 1, C: c("GoUint8")},
+ "byte": {Size: 1, Align: 1, C: c("GoUint8")},
"int": {Size: 0, Align: 0, C: c("GoInt")},
"uint": {Size: 0, Align: 0, C: c("GoUint")},
- "rune": {Size: 4, Align: 4, C: c("int32_t")},
- "int8": {Size: 1, Align: 1, C: c("int8_t")},
- "uint8": {Size: 1, Align: 1, C: c("uint8_t")},
- "int16": {Size: 2, Align: 2, C: c("int16_t")},
- "uint16": {Size: 2, Align: 2, C: c("uint16_t")},
- "int32": {Size: 4, Align: 4, C: c("int32_t")},
- "uint32": {Size: 4, Align: 4, C: c("uint32_t")},
- "int64": {Size: 8, Align: 8, C: c("int64_t")},
- "uint64": {Size: 8, Align: 8, C: c("uint64_t")},
+ "rune": {Size: 4, Align: 4, C: c("GoInt32")},
+ "int8": {Size: 1, Align: 1, C: c("GoInt8")},
+ "uint8": {Size: 1, Align: 1, C: c("GoUint8")},
+ "int16": {Size: 2, Align: 2, C: c("GoInt16")},
+ "uint16": {Size: 2, Align: 2, C: c("GoUint16")},
+ "int32": {Size: 4, Align: 4, C: c("GoInt32")},
+ "uint32": {Size: 4, Align: 4, C: c("GoUint32")},
+ "int64": {Size: 8, Align: 8, C: c("GoInt64")},
+ "uint64": {Size: 8, Align: 8, C: c("GoUint64")},
"float32": {Size: 4, Align: 4, C: c("GoFloat32")},
"float64": {Size: 8, Align: 8, C: c("GoFloat64")},
"complex64": {Size: 8, Align: 4, C: c("GoComplex64")},
@@ -1871,10 +1871,16 @@ const gccExportHeaderProlog = `
#ifndef GO_CGO_PROLOGUE_H
#define GO_CGO_PROLOGUE_H
-#include
-
-typedef intGOINTBITS_t GoInt;
-typedef uintGOINTBITS_t GoUint;
+typedef signed char GoInt8;
+typedef unsigned char GoUint8;
+typedef short GoInt16;
+typedef unsigned short GoUint16;
+typedef int GoInt32;
+typedef unsigned int GoUint32;
+typedef long long GoInt64;
+typedef unsigned long long GoUint64;
+typedef GoIntGOINTBITS GoInt;
+typedef GoUintGOINTBITS GoUint;
typedef __SIZE_TYPE__ GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
diff --git a/src/cmd/compile/doc.go b/src/cmd/compile/doc.go
index 5291a8b0eb..5b437d6804 100644
--- a/src/cmd/compile/doc.go
+++ b/src/cmd/compile/doc.go
@@ -216,11 +216,15 @@ not include a stack overflow check. This is most commonly used by low-level
runtime sources invoked at times when it is unsafe for the calling goroutine to be
preempted.
- //go:linkname localname importpath.name
+ //go:linkname localname [importpath.name]
The //go:linkname directive instructs the compiler to use ``importpath.name'' as the
object file symbol name for the variable or function declared as ``localname'' in the
-source code. Because this directive can subvert the type system and package
+source code.
+If the ``importpath.name'' argument is omitted, the directive uses the
+symbol's default object file symbol name and only has the effect of making
+the symbol accessible to other packages.
+Because this directive can subvert the type system and package
modularity, it is only enabled in files that have imported "unsafe".
*/
package main
diff --git a/src/cmd/compile/fmtmap_test.go b/src/cmd/compile/fmtmap_test.go
index 018447efa1..12e9d400c5 100644
--- a/src/cmd/compile/fmtmap_test.go
+++ b/src/cmd/compile/fmtmap_test.go
@@ -65,7 +65,6 @@ var knownFormats = map[string]string{
"*math/big.Int %s": "",
"*math/big.Int %v": "",
"[16]byte %x": "",
- "[]*cmd/compile/internal/gc.Node %v": "",
"[]*cmd/compile/internal/ssa.Block %v": "",
"[]*cmd/compile/internal/ssa.Value %v": "",
"[][]string %q": "",
@@ -172,36 +171,38 @@ var knownFormats = map[string]string{
"interface{} %s": "",
"interface{} %v": "",
"map[*cmd/compile/internal/gc.Node]*cmd/compile/internal/ssa.Value %v": "",
+ "map[*cmd/compile/internal/gc.Node][]*cmd/compile/internal/gc.Node %v": "",
"map[cmd/compile/internal/ssa.ID]uint32 %v": "",
- "math/big.Accuracy %s": "",
- "reflect.Type %s": "",
- "rune %#U": "",
- "rune %c": "",
- "rune %q": "",
- "string %-*s": "",
- "string %-16s": "",
- "string %-6s": "",
- "string %.*s": "",
- "string %q": "",
- "string %s": "",
- "string %v": "",
- "time.Duration %d": "",
- "time.Duration %v": "",
- "uint %04x": "",
- "uint %5d": "",
- "uint %d": "",
- "uint %x": "",
- "uint16 %d": "",
- "uint16 %v": "",
- "uint16 %x": "",
- "uint32 %#x": "",
- "uint32 %d": "",
- "uint32 %v": "",
- "uint32 %x": "",
- "uint64 %08x": "",
- "uint64 %d": "",
- "uint64 %x": "",
- "uint8 %d": "",
- "uint8 %x": "",
- "uintptr %d": "",
+ "math/big.Accuracy %s": "",
+ "reflect.Type %s": "",
+ "rune %#U": "",
+ "rune %c": "",
+ "rune %q": "",
+ "string %-*s": "",
+ "string %-16s": "",
+ "string %-6s": "",
+ "string %.*s": "",
+ "string %q": "",
+ "string %s": "",
+ "string %v": "",
+ "time.Duration %d": "",
+ "time.Duration %v": "",
+ "uint %04x": "",
+ "uint %5d": "",
+ "uint %d": "",
+ "uint %x": "",
+ "uint16 %d": "",
+ "uint16 %v": "",
+ "uint16 %x": "",
+ "uint32 %#x": "",
+ "uint32 %d": "",
+ "uint32 %v": "",
+ "uint32 %x": "",
+ "uint64 %08x": "",
+ "uint64 %d": "",
+ "uint64 %x": "",
+ "uint8 %d": "",
+ "uint8 %v": "",
+ "uint8 %x": "",
+ "uintptr %d": "",
}
diff --git a/src/cmd/compile/internal/gc/class_string.go b/src/cmd/compile/internal/gc/class_string.go
index 8980777333..7dc6a15a18 100644
--- a/src/cmd/compile/internal/gc/class_string.go
+++ b/src/cmd/compile/internal/gc/class_string.go
@@ -4,6 +4,20 @@ package gc
import "strconv"
+func _() {
+ // An "invalid array index" compiler error signifies that the constant values have changed.
+ // Re-run the stringer command to generate them again.
+ var x [1]struct{}
+ _ = x[Pxxx-0]
+ _ = x[PEXTERN-1]
+ _ = x[PAUTO-2]
+ _ = x[PAUTOHEAP-3]
+ _ = x[PPARAM-4]
+ _ = x[PPARAMOUT-5]
+ _ = x[PFUNC-6]
+ _ = x[PDISCARD-7]
+}
+
const _Class_name = "PxxxPEXTERNPAUTOPAUTOHEAPPPARAMPPARAMOUTPFUNCPDISCARD"
var _Class_index = [...]uint8{0, 4, 11, 16, 25, 31, 40, 45, 53}
diff --git a/src/cmd/compile/internal/gc/const.go b/src/cmd/compile/internal/gc/const.go
index 39adba0f07..4ed881bc07 100644
--- a/src/cmd/compile/internal/gc/const.go
+++ b/src/cmd/compile/internal/gc/const.go
@@ -27,12 +27,12 @@ const (
type Val struct {
// U contains one of:
- // bool bool when n.ValCtype() == CTBOOL
- // *Mpint int when n.ValCtype() == CTINT, rune when n.ValCtype() == CTRUNE
- // *Mpflt float when n.ValCtype() == CTFLT
- // *Mpcplx pair of floats when n.ValCtype() == CTCPLX
- // string string when n.ValCtype() == CTSTR
- // *Nilval when n.ValCtype() == CTNIL
+ // bool bool when Ctype() == CTBOOL
+ // *Mpint int when Ctype() == CTINT, rune when Ctype() == CTRUNE
+ // *Mpflt float when Ctype() == CTFLT
+ // *Mpcplx pair of floats when Ctype() == CTCPLX
+ // string string when Ctype() == CTSTR
+ // *Nilval when Ctype() == CTNIL
U interface{}
}
diff --git a/src/cmd/compile/internal/gc/esc.go b/src/cmd/compile/internal/gc/esc.go
index ded9439a14..c42f25e104 100644
--- a/src/cmd/compile/internal/gc/esc.go
+++ b/src/cmd/compile/internal/gc/esc.go
@@ -802,6 +802,7 @@ opSwitch:
case ODEFER:
if e.loopdepth == 1 { // top level
+ n.Esc = EscNever // force stack allocation of defer record (see ssa.go)
break
}
// arguments leak out of scope
diff --git a/src/cmd/compile/internal/gc/escape.go b/src/cmd/compile/internal/gc/escape.go
index 88dc9ef8a8..47ce853858 100644
--- a/src/cmd/compile/internal/gc/escape.go
+++ b/src/cmd/compile/internal/gc/escape.go
@@ -882,6 +882,7 @@ func (e *Escape) augmentParamHole(k EscHole, where *Node) EscHole {
// non-transient location to avoid arguments from being
// transiently allocated.
if where.Op == ODEFER && e.loopDepth == 1 {
+ where.Esc = EscNever // force stack allocation of defer record (see ssa.go)
// TODO(mdempsky): Eliminate redundant EscLocation allocs.
return e.teeHole(k, e.newLoc(nil, false).asHole())
}
diff --git a/src/cmd/compile/internal/gc/go.go b/src/cmd/compile/internal/gc/go.go
index 6123e6acc1..f36e2716d6 100644
--- a/src/cmd/compile/internal/gc/go.go
+++ b/src/cmd/compile/internal/gc/go.go
@@ -14,17 +14,21 @@ import (
const (
BADWIDTH = types.BADWIDTH
+)
+var (
// maximum size variable which we will allocate on the stack.
// This limit is for explicit variable declarations like "var x T" or "x := ...".
- maxStackVarSize = 10 * 1024 * 1024
+ // Note: the flag smallframes can update this value.
+ maxStackVarSize = int64(10 * 1024 * 1024)
// maximum size of implicit variables that we will allocate on the stack.
// p := new(T) allocating T on the stack
// p := &T{} allocating T on the stack
// s := make([]T, n) allocating [n]T on the stack
// s := []byte("...") allocating [n]byte on the stack
- maxImplicitStackVarSize = 64 * 1024
+ // Note: the flag smallframes can update this value.
+ maxImplicitStackVarSize = int64(64 * 1024)
)
// isRuntimePkg reports whether p is package runtime.
@@ -287,6 +291,7 @@ var (
assertI2I,
assertI2I2,
deferproc,
+ deferprocStack,
Deferreturn,
Duffcopy,
Duffzero,
diff --git a/src/cmd/compile/internal/gc/gsubr.go b/src/cmd/compile/internal/gc/gsubr.go
index 6e9f80a89d..51c0fffc9e 100644
--- a/src/cmd/compile/internal/gc/gsubr.go
+++ b/src/cmd/compile/internal/gc/gsubr.go
@@ -201,7 +201,8 @@ func (f *Func) initLSym(hasBody bool) {
var aliasABI obj.ABI
needABIAlias := false
- if abi, ok := symabiDefs[f.lsym.Name]; ok && abi == obj.ABI0 {
+ defABI, hasDefABI := symabiDefs[f.lsym.Name]
+ if hasDefABI && defABI == obj.ABI0 {
// Symbol is defined as ABI0. Create an
// Internal -> ABI0 wrapper.
f.lsym.SetABI(obj.ABI0)
@@ -215,25 +216,24 @@ func (f *Func) initLSym(hasBody bool) {
}
}
- if abi, ok := symabiRefs[f.lsym.Name]; ok && abi == obj.ABI0 {
- // Symbol is referenced as ABI0. Create an
- // ABI0 -> Internal wrapper if necessary.
+ isLinknameExported := nam.Sym.Linkname != "" && (hasBody || hasDefABI)
+ if abi, ok := symabiRefs[f.lsym.Name]; (ok && abi == obj.ABI0) || isLinknameExported {
+ // Either 1) this symbol is definitely
+ // referenced as ABI0 from this package; or 2)
+ // this symbol is defined in this package but
+ // given a linkname, indicating that it may be
+ // referenced from another package. Create an
+ // ABI0 -> Internal wrapper so it can be
+ // called as ABI0. In case 2, it's important
+ // that we know it's defined in this package
+ // since other packages may "pull" symbols
+ // using linkname and we don't want to create
+ // duplicate ABI wrappers.
if f.lsym.ABI() != obj.ABI0 {
needABIAlias, aliasABI = true, obj.ABI0
}
}
- if !needABIAlias && allABIs {
- // The compiler was asked to produce ABI
- // wrappers for everything.
- switch f.lsym.ABI() {
- case obj.ABI0:
- needABIAlias, aliasABI = true, obj.ABIInternal
- case obj.ABIInternal:
- needABIAlias, aliasABI = true, obj.ABI0
- }
- }
-
if needABIAlias {
// These LSyms have the same name as the
// native function, so we create them directly
diff --git a/src/cmd/compile/internal/gc/init.go b/src/cmd/compile/internal/gc/init.go
index 8157292216..26fd71d70c 100644
--- a/src/cmd/compile/internal/gc/init.go
+++ b/src/cmd/compile/internal/gc/init.go
@@ -31,7 +31,7 @@ func renameinit() *types.Sym {
// 2) Initialize all the variables that have initializers.
// 3) Run any init functions.
func fninit(n []*Node) {
- nf := initfix(n)
+ nf := initOrder(n)
var deps []*obj.LSym // initTask records for packages the current package depends on
var fns []*obj.LSym // functions to call for package initialization
diff --git a/src/cmd/compile/internal/gc/initorder.go b/src/cmd/compile/internal/gc/initorder.go
new file mode 100644
index 0000000000..be1e671d17
--- /dev/null
+++ b/src/cmd/compile/internal/gc/initorder.go
@@ -0,0 +1,355 @@
+// Copyright 2019 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 gc
+
+import (
+ "bytes"
+ "container/heap"
+ "fmt"
+)
+
+// Package initialization
+//
+// Here we implement the algorithm for ordering package-level variable
+// initialization. The spec is written in terms of variable
+// initialization, but multiple variables initialized by a single
+// assignment are handled together, so here we instead focus on
+// ordering initialization assignments. Conveniently, this maps well
+// to how we represent package-level initializations using the Node
+// AST.
+//
+// Assignments are in one of three phases: NotStarted, Pending, or
+// Done. For assignments in the Pending phase, we use Xoffset to
+// record the number of unique variable dependencies whose
+// initialization assignment is not yet Done. We also maintain a
+// "blocking" map that maps assignments back to all of the assignments
+// that depend on it.
+//
+// For example, for an initialization like:
+//
+// var x = f(a, b, b)
+// var a, b = g()
+//
+// the "x = f(a, b, b)" assignment depends on two variables (a and b),
+// so its Xoffset will be 2. Correspondingly, the "a, b = g()"
+// assignment's "blocking" entry will have two entries back to x's
+// assignment.
+//
+// Logically, initialization works by (1) taking all NotStarted
+// assignments, calculating their dependencies, and marking them
+// Pending; (2) adding all Pending assignments with Xoffset==0 to a
+// "ready" priority queue (ordered by variable declaration position);
+// and (3) iteratively processing the next Pending assignment from the
+// queue, decreasing the Xoffset of assignments it's blocking, and
+// adding them to the queue if decremented to 0.
+//
+// As an optimization, we actually apply each of these three steps for
+// each assignment. This yields the same order, but keeps queue size
+// down and thus also heap operation costs.
+
+// Static initialization phase.
+// These values are stored in two bits in Node.flags.
+const (
+ InitNotStarted = iota
+ InitDone
+ InitPending
+)
+
+type InitOrder struct {
+ // blocking maps initialization assignments to the assignments
+ // that depend on it.
+ blocking map[*Node][]*Node
+
+ // ready is the queue of Pending initialization assignments
+ // that are ready for initialization.
+ ready declOrder
+}
+
+// initOrder computes initialization order for a list l of
+// package-level declarations (in declaration order) and outputs the
+// corresponding list of statements to include in the init() function
+// body.
+func initOrder(l []*Node) []*Node {
+ s := InitSchedule{
+ initplans: make(map[*Node]*InitPlan),
+ inittemps: make(map[*Node]*Node),
+ }
+ o := InitOrder{
+ blocking: make(map[*Node][]*Node),
+ }
+
+ // Process all package-level assignment in declaration order.
+ for _, n := range l {
+ switch n.Op {
+ case OAS, OAS2DOTTYPE, OAS2FUNC, OAS2MAPR, OAS2RECV:
+ o.processAssign(n)
+ o.flushReady(s.staticInit)
+ case ODCLCONST, ODCLFUNC, ODCLTYPE:
+ // nop
+ default:
+ Fatalf("unexpected package-level statement: %v", n)
+ }
+ }
+
+ // Check that all assignments are now Done; if not, there must
+ // have been a dependency cycle.
+ for _, n := range l {
+ switch n.Op {
+ case OAS, OAS2DOTTYPE, OAS2FUNC, OAS2MAPR, OAS2RECV:
+ if n.Initorder() != InitDone {
+ // If there have already been errors
+ // printed, those errors may have
+ // confused us and there might not be
+ // a loop. Let the user fix those
+ // first.
+ if nerrors > 0 {
+ errorexit()
+ }
+
+ findInitLoopAndExit(firstLHS(n), new([]*Node))
+ Fatalf("initialization unfinished, but failed to identify loop")
+ }
+ }
+ }
+
+ // Invariant consistency check. If this is non-zero, then we
+ // should have found a cycle above.
+ if len(o.blocking) != 0 {
+ Fatalf("expected empty map: %v", o.blocking)
+ }
+
+ return s.out
+}
+
+func (o *InitOrder) processAssign(n *Node) {
+ if n.Initorder() != InitNotStarted || n.Xoffset != BADWIDTH {
+ Fatalf("unexpected state: %v, %v, %v", n, n.Initorder(), n.Xoffset)
+ }
+
+ n.SetInitorder(InitPending)
+ n.Xoffset = 0
+
+ // Compute number of variable dependencies and build the
+ // inverse dependency ("blocking") graph.
+ for dep := range collectDeps(n, true) {
+ defn := dep.Name.Defn
+ // Skip dependencies on functions (PFUNC) and
+ // variables already initialized (InitDone).
+ if dep.Class() != PEXTERN || defn.Initorder() == InitDone {
+ continue
+ }
+ n.Xoffset++
+ o.blocking[defn] = append(o.blocking[defn], n)
+ }
+
+ if n.Xoffset == 0 {
+ heap.Push(&o.ready, n)
+ }
+}
+
+// flushReady repeatedly applies initialize to the earliest (in
+// declaration order) assignment ready for initialization and updates
+// the inverse dependency ("blocking") graph.
+func (o *InitOrder) flushReady(initialize func(*Node)) {
+ for o.ready.Len() != 0 {
+ n := heap.Pop(&o.ready).(*Node)
+ if n.Initorder() != InitPending || n.Xoffset != 0 {
+ Fatalf("unexpected state: %v, %v, %v", n, n.Initorder(), n.Xoffset)
+ }
+
+ initialize(n)
+ n.SetInitorder(InitDone)
+ n.Xoffset = BADWIDTH
+
+ blocked := o.blocking[n]
+ delete(o.blocking, n)
+
+ for _, m := range blocked {
+ m.Xoffset--
+ if m.Xoffset == 0 {
+ heap.Push(&o.ready, m)
+ }
+ }
+ }
+}
+
+// findInitLoopAndExit searches for an initialization loop involving variable
+// or function n. If one is found, it reports the loop as an error and exits.
+//
+// path points to a slice used for tracking the sequence of
+// variables/functions visited. Using a pointer to a slice allows the
+// slice capacity to grow and limit reallocations.
+func findInitLoopAndExit(n *Node, path *[]*Node) {
+ // We implement a simple DFS loop-finding algorithm. This
+ // could be faster, but initialization cycles are rare.
+
+ for i, x := range *path {
+ if x == n {
+ reportInitLoopAndExit((*path)[i:])
+ return
+ }
+ }
+
+ // There might be multiple loops involving n; by sorting
+ // references, we deterministically pick the one reported.
+ refers := collectDeps(n.Name.Defn, false).Sorted(func(ni, nj *Node) bool {
+ return ni.Pos.Before(nj.Pos)
+ })
+
+ *path = append(*path, n)
+ for _, ref := range refers {
+ // Short-circuit variables that were initialized.
+ if ref.Class() == PEXTERN && ref.Name.Defn.Initorder() == InitDone {
+ continue
+ }
+
+ findInitLoopAndExit(ref, path)
+ }
+ *path = (*path)[:len(*path)-1]
+}
+
+// reportInitLoopAndExit reports and initialization loop as an error
+// and exits. However, if l is not actually an initialization loop, it
+// simply returns instead.
+func reportInitLoopAndExit(l []*Node) {
+ // Rotate loop so that the earliest variable declaration is at
+ // the start.
+ i := -1
+ for j, n := range l {
+ if n.Class() == PEXTERN && (i == -1 || n.Pos.Before(l[i].Pos)) {
+ i = j
+ }
+ }
+ if i == -1 {
+ // False positive: loop only involves recursive
+ // functions. Return so that findInitLoop can continue
+ // searching.
+ return
+ }
+ l = append(l[i:], l[:i]...)
+
+ // TODO(mdempsky): Method values are printed as "T.m-fm"
+ // rather than "T.m". Figure out how to avoid that.
+
+ var msg bytes.Buffer
+ fmt.Fprintf(&msg, "initialization loop:\n")
+ for _, n := range l {
+ fmt.Fprintf(&msg, "\t%v: %v refers to\n", n.Line(), n)
+ }
+ fmt.Fprintf(&msg, "\t%v: %v", l[0].Line(), l[0])
+
+ yyerrorl(l[0].Pos, msg.String())
+ errorexit()
+}
+
+// collectDeps returns all of the package-level functions and
+// variables that declaration n depends on. If transitive is true,
+// then it also includes the transitive dependencies of any depended
+// upon functions (but not variables).
+func collectDeps(n *Node, transitive bool) NodeSet {
+ d := initDeps{transitive: transitive}
+ switch n.Op {
+ case OAS:
+ d.inspect(n.Right)
+ case OAS2DOTTYPE, OAS2FUNC, OAS2MAPR, OAS2RECV:
+ d.inspect(n.Rlist.First())
+ case ODCLFUNC:
+ d.inspectList(n.Nbody)
+ default:
+ Fatalf("unexpected Op: %v", n.Op)
+ }
+ return d.seen
+}
+
+type initDeps struct {
+ transitive bool
+ seen NodeSet
+}
+
+func (d *initDeps) inspect(n *Node) { inspect(n, d.visit) }
+func (d *initDeps) inspectList(l Nodes) { inspectList(l, d.visit) }
+
+// visit calls foundDep on any package-level functions or variables
+// referenced by n, if any.
+func (d *initDeps) visit(n *Node) bool {
+ switch n.Op {
+ case ONAME:
+ if n.isMethodExpression() {
+ d.foundDep(asNode(n.Type.FuncType().Nname))
+ return false
+ }
+
+ switch n.Class() {
+ case PEXTERN, PFUNC:
+ d.foundDep(n)
+ }
+
+ case OCLOSURE:
+ d.inspectList(n.Func.Closure.Nbody)
+
+ case ODOTMETH, OCALLPART:
+ d.foundDep(asNode(n.Type.FuncType().Nname))
+ }
+
+ return true
+}
+
+// foundDep records that we've found a dependency on n by adding it to
+// seen.
+func (d *initDeps) foundDep(n *Node) {
+ // Can happen with method expressions involving interface
+ // types; e.g., fixedbugs/issue4495.go.
+ if n == nil {
+ return
+ }
+
+ // Names without definitions aren't interesting as far as
+ // initialization ordering goes.
+ if n.Name.Defn == nil {
+ return
+ }
+
+ if d.seen.Has(n) {
+ return
+ }
+ d.seen.Add(n)
+ if d.transitive && n.Class() == PFUNC {
+ d.inspectList(n.Name.Defn.Nbody)
+ }
+}
+
+// declOrder implements heap.Interface, ordering assignment statements
+// by the position of their first LHS expression.
+//
+// N.B., the Pos of the first LHS expression is used because because
+// an OAS node's Pos may not be unique. For example, given the
+// declaration "var a, b = f(), g()", "a" must be ordered before "b",
+// but both OAS nodes use the "=" token's position as their Pos.
+type declOrder []*Node
+
+func (s declOrder) Len() int { return len(s) }
+func (s declOrder) Less(i, j int) bool { return firstLHS(s[i]).Pos.Before(firstLHS(s[j]).Pos) }
+func (s declOrder) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
+
+func (s *declOrder) Push(x interface{}) { *s = append(*s, x.(*Node)) }
+func (s *declOrder) Pop() interface{} {
+ n := (*s)[len(*s)-1]
+ *s = (*s)[:len(*s)-1]
+ return n
+}
+
+// firstLHS returns the first expression on the left-hand side of
+// assignment n.
+func firstLHS(n *Node) *Node {
+ switch n.Op {
+ case OAS:
+ return n.Left
+ case OAS2DOTTYPE, OAS2FUNC, OAS2RECV, OAS2MAPR:
+ return n.List.First()
+ }
+
+ Fatalf("unexpected Op: %v", n.Op)
+ return nil
+}
diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go
index 51b60fb417..2a1fd8e4fa 100644
--- a/src/cmd/compile/internal/gc/main.go
+++ b/src/cmd/compile/internal/gc/main.go
@@ -190,6 +190,10 @@ func Main(archInit func(*Arch)) {
Nacl = objabi.GOOS == "nacl"
Wasm := objabi.GOARCH == "wasm"
+ // Whether the limit for stack-allocated objects is much smaller than normal.
+ // This can be helpful for diagnosing certain causes of GC latency. See #27732.
+ smallFrames := false
+
flag.BoolVar(&compiling_runtime, "+", false, "compiling runtime")
flag.BoolVar(&compiling_std, "std", false, "compiling standard library")
objabi.Flagcount("%", "debug non-static initializers", &Debug['%'])
@@ -255,19 +259,24 @@ func Main(archInit func(*Arch)) {
flag.StringVar(&goversion, "goversion", "", "required version of the runtime")
var symabisPath string
flag.StringVar(&symabisPath, "symabis", "", "read symbol ABIs from `file`")
- flag.BoolVar(&allABIs, "allabis", false, "generate ABI wrappers for all symbols (for bootstrap)")
flag.StringVar(&traceprofile, "traceprofile", "", "write an execution trace to `file`")
flag.StringVar(&blockprofile, "blockprofile", "", "write block profile to `file`")
flag.StringVar(&mutexprofile, "mutexprofile", "", "write mutex profile to `file`")
flag.StringVar(&benchfile, "bench", "", "append benchmark times to `file`")
flag.BoolVar(&newescape, "newescape", true, "enable new escape analysis")
+ flag.BoolVar(&smallFrames, "smallframes", false, "reduce the size limit for stack allocated objects")
flag.BoolVar(&Ctxt.UseBASEntries, "dwarfbasentries", Ctxt.UseBASEntries, "use base address selection entries in DWARF")
objabi.Flagparse(usage)
// Record flags that affect the build result. (And don't
// record flags that don't, since that would cause spurious
// changes in the binary.)
- recordFlags("B", "N", "l", "msan", "race", "shared", "dynlink", "dwarflocationlists", "newescape", "dwarfbasentries")
+ recordFlags("B", "N", "l", "msan", "race", "shared", "dynlink", "dwarflocationlists", "newescape", "dwarfbasentries", "smallframes")
+
+ if smallFrames {
+ maxStackVarSize = 128 * 1024
+ maxImplicitStackVarSize = 16 * 1024
+ }
Ctxt.Flag_shared = flag_dynlink || flag_shared
Ctxt.Flag_dynlink = flag_dynlink
@@ -839,11 +848,6 @@ func readImportCfg(file string) {
// name, where the local package prefix is always `"".`
var symabiDefs, symabiRefs map[string]obj.ABI
-// allABIs indicates that all symbol definitions should have ABI
-// wrappers. This is used during toolchain bootstrapping to avoid
-// having to find cross-package references.
-var allABIs bool
-
// readSymABIs reads a symabis file that specifies definitions and
// references of text symbols by ABI.
//
diff --git a/src/cmd/compile/internal/gc/noder.go b/src/cmd/compile/internal/gc/noder.go
index e83ae7c5eb..93d355278e 100644
--- a/src/cmd/compile/internal/gc/noder.go
+++ b/src/cmd/compile/internal/gc/noder.go
@@ -244,10 +244,21 @@ func (p *noder) node() {
xtop = append(xtop, p.decls(p.file.DeclList)...)
for _, n := range p.linknames {
- if imported_unsafe {
- lookup(n.local).Linkname = n.remote
- } else {
+ if !imported_unsafe {
p.yyerrorpos(n.pos, "//go:linkname only allowed in Go files that import \"unsafe\"")
+ continue
+ }
+ s := lookup(n.local)
+ if n.remote != "" {
+ s.Linkname = n.remote
+ } else {
+ // Use the default object symbol name if the
+ // user didn't provide one.
+ if myimportpath == "" {
+ p.yyerrorpos(n.pos, "//go:linkname requires linkname argument or -p compiler flag")
+ } else {
+ s.Linkname = objabi.PathToPrefix(myimportpath) + "." + n.local
+ }
}
}
@@ -1476,11 +1487,20 @@ func (p *noder) pragma(pos syntax.Pos, text string) syntax.Pragma {
case strings.HasPrefix(text, "go:linkname "):
f := strings.Fields(text)
- if len(f) != 3 {
- p.error(syntax.Error{Pos: pos, Msg: "usage: //go:linkname localname linkname"})
+ if !(2 <= len(f) && len(f) <= 3) {
+ p.error(syntax.Error{Pos: pos, Msg: "usage: //go:linkname localname [linkname]"})
break
}
- p.linknames = append(p.linknames, linkname{pos, f[1], f[2]})
+ // The second argument is optional. If omitted, we use
+ // the default object symbol name for this and
+ // linkname only serves to mark this symbol as
+ // something that may be referenced via the object
+ // symbol name from another package.
+ var target string
+ if len(f) == 3 {
+ target = f[2]
+ }
+ p.linknames = append(p.linknames, linkname{pos, f[1], target})
case strings.HasPrefix(text, "go:cgo_import_dynamic "):
// This is permitted for general use because Solaris
diff --git a/src/cmd/compile/internal/gc/op_string.go b/src/cmd/compile/internal/gc/op_string.go
index d8910e7d06..796e13a071 100644
--- a/src/cmd/compile/internal/gc/op_string.go
+++ b/src/cmd/compile/internal/gc/op_string.go
@@ -30,10 +30,10 @@ func _() {
_ = x[OSTR2RUNES-19]
_ = x[OAS-20]
_ = x[OAS2-21]
- _ = x[OAS2FUNC-22]
- _ = x[OAS2RECV-23]
+ _ = x[OAS2DOTTYPE-22]
+ _ = x[OAS2FUNC-23]
_ = x[OAS2MAPR-24]
- _ = x[OAS2DOTTYPE-25]
+ _ = x[OAS2RECV-25]
_ = x[OASOP-26]
_ = x[OCALL-27]
_ = x[OCALLFUNC-28]
@@ -164,9 +164,9 @@ func _() {
_ = x[OEND-153]
}
-const _Op_name = "XXXNAMENONAMETYPEPACKLITERALADDSUBORXORADDSTRADDRANDANDAPPENDBYTES2STRBYTES2STRTMPRUNES2STRSTR2BYTESSTR2BYTESTMPSTR2RUNESASAS2AS2FUNCAS2RECVAS2MAPRAS2DOTTYPEASOPCALLCALLFUNCCALLMETHCALLINTERCALLPARTCAPCLOSECLOSURECOMPLITMAPLITSTRUCTLITARRAYLITSLICELITPTRLITCONVCONVIFACECONVNOPCOPYDCLDCLFUNCDCLFIELDDCLCONSTDCLTYPEDELETEDOTDOTPTRDOTMETHDOTINTERXDOTDOTTYPEDOTTYPE2EQNELTLEGEGTDEREFINDEXINDEXMAPKEYSTRUCTKEYLENMAKEMAKECHANMAKEMAPMAKESLICEMULDIVMODLSHRSHANDANDNOTNEWNEWOBJNOTBITNOTPLUSNEGORORPANICPRINTPRINTNPARENSENDSLICESLICEARRSLICESTRSLICE3SLICE3ARRSLICEHEADERRECOVERRECVRUNESTRSELRECVSELRECV2IOTAREALIMAGCOMPLEXALIGNOFOFFSETOFSIZEOFBLOCKBREAKCASEXCASECONTINUEDEFEREMPTYFALLFORFORUNTILGOTOIFLABELGORANGERETURNSELECTSWITCHTYPESWTCHANTMAPTSTRUCTTINTERTFUNCTARRAYDDDDDDARGINLCALLEFACEITABIDATASPTRCLOSUREVARCFUNCCHECKNILVARDEFVARKILLVARLIVERESULTINLMARKRETJMPGETGEND"
+const _Op_name = "XXXNAMENONAMETYPEPACKLITERALADDSUBORXORADDSTRADDRANDANDAPPENDBYTES2STRBYTES2STRTMPRUNES2STRSTR2BYTESSTR2BYTESTMPSTR2RUNESASAS2AS2DOTTYPEAS2FUNCAS2MAPRAS2RECVASOPCALLCALLFUNCCALLMETHCALLINTERCALLPARTCAPCLOSECLOSURECOMPLITMAPLITSTRUCTLITARRAYLITSLICELITPTRLITCONVCONVIFACECONVNOPCOPYDCLDCLFUNCDCLFIELDDCLCONSTDCLTYPEDELETEDOTDOTPTRDOTMETHDOTINTERXDOTDOTTYPEDOTTYPE2EQNELTLEGEGTDEREFINDEXINDEXMAPKEYSTRUCTKEYLENMAKEMAKECHANMAKEMAPMAKESLICEMULDIVMODLSHRSHANDANDNOTNEWNEWOBJNOTBITNOTPLUSNEGORORPANICPRINTPRINTNPARENSENDSLICESLICEARRSLICESTRSLICE3SLICE3ARRSLICEHEADERRECOVERRECVRUNESTRSELRECVSELRECV2IOTAREALIMAGCOMPLEXALIGNOFOFFSETOFSIZEOFBLOCKBREAKCASEXCASECONTINUEDEFEREMPTYFALLFORFORUNTILGOTOIFLABELGORANGERETURNSELECTSWITCHTYPESWTCHANTMAPTSTRUCTTINTERTFUNCTARRAYDDDDDDARGINLCALLEFACEITABIDATASPTRCLOSUREVARCFUNCCHECKNILVARDEFVARKILLVARLIVERESULTINLMARKRETJMPGETGEND"
-var _Op_index = [...]uint16{0, 3, 7, 13, 17, 21, 28, 31, 34, 36, 39, 45, 49, 55, 61, 70, 82, 91, 100, 112, 121, 123, 126, 133, 140, 147, 157, 161, 165, 173, 181, 190, 198, 201, 206, 213, 220, 226, 235, 243, 251, 257, 261, 270, 277, 281, 284, 291, 299, 307, 314, 320, 323, 329, 336, 344, 348, 355, 363, 365, 367, 369, 371, 373, 375, 380, 385, 393, 396, 405, 408, 412, 420, 427, 436, 439, 442, 445, 448, 451, 454, 460, 463, 469, 472, 478, 482, 485, 489, 494, 499, 505, 510, 514, 519, 527, 535, 541, 550, 561, 568, 572, 579, 586, 594, 598, 602, 606, 613, 620, 628, 634, 639, 644, 648, 653, 661, 666, 671, 675, 678, 686, 690, 692, 697, 699, 704, 710, 716, 722, 728, 733, 737, 744, 750, 755, 761, 764, 770, 777, 782, 786, 791, 795, 805, 810, 818, 824, 831, 838, 844, 851, 857, 861, 864}
+var _Op_index = [...]uint16{0, 3, 7, 13, 17, 21, 28, 31, 34, 36, 39, 45, 49, 55, 61, 70, 82, 91, 100, 112, 121, 123, 126, 136, 143, 150, 157, 161, 165, 173, 181, 190, 198, 201, 206, 213, 220, 226, 235, 243, 251, 257, 261, 270, 277, 281, 284, 291, 299, 307, 314, 320, 323, 329, 336, 344, 348, 355, 363, 365, 367, 369, 371, 373, 375, 380, 385, 393, 396, 405, 408, 412, 420, 427, 436, 439, 442, 445, 448, 451, 454, 460, 463, 469, 472, 478, 482, 485, 489, 494, 499, 505, 510, 514, 519, 527, 535, 541, 550, 561, 568, 572, 579, 586, 594, 598, 602, 606, 613, 620, 628, 634, 639, 644, 648, 653, 661, 666, 671, 675, 678, 686, 690, 692, 697, 699, 704, 710, 716, 722, 728, 733, 737, 744, 750, 755, 761, 764, 770, 777, 782, 786, 791, 795, 805, 810, 818, 824, 831, 838, 844, 851, 857, 861, 864}
func (i Op) String() string {
if i >= Op(len(_Op_index)-1) {
diff --git a/src/cmd/compile/internal/gc/reflect.go b/src/cmd/compile/internal/gc/reflect.go
index eade8f4a5e..5c0d9d1afa 100644
--- a/src/cmd/compile/internal/gc/reflect.go
+++ b/src/cmd/compile/internal/gc/reflect.go
@@ -317,6 +317,48 @@ func hiter(t *types.Type) *types.Type {
return hiter
}
+// deferstruct makes a runtime._defer structure, with additional space for
+// stksize bytes of args.
+func deferstruct(stksize int64) *types.Type {
+ makefield := func(name string, typ *types.Type) *types.Field {
+ f := types.NewField()
+ f.Type = typ
+ // Unlike the global makefield function, this one needs to set Pkg
+ // because these types might be compared (in SSA CSE sorting).
+ // TODO: unify this makefield and the global one above.
+ f.Sym = &types.Sym{Name: name, Pkg: localpkg}
+ return f
+ }
+ argtype := types.NewArray(types.Types[TUINT8], stksize)
+ argtype.SetNoalg(true)
+ argtype.Width = stksize
+ argtype.Align = 1
+ // These fields must match the ones in runtime/runtime2.go:_defer and
+ // cmd/compile/internal/gc/ssa.go:(*state).call.
+ fields := []*types.Field{
+ makefield("siz", types.Types[TUINT32]),
+ makefield("started", types.Types[TBOOL]),
+ makefield("heap", types.Types[TBOOL]),
+ makefield("sp", types.Types[TUINTPTR]),
+ makefield("pc", types.Types[TUINTPTR]),
+ // Note: the types here don't really matter. Defer structures
+ // are always scanned explicitly during stack copying and GC,
+ // so we make them uintptr type even though they are real pointers.
+ makefield("fn", types.Types[TUINTPTR]),
+ makefield("_panic", types.Types[TUINTPTR]),
+ makefield("link", types.Types[TUINTPTR]),
+ makefield("args", argtype),
+ }
+
+ // build struct holding the above fields
+ s := types.New(TSTRUCT)
+ s.SetNoalg(true)
+ s.SetFields(fields)
+ s.Width = widstruct(s, s, 0, 1)
+ s.Align = uint8(Widthptr)
+ return s
+}
+
// f is method type, with receiver.
// return function type, receiver as first argument (or not).
func methodfunc(f *types.Type, receiver *types.Type) *types.Type {
diff --git a/src/cmd/compile/internal/gc/sinit.go b/src/cmd/compile/internal/gc/sinit.go
index eaccde99c1..a506bfe31f 100644
--- a/src/cmd/compile/internal/gc/sinit.go
+++ b/src/cmd/compile/internal/gc/sinit.go
@@ -9,14 +9,6 @@ import (
"fmt"
)
-// Static initialization ordering state.
-// These values are stored in two bits in Node.flags.
-const (
- InitNotStarted = iota
- InitDone
- InitPending
-)
-
type InitEntry struct {
Xoffset int64 // struct, array only
Expr *Node // bytes of run-time computed expressions
@@ -26,9 +18,15 @@ type InitPlan struct {
E []InitEntry
}
+// An InitSchedule is used to decompose assignment statements into
+// static and dynamic initialization parts. Static initializations are
+// handled by populating variables' linker symbol data, while dynamic
+// initializations are accumulated to be executed in order.
type InitSchedule struct {
- out []*Node
- initlist []*Node
+ // out is the ordered list of dynamic initialization
+ // statements.
+ out []*Node
+
initplans map[*Node]*InitPlan
inittemps map[*Node]*Node
}
@@ -37,239 +35,33 @@ func (s *InitSchedule) append(n *Node) {
s.out = append(s.out, n)
}
-// init1 walks the AST starting at n, and accumulates in out
-// the list of definitions needing init code in dependency order.
-func (s *InitSchedule) init1(n *Node) {
- if n == nil {
- return
- }
- s.init1(n.Left)
- s.init1(n.Right)
- for _, n1 := range n.List.Slice() {
- s.init1(n1)
- }
-
- if n.isMethodExpression() {
- // Methods called as Type.Method(receiver, ...).
- // Definitions for method expressions are stored in type->nname.
- s.init1(asNode(n.Type.FuncType().Nname))
- }
-
- if n.Op != ONAME {
- return
- }
- switch n.Class() {
- case PEXTERN, PFUNC:
- default:
- if n.isBlank() && n.Name.Curfn == nil && n.Name.Defn != nil && n.Name.Defn.Initorder() == InitNotStarted {
- // blank names initialization is part of init() but not
- // when they are inside a function.
- break
+// staticInit adds an initialization statement n to the schedule.
+func (s *InitSchedule) staticInit(n *Node) {
+ if !s.tryStaticInit(n) {
+ if Debug['%'] != 0 {
+ Dump("nonstatic", n)
}
- return
- }
-
- if n.Initorder() == InitDone {
- return
- }
- if n.Initorder() == InitPending {
- // Since mutually recursive sets of functions are allowed,
- // we don't necessarily raise an error if n depends on a node
- // which is already waiting for its dependencies to be visited.
- //
- // initlist contains a cycle of identifiers referring to each other.
- // If this cycle contains a variable, then this variable refers to itself.
- // Conversely, if there exists an initialization cycle involving
- // a variable in the program, the tree walk will reach a cycle
- // involving that variable.
- if n.Class() != PFUNC {
- s.foundinitloop(n, n)
- }
-
- for i := len(s.initlist) - 1; i >= 0; i-- {
- x := s.initlist[i]
- if x == n {
- break
- }
- if x.Class() != PFUNC {
- s.foundinitloop(n, x)
- }
- }
-
- // The loop involves only functions, ok.
- return
- }
-
- // reached a new unvisited node.
- n.SetInitorder(InitPending)
- s.initlist = append(s.initlist, n)
-
- // make sure that everything n depends on is initialized.
- // n->defn is an assignment to n
- if defn := n.Name.Defn; defn != nil {
- switch defn.Op {
- default:
- Dump("defn", defn)
- Fatalf("init1: bad defn")
-
- case ODCLFUNC:
- s.init2list(defn.Nbody)
-
- case OAS:
- if defn.Left != n {
- Dump("defn", defn)
- Fatalf("init1: bad defn")
- }
- if defn.Left.isBlank() && candiscard(defn.Right) {
- defn.Op = OEMPTY
- defn.Left = nil
- defn.Right = nil
- break
- }
-
- s.init2(defn.Right)
- if Debug['j'] != 0 {
- fmt.Printf("%v\n", n.Sym)
- }
- if n.isBlank() || !s.staticinit(n) {
- if Debug['%'] != 0 {
- Dump("nonstatic", defn)
- }
- s.append(defn)
- }
-
- case OAS2FUNC, OAS2MAPR, OAS2DOTTYPE, OAS2RECV:
- if defn.Initorder() == InitDone {
- break
- }
- defn.SetInitorder(InitPending)
- for _, n2 := range defn.Rlist.Slice() {
- s.init1(n2)
- }
- if Debug['%'] != 0 {
- Dump("nonstatic", defn)
- }
- s.append(defn)
- defn.SetInitorder(InitDone)
- }
- }
-
- last := len(s.initlist) - 1
- if s.initlist[last] != n {
- Fatalf("bad initlist %v", s.initlist)
- }
- s.initlist[last] = nil // allow GC
- s.initlist = s.initlist[:last]
-
- n.SetInitorder(InitDone)
-}
-
-// foundinitloop prints an init loop error and exits.
-func (s *InitSchedule) foundinitloop(node, visited *Node) {
- // If there have already been errors printed,
- // those errors probably confused us and
- // there might not be a loop. Let the user
- // fix those first.
- flusherrors()
- if nerrors > 0 {
- errorexit()
- }
-
- // Find the index of node and visited in the initlist.
- var nodeindex, visitedindex int
- for ; s.initlist[nodeindex] != node; nodeindex++ {
- }
- for ; s.initlist[visitedindex] != visited; visitedindex++ {
- }
-
- // There is a loop involving visited. We know about node and
- // initlist = n1 <- ... <- visited <- ... <- node <- ...
- fmt.Printf("%v: initialization loop:\n", visited.Line())
-
- // Print visited -> ... -> n1 -> node.
- for _, n := range s.initlist[visitedindex:] {
- fmt.Printf("\t%v %v refers to\n", n.Line(), n.Sym)
- }
-
- // Print node -> ... -> visited.
- for _, n := range s.initlist[nodeindex:visitedindex] {
- fmt.Printf("\t%v %v refers to\n", n.Line(), n.Sym)
- }
-
- fmt.Printf("\t%v %v\n", visited.Line(), visited.Sym)
- errorexit()
-}
-
-// recurse over n, doing init1 everywhere.
-func (s *InitSchedule) init2(n *Node) {
- if n == nil || n.Initorder() == InitDone {
- return
- }
-
- if n.Op == ONAME && n.Ninit.Len() != 0 {
- Fatalf("name %v with ninit: %+v\n", n.Sym, n)
- }
-
- s.init1(n)
- s.init2(n.Left)
- s.init2(n.Right)
- s.init2list(n.Ninit)
- s.init2list(n.List)
- s.init2list(n.Rlist)
- s.init2list(n.Nbody)
-
- switch n.Op {
- case OCLOSURE:
- s.init2list(n.Func.Closure.Nbody)
- case ODOTMETH, OCALLPART:
- s.init2(asNode(n.Type.FuncType().Nname))
+ s.append(n)
}
}
-func (s *InitSchedule) init2list(l Nodes) {
- for _, n := range l.Slice() {
- s.init2(n)
+// tryStaticInit attempts to statically execute an initialization
+// statement and reports whether it succeeded.
+func (s *InitSchedule) tryStaticInit(n *Node) bool {
+ // Only worry about simple "l = r" assignments. Multiple
+ // variable/expression OAS2 assignments have already been
+ // replaced by multiple simple OAS assignments, and the other
+ // OAS2* assignments mostly necessitate dynamic execution
+ // anyway.
+ if n.Op != OAS {
+ return false
}
-}
-
-func (s *InitSchedule) initreorder(l []*Node) {
- for _, n := range l {
- switch n.Op {
- case ODCLFUNC, ODCLCONST, ODCLTYPE:
- continue
- }
-
- s.initreorder(n.Ninit.Slice())
- n.Ninit.Set(nil)
- s.init1(n)
+ if n.Left.isBlank() && candiscard(n.Right) {
+ return true
}
-}
-
-// initfix computes initialization order for a list l of top-level
-// declarations and outputs the corresponding list of statements
-// to include in the init() function body.
-func initfix(l []*Node) []*Node {
- s := InitSchedule{
- initplans: make(map[*Node]*InitPlan),
- inittemps: make(map[*Node]*Node),
- }
- lno := lineno
- s.initreorder(l)
- lineno = lno
- return s.out
-}
-
-// compilation of top-level (static) assignments
-// into DATA statements if at all possible.
-func (s *InitSchedule) staticinit(n *Node) bool {
- if n.Op != ONAME || n.Class() != PEXTERN || n.Name.Defn == nil || n.Name.Defn.Op != OAS {
- Fatalf("staticinit")
- }
-
- lineno = n.Pos
- l := n.Name.Defn.Left
- r := n.Name.Defn.Right
- return s.staticassign(l, r)
+ lno := setlineno(n)
+ defer func() { lineno = lno }()
+ return s.staticassign(n.Left, n.Right)
}
// like staticassign but we are copying an already
diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go
index f9ccf84f72..5509e3d182 100644
--- a/src/cmd/compile/internal/gc/ssa.go
+++ b/src/cmd/compile/internal/gc/ssa.go
@@ -68,6 +68,7 @@ func initssaconfig() {
assertI2I = sysfunc("assertI2I")
assertI2I2 = sysfunc("assertI2I2")
deferproc = sysfunc("deferproc")
+ deferprocStack = sysfunc("deferprocStack")
Deferreturn = sysfunc("deferreturn")
Duffcopy = sysvar("duffcopy") // asm func with special ABI
Duffzero = sysvar("duffzero") // asm func with special ABI
@@ -864,7 +865,11 @@ func (s *state) stmt(n *Node) {
}
}
case ODEFER:
- s.call(n.Left, callDefer)
+ d := callDefer
+ if n.Esc == EscNever {
+ d = callDeferStack
+ }
+ s.call(n.Left, d)
case OGO:
s.call(n.Left, callGo)
@@ -2859,6 +2864,7 @@ type callKind int8
const (
callNormal callKind = iota
callDefer
+ callDeferStack
callGo
)
@@ -3093,7 +3099,7 @@ func init() {
s.vars[&memVar] = s.newValue1(ssa.OpSelect1, types.TypeMem, v)
return s.newValue1(ssa.OpSelect0, types.Types[TUINT32], v)
},
- sys.PPC64)
+ sys.PPC64, sys.S390X)
addF("runtime/internal/atomic", "Loadp",
func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
v := s.newValue2(ssa.OpAtomicLoadPtr, types.NewTuple(s.f.Config.Types.BytePtr, types.TypeMem), args[0], s.mem())
@@ -3125,7 +3131,7 @@ func init() {
s.vars[&memVar] = s.newValue3(ssa.OpAtomicStoreRel32, types.TypeMem, args[0], args[1], s.mem())
return nil
},
- sys.PPC64)
+ sys.PPC64, sys.S390X)
addF("runtime/internal/atomic", "Xchg",
func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
@@ -3658,9 +3664,6 @@ func init() {
// findIntrinsic returns a function which builds the SSA equivalent of the
// function identified by the symbol sym. If sym is not an intrinsic call, returns nil.
func findIntrinsic(sym *types.Sym) intrinsicBuilder {
- if ssa.IntrinsicsDisable {
- return nil
- }
if sym == nil || sym.Pkg == nil {
return nil
}
@@ -3680,6 +3683,13 @@ func findIntrinsic(sym *types.Sym) intrinsicBuilder {
}
fn := sym.Name
+ if ssa.IntrinsicsDisable {
+ if pkg == "runtime" && (fn == "getcallerpc" || fn == "getcallersp" || fn == "getclosureptr") {
+ // These runtime functions don't have definitions, must be intrinsics.
+ } else {
+ return nil
+ }
+ }
return intrinsics[intrinsicKey{thearch.LinkArch.Arch, pkg, fn}]
}
@@ -3795,74 +3805,132 @@ func (s *state) call(n *Node, k callKind) *ssa.Value {
rcvr = s.newValue1(ssa.OpIData, types.Types[TUINTPTR], i)
}
dowidth(fn.Type)
- stksize := fn.Type.ArgWidth() // includes receiver
+ stksize := fn.Type.ArgWidth() // includes receiver, args, and results
// Run all assignments of temps.
// The temps are introduced to avoid overwriting argument
// slots when arguments themselves require function calls.
s.stmtList(n.List)
- // Store arguments to stack, including defer/go arguments and receiver for method calls.
- // These are written in SP-offset order.
- argStart := Ctxt.FixedFrameSize()
- // Defer/go args.
- if k != callNormal {
- // Write argsize and closure (args to newproc/deferproc).
- argsize := s.constInt32(types.Types[TUINT32], int32(stksize))
- addr := s.constOffPtrSP(s.f.Config.Types.UInt32Ptr, argStart)
- s.store(types.Types[TUINT32], addr, argsize)
- addr = s.constOffPtrSP(s.f.Config.Types.UintptrPtr, argStart+int64(Widthptr))
- s.store(types.Types[TUINTPTR], addr, closure)
- stksize += 2 * int64(Widthptr)
- argStart += 2 * int64(Widthptr)
- }
-
- // Set receiver (for interface calls).
- if rcvr != nil {
- addr := s.constOffPtrSP(s.f.Config.Types.UintptrPtr, argStart)
- s.store(types.Types[TUINTPTR], addr, rcvr)
- }
-
- // Write args.
- t := n.Left.Type
- args := n.Rlist.Slice()
- if n.Op == OCALLMETH {
- f := t.Recv()
- s.storeArg(args[0], f.Type, argStart+f.Offset)
- args = args[1:]
- }
- for i, n := range args {
- f := t.Params().Field(i)
- s.storeArg(n, f.Type, argStart+f.Offset)
- }
-
- // call target
var call *ssa.Value
- switch {
- case k == callDefer:
- call = s.newValue1A(ssa.OpStaticCall, types.TypeMem, deferproc, s.mem())
- case k == callGo:
- call = s.newValue1A(ssa.OpStaticCall, types.TypeMem, newproc, s.mem())
- case closure != nil:
- // rawLoad because loading the code pointer from a
- // closure is always safe, but IsSanitizerSafeAddr
- // can't always figure that out currently, and it's
- // critical that we not clobber any arguments already
- // stored onto the stack.
- codeptr = s.rawLoad(types.Types[TUINTPTR], closure)
- call = s.newValue3(ssa.OpClosureCall, types.TypeMem, codeptr, closure, s.mem())
- case codeptr != nil:
- call = s.newValue2(ssa.OpInterCall, types.TypeMem, codeptr, s.mem())
- case sym != nil:
- call = s.newValue1A(ssa.OpStaticCall, types.TypeMem, sym.Linksym(), s.mem())
- default:
- Fatalf("bad call type %v %v", n.Op, n)
+ if k == callDeferStack {
+ // Make a defer struct d on the stack.
+ t := deferstruct(stksize)
+ d := tempAt(n.Pos, s.curfn, t)
+
+ s.vars[&memVar] = s.newValue1A(ssa.OpVarDef, types.TypeMem, d, s.mem())
+ addr := s.addr(d, false)
+
+ // Must match reflect.go:deferstruct and src/runtime/runtime2.go:_defer.
+ // 0: siz
+ s.store(types.Types[TUINT32],
+ s.newValue1I(ssa.OpOffPtr, types.Types[TUINT32].PtrTo(), t.FieldOff(0), addr),
+ s.constInt32(types.Types[TUINT32], int32(stksize)))
+ // 1: started, set in deferprocStack
+ // 2: heap, set in deferprocStack
+ // 3: sp, set in deferprocStack
+ // 4: pc, set in deferprocStack
+ // 5: fn
+ s.store(closure.Type,
+ s.newValue1I(ssa.OpOffPtr, closure.Type.PtrTo(), t.FieldOff(5), addr),
+ closure)
+ // 6: panic, set in deferprocStack
+ // 7: link, set in deferprocStack
+
+ // Then, store all the arguments of the defer call.
+ ft := fn.Type
+ off := t.FieldOff(8)
+ args := n.Rlist.Slice()
+
+ // Set receiver (for interface calls). Always a pointer.
+ if rcvr != nil {
+ p := s.newValue1I(ssa.OpOffPtr, ft.Recv().Type.PtrTo(), off, addr)
+ s.store(types.Types[TUINTPTR], p, rcvr)
+ }
+ // Set receiver (for method calls).
+ if n.Op == OCALLMETH {
+ f := ft.Recv()
+ s.storeArgWithBase(args[0], f.Type, addr, off+f.Offset)
+ args = args[1:]
+ }
+ // Set other args.
+ for _, f := range ft.Params().Fields().Slice() {
+ s.storeArgWithBase(args[0], f.Type, addr, off+f.Offset)
+ args = args[1:]
+ }
+
+ // Call runtime.deferprocStack with pointer to _defer record.
+ arg0 := s.constOffPtrSP(types.Types[TUINTPTR], Ctxt.FixedFrameSize())
+ s.store(types.Types[TUINTPTR], arg0, addr)
+ call = s.newValue1A(ssa.OpStaticCall, types.TypeMem, deferprocStack, s.mem())
+ if stksize < int64(Widthptr) {
+ // We need room for both the call to deferprocStack and the call to
+ // the deferred function.
+ stksize = int64(Widthptr)
+ }
+ call.AuxInt = stksize
+ } else {
+ // Store arguments to stack, including defer/go arguments and receiver for method calls.
+ // These are written in SP-offset order.
+ argStart := Ctxt.FixedFrameSize()
+ // Defer/go args.
+ if k != callNormal {
+ // Write argsize and closure (args to newproc/deferproc).
+ argsize := s.constInt32(types.Types[TUINT32], int32(stksize))
+ addr := s.constOffPtrSP(s.f.Config.Types.UInt32Ptr, argStart)
+ s.store(types.Types[TUINT32], addr, argsize)
+ addr = s.constOffPtrSP(s.f.Config.Types.UintptrPtr, argStart+int64(Widthptr))
+ s.store(types.Types[TUINTPTR], addr, closure)
+ stksize += 2 * int64(Widthptr)
+ argStart += 2 * int64(Widthptr)
+ }
+
+ // Set receiver (for interface calls).
+ if rcvr != nil {
+ addr := s.constOffPtrSP(s.f.Config.Types.UintptrPtr, argStart)
+ s.store(types.Types[TUINTPTR], addr, rcvr)
+ }
+
+ // Write args.
+ t := n.Left.Type
+ args := n.Rlist.Slice()
+ if n.Op == OCALLMETH {
+ f := t.Recv()
+ s.storeArg(args[0], f.Type, argStart+f.Offset)
+ args = args[1:]
+ }
+ for i, n := range args {
+ f := t.Params().Field(i)
+ s.storeArg(n, f.Type, argStart+f.Offset)
+ }
+
+ // call target
+ switch {
+ case k == callDefer:
+ call = s.newValue1A(ssa.OpStaticCall, types.TypeMem, deferproc, s.mem())
+ case k == callGo:
+ call = s.newValue1A(ssa.OpStaticCall, types.TypeMem, newproc, s.mem())
+ case closure != nil:
+ // rawLoad because loading the code pointer from a
+ // closure is always safe, but IsSanitizerSafeAddr
+ // can't always figure that out currently, and it's
+ // critical that we not clobber any arguments already
+ // stored onto the stack.
+ codeptr = s.rawLoad(types.Types[TUINTPTR], closure)
+ call = s.newValue3(ssa.OpClosureCall, types.TypeMem, codeptr, closure, s.mem())
+ case codeptr != nil:
+ call = s.newValue2(ssa.OpInterCall, types.TypeMem, codeptr, s.mem())
+ case sym != nil:
+ call = s.newValue1A(ssa.OpStaticCall, types.TypeMem, sym.Linksym(), s.mem())
+ default:
+ Fatalf("bad call type %v %v", n.Op, n)
+ }
+ call.AuxInt = stksize // Call operations carry the argsize of the callee along with them
}
- call.AuxInt = stksize // Call operations carry the argsize of the callee along with them
s.vars[&memVar] = call
// Finish block for defers
- if k == callDefer {
+ if k == callDefer || k == callDeferStack {
b := s.endBlock()
b.Kind = ssa.BlockDefer
b.SetControl(call)
@@ -4357,17 +4425,27 @@ func (s *state) storeTypePtrs(t *types.Type, left, right *ssa.Value) {
}
func (s *state) storeArg(n *Node, t *types.Type, off int64) {
+ s.storeArgWithBase(n, t, s.sp, off)
+}
+
+func (s *state) storeArgWithBase(n *Node, t *types.Type, base *ssa.Value, off int64) {
pt := types.NewPtr(t)
- sp := s.constOffPtrSP(pt, off)
+ var addr *ssa.Value
+ if base == s.sp {
+ // Use special routine that avoids allocation on duplicate offsets.
+ addr = s.constOffPtrSP(pt, off)
+ } else {
+ addr = s.newValue1I(ssa.OpOffPtr, pt, off, base)
+ }
if !canSSAType(t) {
a := s.addr(n, false)
- s.move(t, sp, a)
+ s.move(t, addr, a)
return
}
a := s.expr(n)
- s.storeType(t, sp, a, 0, false)
+ s.storeType(t, addr, a, 0, false)
}
// slice computes the slice v[i:j:k] and returns ptr, len, and cap of result.
diff --git a/src/cmd/compile/internal/gc/syntax.go b/src/cmd/compile/internal/gc/syntax.go
index 9f6646af44..dec72690bf 100644
--- a/src/cmd/compile/internal/gc/syntax.go
+++ b/src/cmd/compile/internal/gc/syntax.go
@@ -12,6 +12,7 @@ import (
"cmd/compile/internal/types"
"cmd/internal/obj"
"cmd/internal/src"
+ "sort"
)
// A Node is a single node in the syntax tree.
@@ -598,10 +599,10 @@ const (
OSTR2RUNES // Type(Left) (Type is []rune, Left is a string)
OAS // Left = Right or (if Colas=true) Left := Right
OAS2 // List = Rlist (x, y, z = a, b, c)
- OAS2FUNC // List = Rlist (x, y = f())
- OAS2RECV // List = Rlist (x, ok = <-c)
- OAS2MAPR // List = Rlist (x, ok = m["foo"])
OAS2DOTTYPE // List = Rlist (x, ok = I.(int))
+ OAS2FUNC // List = Rlist (x, y = f())
+ OAS2MAPR // List = Rlist (x, ok = m["foo"])
+ OAS2RECV // List = Rlist (x, ok = <-c)
OASOP // Left Etype= Right (x += y)
OCALL // Left(List) (function call, method call or type conversion)
@@ -970,3 +971,30 @@ func (q *nodeQueue) popLeft() *Node {
q.head++
return n
}
+
+// NodeSet is a set of Nodes.
+type NodeSet map[*Node]struct{}
+
+// Has reports whether s contains n.
+func (s NodeSet) Has(n *Node) bool {
+ _, isPresent := s[n]
+ return isPresent
+}
+
+// Add adds n to s.
+func (s *NodeSet) Add(n *Node) {
+ if *s == nil {
+ *s = make(map[*Node]struct{})
+ }
+ (*s)[n] = struct{}{}
+}
+
+// Sorted returns s sorted according to less.
+func (s NodeSet) Sorted(less func(*Node, *Node) bool) []*Node {
+ var res []*Node
+ for n := range s {
+ res = append(res, n)
+ }
+ sort.Slice(res, func(i, j int) bool { return less(res[i], res[j]) })
+ return res
+}
diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go
index 679c86fab6..a8cc313b76 100644
--- a/src/cmd/compile/internal/gc/walk.go
+++ b/src/cmd/compile/internal/gc/walk.go
@@ -1393,7 +1393,7 @@ opswitch:
// Allocate a [n]byte of the right size.
t := types.NewArray(types.Types[TUINT8], int64(len(sc)))
var a *Node
- if n.Esc == EscNone && len(sc) <= maxImplicitStackVarSize {
+ if n.Esc == EscNone && len(sc) <= int(maxImplicitStackVarSize) {
a = nod(OADDR, temp(t), nil)
} else {
a = callnew(t)
diff --git a/src/cmd/compile/internal/s390x/ssa.go b/src/cmd/compile/internal/s390x/ssa.go
index 7a897ae754..7ddebe7b64 100644
--- a/src/cmd/compile/internal/s390x/ssa.go
+++ b/src/cmd/compile/internal/s390x/ssa.go
@@ -800,6 +800,8 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
bne := s.Prog(s390x.ABNE)
bne.To.Type = obj.TYPE_BRANCH
gc.Patch(bne, cs)
+ case ssa.OpS390XSYNC:
+ s.Prog(s390x.ASYNC)
case ssa.OpClobber:
// TODO: implement for clobberdead experiment. Nop is ok for now.
default:
diff --git a/src/cmd/compile/internal/ssa/cse_test.go b/src/cmd/compile/internal/ssa/cse_test.go
index b139701990..9e76645f54 100644
--- a/src/cmd/compile/internal/ssa/cse_test.go
+++ b/src/cmd/compile/internal/ssa/cse_test.go
@@ -6,6 +6,7 @@ package ssa
import (
"cmd/compile/internal/types"
+ "cmd/internal/src"
"testing"
)
@@ -19,6 +20,7 @@ func TestCSEAuxPartitionBug(t *testing.T) {
arg1Aux := &tstAux{"arg1-aux"}
arg2Aux := &tstAux{"arg2-aux"}
arg3Aux := &tstAux{"arg3-aux"}
+ a := c.Frontend().Auto(src.NoXPos, c.config.Types.Int8)
// construct lots of values with args that have aux values and place
// them in an order that triggers the bug
@@ -36,7 +38,7 @@ func TestCSEAuxPartitionBug(t *testing.T) {
Valu("r8", OpAdd64, c.config.Types.Int64, 0, nil, "arg3", "arg2"),
Valu("r2", OpAdd64, c.config.Types.Int64, 0, nil, "arg1", "arg2"),
Valu("raddr", OpLocalAddr, c.config.Types.Int64.PtrTo(), 0, nil, "sp", "start"),
- Valu("raddrdef", OpVarDef, types.TypeMem, 0, nil, "start"),
+ Valu("raddrdef", OpVarDef, types.TypeMem, 0, a, "start"),
Valu("r6", OpAdd64, c.config.Types.Int64, 0, nil, "r4", "r5"),
Valu("r3", OpAdd64, c.config.Types.Int64, 0, nil, "arg1", "arg2"),
Valu("r5", OpAdd64, c.config.Types.Int64, 0, nil, "r2", "r3"),
@@ -89,6 +91,7 @@ func TestCSEAuxPartitionBug(t *testing.T) {
// TestZCSE tests the zero arg cse.
func TestZCSE(t *testing.T) {
c := testConfig(t)
+ a := c.Frontend().Auto(src.NoXPos, c.config.Types.Int8)
fun := c.Fun("entry",
Bloc("entry",
@@ -106,7 +109,7 @@ func TestZCSE(t *testing.T) {
Valu("r2", OpAdd64, c.config.Types.Int64, 0, nil, "a2ld", "c2"),
Valu("r3", OpAdd64, c.config.Types.Int64, 0, nil, "r1", "r2"),
Valu("raddr", OpLocalAddr, c.config.Types.Int64.PtrTo(), 0, nil, "sp", "start"),
- Valu("raddrdef", OpVarDef, types.TypeMem, 0, nil, "start"),
+ Valu("raddrdef", OpVarDef, types.TypeMem, 0, a, "start"),
Valu("rstore", OpStore, types.TypeMem, 0, c.config.Types.Int64, "raddr", "r3", "raddrdef"),
Goto("exit")),
Bloc("exit",
diff --git a/src/cmd/compile/internal/ssa/fuse.go b/src/cmd/compile/internal/ssa/fuse.go
index 73532ee6e5..8d14b5d696 100644
--- a/src/cmd/compile/internal/ssa/fuse.go
+++ b/src/cmd/compile/internal/ssa/fuse.go
@@ -66,7 +66,7 @@ func fuseBlockIf(b *Block) bool {
var ss0, ss1 *Block
s0 := b.Succs[0].b
i0 := b.Succs[0].i
- if s0.Kind != BlockPlain || len(s0.Preds) != 1 || len(s0.Values) != 0 {
+ if s0.Kind != BlockPlain || len(s0.Preds) != 1 || !isEmpty(s0) {
s0, ss0 = b, s0
} else {
ss0 = s0.Succs[0].b
@@ -74,7 +74,7 @@ func fuseBlockIf(b *Block) bool {
}
s1 := b.Succs[1].b
i1 := b.Succs[1].i
- if s1.Kind != BlockPlain || len(s1.Preds) != 1 || len(s1.Values) != 0 {
+ if s1.Kind != BlockPlain || len(s1.Preds) != 1 || !isEmpty(s1) {
s1, ss1 = b, s1
} else {
ss1 = s1.Succs[0].b
@@ -120,18 +120,34 @@ func fuseBlockIf(b *Block) bool {
b.Likely = BranchUnknown
b.SetControl(nil)
- // Trash the empty blocks s0 & s1.
- if s0 != b {
- s0.Kind = BlockInvalid
- s0.Values = nil
- s0.Succs = nil
- s0.Preds = nil
+ // Trash the empty blocks s0 and s1.
+ blocks := [...]*Block{s0, s1}
+ for _, s := range &blocks {
+ if s == b {
+ continue
+ }
+ // Move any (dead) values in s0 or s1 to b,
+ // where they will be eliminated by the next deadcode pass.
+ for _, v := range s.Values {
+ v.Block = b
+ }
+ b.Values = append(b.Values, s.Values...)
+ // Clear s.
+ s.Kind = BlockInvalid
+ s.Values = nil
+ s.Succs = nil
+ s.Preds = nil
}
- if s1 != b {
- s1.Kind = BlockInvalid
- s1.Values = nil
- s1.Succs = nil
- s1.Preds = nil
+ return true
+}
+
+// isEmpty reports whether b contains any live values.
+// There may be false positives.
+func isEmpty(b *Block) bool {
+ for _, v := range b.Values {
+ if v.Uses > 0 || v.Type.IsVoid() {
+ return false
+ }
}
return true
}
diff --git a/src/cmd/compile/internal/ssa/gen/S390X.rules b/src/cmd/compile/internal/ssa/gen/S390X.rules
index f3cfee7e97..cbf53506d7 100644
--- a/src/cmd/compile/internal/ssa/gen/S390X.rules
+++ b/src/cmd/compile/internal/ssa/gen/S390X.rules
@@ -139,16 +139,15 @@
(RoundToEven x) -> (FIDBR [4] x)
(Round x) -> (FIDBR [1] x)
-// Atomic loads.
-(AtomicLoad8 ptr mem) -> (MOVBZatomicload ptr mem)
-(AtomicLoad32 ptr mem) -> (MOVWZatomicload ptr mem)
-(AtomicLoad64 ptr mem) -> (MOVDatomicload ptr mem)
-(AtomicLoadPtr ptr mem) -> (MOVDatomicload ptr mem)
+// Atomic loads and stores.
+// The SYNC instruction (fast-BCR-serialization) prevents store-load
+// reordering. Other sequences of memory operations (load-load,
+// store-store and load-store) are already guaranteed not to be reordered.
+(AtomicLoad(8|32|Acq32|64|Ptr) ptr mem) -> (MOV(BZ|WZ|WZ|D|D)atomicload ptr mem)
+(AtomicStore(32|64|PtrNoWB) ptr val mem) -> (SYNC (MOV(W|D|D)atomicstore ptr val mem))
-// Atomic stores.
-(AtomicStore32 ptr val mem) -> (MOVWatomicstore ptr val mem)
-(AtomicStore64 ptr val mem) -> (MOVDatomicstore ptr val mem)
-(AtomicStorePtrNoWB ptr val mem) -> (MOVDatomicstore ptr val mem)
+// Store-release doesn't require store-load ordering.
+(AtomicStoreRel32 ptr val mem) -> (MOVWatomicstore ptr val mem)
// Atomic adds.
(AtomicAdd32 ptr val mem) -> (AddTupleFirst32 val (LAA ptr val mem))
diff --git a/src/cmd/compile/internal/ssa/gen/S390XOps.go b/src/cmd/compile/internal/ssa/gen/S390XOps.go
index fcc2c732fc..03c8b3de06 100644
--- a/src/cmd/compile/internal/ssa/gen/S390XOps.go
+++ b/src/cmd/compile/internal/ssa/gen/S390XOps.go
@@ -187,6 +187,8 @@ func init() {
fpstore = regInfo{inputs: []regMask{ptrspsb, fp, 0}}
fpstoreidx = regInfo{inputs: []regMask{ptrsp, ptrsp, fp, 0}}
+ sync = regInfo{inputs: []regMask{0}}
+
// LoweredAtomicCas may overwrite arg1, so force it to R0 for now.
cas = regInfo{inputs: []regMask{ptrsp, r0, gpsp, 0}, outputs: []regMask{gp, 0}, clobbers: r0}
@@ -493,6 +495,9 @@ func init() {
{name: "FlagGT"}, // CC=2 (greater than)
{name: "FlagOV"}, // CC=3 (overflow)
+ // Fast-BCR-serialization to ensure store-load ordering.
+ {name: "SYNC", argLength: 1, reg: sync, asm: "SYNC", typ: "Mem"},
+
// Atomic loads. These are just normal loads but return tuples
// so they can be properly ordered with other loads.
// load from arg0+auxint+aux. arg1=mem.
diff --git a/src/cmd/compile/internal/ssa/loop_test.go b/src/cmd/compile/internal/ssa/loop_test.go
index 8f72930bce..e64667b2ef 100644
--- a/src/cmd/compile/internal/ssa/loop_test.go
+++ b/src/cmd/compile/internal/ssa/loop_test.go
@@ -46,6 +46,7 @@ func TestLoopConditionS390X(t *testing.T) {
// done:
//
c := testConfigS390X(t)
+ a := c.Frontend().Auto(src.NoXPos, c.config.Types.Int8)
fun := c.Fun("entry",
Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil),
@@ -67,7 +68,7 @@ func TestLoopConditionS390X(t *testing.T) {
Valu("sum", OpAdd64, c.config.Types.Int64, 0, nil, "phisum", "c3"),
Goto("b1")),
Bloc("b3",
- Valu("retdef", OpVarDef, types.TypeMem, 0, nil, "mem"),
+ Valu("retdef", OpVarDef, types.TypeMem, 0, a, "mem"),
Valu("store", OpStore, types.TypeMem, 0, c.config.Types.Int64, "ret", "phisum", "retdef"),
Exit("store")))
CheckFunc(fun.f)
diff --git a/src/cmd/compile/internal/ssa/nilcheck.go b/src/cmd/compile/internal/ssa/nilcheck.go
index 925f55234b..54c9c9d7de 100644
--- a/src/cmd/compile/internal/ssa/nilcheck.go
+++ b/src/cmd/compile/internal/ssa/nilcheck.go
@@ -219,9 +219,31 @@ func nilcheckelim2(f *Func) {
continue
}
if v.Type.IsMemory() || v.Type.IsTuple() && v.Type.FieldType(1).IsMemory() {
- if v.Op == OpVarDef || v.Op == OpVarKill || v.Op == OpVarLive {
+ if v.Op == OpVarKill || v.Op == OpVarLive || (v.Op == OpVarDef && !v.Aux.(GCNode).Typ().HasHeapPointer()) {
// These ops don't really change memory.
continue
+ // Note: OpVarDef requires that the defined variable not have pointers.
+ // We need to make sure that there's no possible faulting
+ // instruction between a VarDef and that variable being
+ // fully initialized. If there was, then anything scanning
+ // the stack during the handling of that fault will see
+ // a live but uninitialized pointer variable on the stack.
+ //
+ // If we have:
+ //
+ // NilCheck p
+ // VarDef x
+ // x = *p
+ //
+ // We can't rewrite that to
+ //
+ // VarDef x
+ // NilCheck p
+ // x = *p
+ //
+ // Particularly, even though *p faults on p==nil, we still
+ // have to do the explicit nil check before the VarDef.
+ // See issue #32288.
}
// This op changes memory. Any faulting instruction after v that
// we've recorded in the unnecessary map is now obsolete.
diff --git a/src/cmd/compile/internal/ssa/opGen.go b/src/cmd/compile/internal/ssa/opGen.go
index 1026ab7995..8e701cdd9f 100644
--- a/src/cmd/compile/internal/ssa/opGen.go
+++ b/src/cmd/compile/internal/ssa/opGen.go
@@ -2054,6 +2054,7 @@ const (
OpS390XFlagLT
OpS390XFlagGT
OpS390XFlagOV
+ OpS390XSYNC
OpS390XMOVBZatomicload
OpS390XMOVWZatomicload
OpS390XMOVDatomicload
@@ -27614,6 +27615,12 @@ var opcodeTable = [...]opInfo{
argLen: 0,
reg: regInfo{},
},
+ {
+ name: "SYNC",
+ argLen: 1,
+ asm: s390x.ASYNC,
+ reg: regInfo{},
+ },
{
name: "MOVBZatomicload",
auxType: auxSymOff,
diff --git a/src/cmd/compile/internal/ssa/prove.go b/src/cmd/compile/internal/ssa/prove.go
index a73cd613f2..7c69327990 100644
--- a/src/cmd/compile/internal/ssa/prove.go
+++ b/src/cmd/compile/internal/ssa/prove.go
@@ -553,15 +553,29 @@ func (ft *factsTable) isNonNegative(v *Value) bool {
return true
}
+ var max int64
+ switch v.Type.Size() {
+ case 1:
+ max = math.MaxInt8
+ case 2:
+ max = math.MaxInt16
+ case 4:
+ max = math.MaxInt32
+ case 8:
+ max = math.MaxInt64
+ default:
+ panic("unexpected integer size")
+ }
+
// Check if the recorded limits can prove that the value is positive
- if l, has := ft.limits[v.ID]; has && (l.min >= 0 || l.umax <= math.MaxInt64) {
+ if l, has := ft.limits[v.ID]; has && (l.min >= 0 || l.umax <= uint64(max)) {
return true
}
// Check if v = x+delta, and we can use x's limits to prove that it's positive
if x, delta := isConstDelta(v); x != nil {
if l, has := ft.limits[x.ID]; has {
- if delta > 0 && l.min >= -delta && l.max <= math.MaxInt64-delta {
+ if delta > 0 && l.min >= -delta && l.max <= max-delta {
return true
}
if delta < 0 && l.min >= -delta {
diff --git a/src/cmd/compile/internal/ssa/rewriteS390X.go b/src/cmd/compile/internal/ssa/rewriteS390X.go
index c5b7e564bb..7781590f2a 100644
--- a/src/cmd/compile/internal/ssa/rewriteS390X.go
+++ b/src/cmd/compile/internal/ssa/rewriteS390X.go
@@ -61,6 +61,8 @@ func rewriteValueS390X(v *Value) bool {
return rewriteValueS390X_OpAtomicLoad64_0(v)
case OpAtomicLoad8:
return rewriteValueS390X_OpAtomicLoad8_0(v)
+ case OpAtomicLoadAcq32:
+ return rewriteValueS390X_OpAtomicLoadAcq32_0(v)
case OpAtomicLoadPtr:
return rewriteValueS390X_OpAtomicLoadPtr_0(v)
case OpAtomicStore32:
@@ -69,6 +71,8 @@ func rewriteValueS390X(v *Value) bool {
return rewriteValueS390X_OpAtomicStore64_0(v)
case OpAtomicStorePtrNoWB:
return rewriteValueS390X_OpAtomicStorePtrNoWB_0(v)
+ case OpAtomicStoreRel32:
+ return rewriteValueS390X_OpAtomicStoreRel32_0(v)
case OpAvg64u:
return rewriteValueS390X_OpAvg64u_0(v)
case OpBitLen64:
@@ -1132,6 +1136,19 @@ func rewriteValueS390X_OpAtomicLoad8_0(v *Value) bool {
return true
}
}
+func rewriteValueS390X_OpAtomicLoadAcq32_0(v *Value) bool {
+ // match: (AtomicLoadAcq32 ptr mem)
+ // cond:
+ // result: (MOVWZatomicload ptr mem)
+ for {
+ mem := v.Args[1]
+ ptr := v.Args[0]
+ v.reset(OpS390XMOVWZatomicload)
+ v.AddArg(ptr)
+ v.AddArg(mem)
+ return true
+ }
+}
func rewriteValueS390X_OpAtomicLoadPtr_0(v *Value) bool {
// match: (AtomicLoadPtr ptr mem)
// cond:
@@ -1146,8 +1163,62 @@ func rewriteValueS390X_OpAtomicLoadPtr_0(v *Value) bool {
}
}
func rewriteValueS390X_OpAtomicStore32_0(v *Value) bool {
+ b := v.Block
// match: (AtomicStore32 ptr val mem)
// cond:
+ // result: (SYNC (MOVWatomicstore ptr val mem))
+ for {
+ mem := v.Args[2]
+ ptr := v.Args[0]
+ val := v.Args[1]
+ v.reset(OpS390XSYNC)
+ v0 := b.NewValue0(v.Pos, OpS390XMOVWatomicstore, types.TypeMem)
+ v0.AddArg(ptr)
+ v0.AddArg(val)
+ v0.AddArg(mem)
+ v.AddArg(v0)
+ return true
+ }
+}
+func rewriteValueS390X_OpAtomicStore64_0(v *Value) bool {
+ b := v.Block
+ // match: (AtomicStore64 ptr val mem)
+ // cond:
+ // result: (SYNC (MOVDatomicstore ptr val mem))
+ for {
+ mem := v.Args[2]
+ ptr := v.Args[0]
+ val := v.Args[1]
+ v.reset(OpS390XSYNC)
+ v0 := b.NewValue0(v.Pos, OpS390XMOVDatomicstore, types.TypeMem)
+ v0.AddArg(ptr)
+ v0.AddArg(val)
+ v0.AddArg(mem)
+ v.AddArg(v0)
+ return true
+ }
+}
+func rewriteValueS390X_OpAtomicStorePtrNoWB_0(v *Value) bool {
+ b := v.Block
+ // match: (AtomicStorePtrNoWB ptr val mem)
+ // cond:
+ // result: (SYNC (MOVDatomicstore ptr val mem))
+ for {
+ mem := v.Args[2]
+ ptr := v.Args[0]
+ val := v.Args[1]
+ v.reset(OpS390XSYNC)
+ v0 := b.NewValue0(v.Pos, OpS390XMOVDatomicstore, types.TypeMem)
+ v0.AddArg(ptr)
+ v0.AddArg(val)
+ v0.AddArg(mem)
+ v.AddArg(v0)
+ return true
+ }
+}
+func rewriteValueS390X_OpAtomicStoreRel32_0(v *Value) bool {
+ // match: (AtomicStoreRel32 ptr val mem)
+ // cond:
// result: (MOVWatomicstore ptr val mem)
for {
mem := v.Args[2]
@@ -1160,36 +1231,6 @@ func rewriteValueS390X_OpAtomicStore32_0(v *Value) bool {
return true
}
}
-func rewriteValueS390X_OpAtomicStore64_0(v *Value) bool {
- // match: (AtomicStore64 ptr val mem)
- // cond:
- // result: (MOVDatomicstore ptr val mem)
- for {
- mem := v.Args[2]
- ptr := v.Args[0]
- val := v.Args[1]
- v.reset(OpS390XMOVDatomicstore)
- v.AddArg(ptr)
- v.AddArg(val)
- v.AddArg(mem)
- return true
- }
-}
-func rewriteValueS390X_OpAtomicStorePtrNoWB_0(v *Value) bool {
- // match: (AtomicStorePtrNoWB ptr val mem)
- // cond:
- // result: (MOVDatomicstore ptr val mem)
- for {
- mem := v.Args[2]
- ptr := v.Args[0]
- val := v.Args[1]
- v.reset(OpS390XMOVDatomicstore)
- v.AddArg(ptr)
- v.AddArg(val)
- v.AddArg(mem)
- return true
- }
-}
func rewriteValueS390X_OpAvg64u_0(v *Value) bool {
b := v.Block
// match: (Avg64u x y)
diff --git a/src/cmd/cover/cover.go b/src/cmd/cover/cover.go
index 1748606c5e..e04c8834bd 100644
--- a/src/cmd/cover/cover.go
+++ b/src/cmd/cover/cover.go
@@ -386,6 +386,9 @@ func (f *File) addCounters(pos, insertPos, blockEnd token.Pos, list []ast.Stmt,
f.edit.Insert(f.offset(insertPos), f.newCounter(insertPos, blockEnd, 0)+";")
return
}
+ // Make a copy of the list, as we may mutate it and should leave the
+ // existing list intact.
+ list = append([]ast.Stmt(nil), list...)
// We have a block (statement list), but it may have several basic blocks due to the
// appearance of statements that affect the flow of control.
for {
diff --git a/src/cmd/cover/testdata/test.go b/src/cmd/cover/testdata/test.go
index 0b03ef91ab..b794962205 100644
--- a/src/cmd/cover/testdata/test.go
+++ b/src/cmd/cover/testdata/test.go
@@ -132,6 +132,10 @@ func testBlockRun() {
func testSwitch() {
for i := 0; i < 5; func() { i++; check(LINE, 5) }() {
+ goto label2
+ label1:
+ goto label1
+ label2:
switch i {
case 0:
check(LINE, 1)
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index 3df7f09abc..9e503117ae 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -866,13 +866,6 @@ func runInstall(dir string, ch chan struct{}) {
if symabis != "" {
compile = append(compile, "-symabis", symabis)
}
- if dir == "runtime" || dir == "runtime/internal/atomic" {
- // These packages define symbols referenced by
- // assembly in other packages. In cmd/go, we work out
- // the exact details. For bootstrapping, just tell the
- // compiler to generate ABI wrappers for everything.
- compile = append(compile, "-allabis")
- }
if goos == "android" {
compile = append(compile, "-shared")
}
diff --git a/src/cmd/doc/pkg.go b/src/cmd/doc/pkg.go
index 32810bd581..2c0c6c161a 100644
--- a/src/cmd/doc/pkg.go
+++ b/src/cmd/doc/pkg.go
@@ -31,18 +31,36 @@ const (
)
type Package struct {
- writer io.Writer // Destination for output.
- name string // Package name, json for encoding/json.
- userPath string // String the user used to find this package.
- pkg *ast.Package // Parsed package.
- file *ast.File // Merged from all files in the package
- doc *doc.Package
- build *build.Package
- typedValue map[*doc.Value]bool // Consts and vars related to types.
- constructor map[*doc.Func]bool // Constructors.
- packageClausePrinted bool // Prevent repeated package clauses.
- fs *token.FileSet // Needed for printing.
- buf bytes.Buffer
+ writer io.Writer // Destination for output.
+ name string // Package name, json for encoding/json.
+ userPath string // String the user used to find this package.
+ pkg *ast.Package // Parsed package.
+ file *ast.File // Merged from all files in the package
+ doc *doc.Package
+ build *build.Package
+ typedValue map[*doc.Value]bool // Consts and vars related to types.
+ constructor map[*doc.Func]bool // Constructors.
+ fs *token.FileSet // Needed for printing.
+ buf pkgBuffer
+}
+
+// pkgBuffer is a wrapper for bytes.Buffer that prints a package clause the
+// first time Write is called.
+type pkgBuffer struct {
+ pkg *Package
+ printed bool // Prevent repeated package clauses.
+ bytes.Buffer
+}
+
+func (pb *pkgBuffer) Write(p []byte) (int, error) {
+ if !pb.printed && len(p) > 0 {
+ pb.printed = true
+ // Only show package clause for commands if requested explicitly.
+ if pb.pkg.pkg.Name != "main" || showCmd {
+ pb.pkg.packageClause()
+ }
+ }
+ return pb.Buffer.Write(p)
}
type PackageError string // type returned by pkg.Fatalf.
@@ -129,7 +147,10 @@ func parsePackage(writer io.Writer, pkg *build.Package, userPath string) *Packag
log.Fatal(err)
}
// Make sure they are all in one package.
- if len(pkgs) != 1 {
+ if len(pkgs) == 0 {
+ log.Fatalf("no source-code package in directory %s", pkg.Dir)
+ }
+ if len(pkgs) > 1 {
log.Fatalf("multiple packages in directory %s", pkg.Dir)
}
astPkg := pkgs[pkg.Name]
@@ -168,7 +189,7 @@ func parsePackage(writer io.Writer, pkg *build.Package, userPath string) *Packag
}
}
- return &Package{
+ p := &Package{
writer: writer,
name: pkg.Name,
userPath: userPath,
@@ -180,6 +201,8 @@ func parsePackage(writer io.Writer, pkg *build.Package, userPath string) *Packag
build: pkg,
fs: fs,
}
+ p.buf.pkg = p
+ return p
}
func (pkg *Package) Printf(format string, args ...interface{}) {
@@ -423,9 +446,6 @@ func joinStrings(ss []string) string {
// allDoc prints all the docs for the package.
func (pkg *Package) allDoc() {
defer pkg.flush()
- if pkg.showInternals() {
- pkg.packageClause(false)
- }
doc.ToText(&pkg.buf, pkg.doc.Doc, "", indent, indentedWidth)
pkg.newlines(1)
@@ -486,14 +506,11 @@ func (pkg *Package) allDoc() {
// packageDoc prints the docs for the package (package doc plus one-liners of the rest).
func (pkg *Package) packageDoc() {
defer pkg.flush()
- if pkg.showInternals() {
- pkg.packageClause(false)
- }
doc.ToText(&pkg.buf, pkg.doc.Doc, "", indent, indentedWidth)
pkg.newlines(1)
- if !pkg.showInternals() {
+ if pkg.pkg.Name == "main" && !showCmd {
// Show only package docs for commands.
return
}
@@ -506,29 +523,8 @@ func (pkg *Package) packageDoc() {
pkg.bugs()
}
-// showInternals reports whether we should show the internals
-// of a package as opposed to just the package docs.
-// Used to decide whether to suppress internals for commands.
-// Called only by Package.packageDoc.
-func (pkg *Package) showInternals() bool {
- return pkg.pkg.Name != "main" || showCmd
-}
-
// packageClause prints the package clause.
-// The argument boolean, if true, suppresses the output if the
-// user's argument is identical to the actual package path or
-// is empty, meaning it's the current directory.
-func (pkg *Package) packageClause(checkUserPath bool) {
- if pkg.packageClausePrinted {
- return
- }
-
- if checkUserPath {
- if pkg.userPath == "" || pkg.userPath == pkg.build.ImportPath {
- return
- }
- }
-
+func (pkg *Package) packageClause() {
importPath := pkg.build.ImportComment
if importPath == "" {
importPath = pkg.build.ImportPath
@@ -560,7 +556,6 @@ func (pkg *Package) packageClause(checkUserPath bool) {
if !usingModules && importPath != pkg.build.ImportPath {
pkg.Printf("WARNING: package source is installed in %q\n", pkg.build.ImportPath)
}
- pkg.packageClausePrinted = true
}
// valueSummary prints a one-line summary for each set of values and constants.
@@ -698,9 +693,6 @@ func (pkg *Package) symbolDoc(symbol string) bool {
found := false
// Functions.
for _, fun := range pkg.findFuncs(symbol) {
- if !found {
- pkg.packageClause(true)
- }
// Symbol is a function.
decl := fun.Decl
pkg.emit(fun.Doc, decl)
diff --git a/src/cmd/go.mod b/src/cmd/go.mod
index 407f12b3e0..3d9b4a8d24 100644
--- a/src/cmd/go.mod
+++ b/src/cmd/go.mod
@@ -3,10 +3,10 @@ module cmd
go 1.12
require (
- github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57
+ github.com/google/pprof v0.0.0-20190515194954-54271f7e092f
github.com/ianlancetaylor/demangle v0.0.0-20180524225900-fc6590592b44 // indirect
golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82 // indirect
- golang.org/x/tools v0.0.0-20190514135123-4789ca9922f0
+ golang.org/x/tools v0.0.0-20190611154301-25a4f137592f
)
diff --git a/src/cmd/go.sum b/src/cmd/go.sum
index 92886bba7b..6ca1dee5ed 100644
--- a/src/cmd/go.sum
+++ b/src/cmd/go.sum
@@ -1,5 +1,5 @@
-github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57 h1:eqyIo2HjKhKe/mJzTG8n4VqvLXIOEG+SLdDqX7xGtkY=
-github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
+github.com/google/pprof v0.0.0-20190515194954-54271f7e092f h1:Jnx61latede7zDD3DiiP4gmNz33uK0U5HDUaF0a/HVQ=
+github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/ianlancetaylor/demangle v0.0.0-20180524225900-fc6590592b44 h1:pKqc8lAAA6rcwpvsephnRuZp4VHbfszZRClvqAE6Sq8=
github.com/ianlancetaylor/demangle v0.0.0-20180524225900-fc6590592b44/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045 h1:Pn8fQdvx+z1avAi7fdM2kRYWQNxGlavNDSyzrQg2SsU=
@@ -13,11 +13,5 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82 h1:vsphBvatvfbhlb4PO1BYSr9dzugGxJ/SQHoNufZJq1w=
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/tools v0.0.0-20190509153222-73554e0f7805 h1:1ufBXAsTpUhSmmPXEEs5PrGQSfnBhsjAd2SmVhp9xrY=
-golang.org/x/tools v0.0.0-20190509153222-73554e0f7805/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
-golang.org/x/tools v0.0.0-20190510144052-35884eef200b h1:4muk7BhMes67ZgDeK3n4Jvi+FvNDRZzh6ZRqIXZNYwQ=
-golang.org/x/tools v0.0.0-20190510144052-35884eef200b/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
-golang.org/x/tools v0.0.0-20190513233021-7d589f28aaf4 h1:sIGsLZaMtLBc5sLK7s2xtr7VaKk8h31mrJyHwEZq2WQ=
-golang.org/x/tools v0.0.0-20190513233021-7d589f28aaf4/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
-golang.org/x/tools v0.0.0-20190514135123-4789ca9922f0 h1:0Bz67IMuNMofIoO/F+rX8oPltlfrAC5HU68DEyynMQg=
-golang.org/x/tools v0.0.0-20190514135123-4789ca9922f0/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190611154301-25a4f137592f h1:6awn5JC4pwVI5HiBqs7MDtRxnwV9PpO5iSA9v6P09pA=
+golang.org/x/tools v0.0.0-20190611154301-25a4f137592f/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index 26fb337f86..d2ce578564 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -47,8 +47,9 @@
// importpath import path syntax
// modules modules, module versions, and more
// module-get module-aware go get
-// packages package lists and patterns
// module-auth module authentication using go.sum
+// module-private module configuration for non-public modules
+// packages package lists and patterns
// testflag testing flags
// testfunc testing functions
//
@@ -557,7 +558,7 @@
//
// Usage:
//
-// go get [-d] [-m] [-t] [-u] [-v] [-insecure] [build flags] [packages]
+// go get [-d] [-t] [-u] [-v] [-insecure] [build flags] [packages]
//
// Get resolves and adds dependencies to the current development module
// and then builds and installs them.
@@ -585,11 +586,12 @@
// depending on it as needed.
//
// The version suffix @latest explicitly requests the latest minor release of the
-// given path.
-//
-// The suffix @patch requests the latest patch release: if the path is already in
-// the build list, the selected version will have the same minor version.
-// If the path is not already in the build list, @patch is equivalent to @latest.
+// given path. The suffix @patch requests the latest patch release: if the path
+// is already in the build list, the selected version will have the same minor
+// version. If the path is not already in the build list, @patch is equivalent
+// to @latest. Neither @latest nor @patch will cause 'go get' to downgrade a module
+// in the build list if it is required at a newer pre-release version that is
+// newer than the latest released version.
//
// Although get defaults to using the latest version of the module containing
// a named package, it does not use the latest version of that module's
@@ -603,9 +605,12 @@
// The -t flag instructs get to consider modules needed to build tests of
// packages specified on the command line.
//
-// The -u flag instructs get to update dependencies to use newer minor or
-// patch releases when available. Continuing the previous example,
-// 'go get -u A' will use the latest A with B v1.3.1 (not B v1.2.3).
+// The -u flag instructs get to update modules providing dependencies
+// of packages named on the command line to use newer minor or patch
+// releases when available. Continuing the previous example, 'go get -u A'
+// will use the latest A with B v1.3.1 (not B v1.2.3). If B requires module C,
+// but C does not provide any packages needed to build packages in A
+// (not including tests), then C will not be updated.
//
// The -u=patch flag (not -u patch) also instructs get to update dependencies,
// but changes the default to select patch releases.
@@ -622,18 +627,6 @@
// require downgrading other dependencies, and 'go get' does
// this automatically as well.
//
-// The -m flag instructs get to stop here, after resolving, upgrading,
-// and downgrading modules and updating go.mod. When using -m,
-// each specified package path must be a module path as well,
-// not the import path of a package below the module root.
-//
-// When the -m and -u flags are used together, 'go get' will upgrade
-// modules that provide packages depended on by the modules named on
-// the command line. For example, 'go get -u -m A' will upgrade A and
-// any module providing packages imported by packages in A.
-// 'go get -u -m' will upgrade modules that provided packages needed
-// by the main module.
-//
// The -insecure flag permits fetching from repositories and resolving
// custom domains using insecure schemes such as HTTP. Use with caution.
//
@@ -681,6 +674,15 @@
//
// Install compiles and installs the packages named by the import paths.
//
+// Executables are installed in the directory named by the GOBIN environment
+// variable, which defaults to $GOPATH/bin or $HOME/go/bin if the GOPATH
+// environment variable is not set. Executables in $GOROOT
+// are installed in $GOROOT/bin or $GOTOOLDIR instead of $GOBIN.
+//
+// When module-aware mode is disabled, other packages are installed in the
+// directory $GOPATH/pkg/$GOOS_$GOARCH. When module-aware mode is enabled,
+// other packages are built and cached but not installed.
+//
// The -i flag installs the dependencies of the named packages as well.
//
// For more about the build flags, see 'go help build'.
@@ -1576,9 +1578,17 @@
// GOPATH
// For more details see: 'go help gopath'.
// GOPROXY
-// URL of Go module proxy. See 'go help goproxy'.
+// URL of Go module proxy. See 'go help modules'.
+// GOPRIVATE, GONOPROXY, GONOSUMDB
+// Comma-separated list of glob patterns (in the syntax of Go's path.Match)
+// of module path prefixes that should always be fetched directly
+// or that should not be compared against the checksum database.
+// See 'go help module-private'.
// GOROOT
// The root of the go tree.
+// GOSUMDB
+// The name of checksum database to use and optionally its public key and
+// URL. See 'go help module-auth'.
// GOTMPDIR
// The directory where the go command will write
// temporary source files, packages, and binaries.
@@ -2269,23 +2279,26 @@
//
// Module support
//
-// Go 1.13 includes official support for Go modules,
-// including a module-aware 'go get' command.
-// Module-aware mode is active by default.
+// Go 1.13 includes support for Go modules. Module-aware mode is active by default
+// whenever a go.mod file is found in, or in a parent of, the current directory.
+//
+// The quickest way to take advantage of module support is to check out your
+// repository, create a go.mod file (described in the next section) there, and run
+// go commands from within that file tree.
//
// For more fine-grained control, Go 1.13 continues to respect
// a temporary environment variable, GO111MODULE, which can be set to one
-// of three string values: off, auto, or on (the default).
-// If GO111MODULE=on or is unset, then the go command requires the use of
-// modules, never consulting GOPATH. We refer to this as the command
+// of three string values: off, on, or auto (the default).
+// If GO111MODULE=on, then the go command requires the use of modules,
+// never consulting GOPATH. We refer to this as the command
// being module-aware or running in "module-aware mode".
-// If GO111MODULE=auto, then the go command enables or disables module
-// support based on the current directory. Module support is enabled only
-// when the current directory is outside GOPATH/src and itself contains a
-// go.mod file or is below a directory containing a go.mod file.
// If GO111MODULE=off, then the go command never uses
// module support. Instead it looks in vendor directories and GOPATH
// to find dependencies; we now refer to this as "GOPATH mode."
+// If GO111MODULE=auto or is unset, then the go command enables or disables
+// module support based on the current directory.
+// Module support is enabled only when the current directory contains a
+// go.mod file or is below a directory containing a go.mod file.
//
// In module-aware mode, GOPATH no longer defines the meaning of imports
// during a build, but it still stores downloaded dependencies (in GOPATH/pkg/mod)
@@ -2579,7 +2592,9 @@
// The go command can fetch modules from a proxy or connect to source control
// servers directly, according to the setting of the GOPROXY environment
// variable (see 'go help env'). The default setting for GOPROXY is
-// "https://proxy.golang.org", the Go module mirror run by Google.
+// "https://proxy.golang.org,direct", which means to try the
+// Go module mirror run by Google and fall back to a direct connection
+// if the proxy reports that it does not have the module (HTTP error 404 or 410).
// See https://proxy.golang.org/privacy for the service's privacy policy.
// If GOPROXY is set to the string "direct", downloads use a direct connection
// to source control servers. Setting GOPROXY to "off" disallows downloading
@@ -2591,25 +2606,15 @@
// to cause a direct connection to be attempted at that point in the search.
// Any proxies listed after "direct" are never consulted.
//
-// The GONOPROXY environment variable is a comma-separated list of
-// glob patterns (in the syntax of Go's path.Match) of module path prefixes
-// that should always be fetched directly, ignoring the GOPROXY setting.
-// For example,
-//
-// GONOPROXY=*.corp.example.com,rsc.io/private
-//
-// forces a direct connection to download modules with path prefixes matching
-// either pattern, including "git.corp.example.com/xyzzy", "rsc.io/private",
-// and "rsc.io/private/quux".
-//
-// The 'go env -w' command (see 'go help env') can be used to set these variables
-// for future go command invocations.
+// The GOPRIVATE and GONOPROXY environment variables allow bypassing
+// the proxy for selected modules. See 'go help module-private' for details.
//
// No matter the source of the modules, the go command checks downloads against
// known checksums, to detect unexpected changes in the content of any specific
// module version from one day to the next. This check first consults the current
-// module's go.sum file but falls back to the Go checksum database.
-// See 'go help module-auth' for details.
+// module's go.sum file but falls back to the Go checksum database, controlled by
+// the GOSUMDB and GONOSUMDB environment variables. See 'go help module-auth'
+// for details.
//
// See 'go help goproxy' for details about the proxy protocol and also
// the format of the cached downloaded packages.
@@ -2634,6 +2639,137 @@
// are still ignored.
//
//
+// Module authentication using go.sum
+//
+// The go command tries to authenticate every downloaded module,
+// checking that the bits downloaded for a specific module version today
+// match bits downloaded yesterday. This ensures repeatable builds
+// and detects introduction of unexpected changes, malicious or not.
+//
+// In each module's root, alongside go.mod, the go command maintains
+// a file named go.sum containing the cryptographic checksums of the
+// module's dependencies.
+//
+// The form of each line in go.sum is three fields:
+//
+// [/go.mod]
+//
+// Each known module version results in two lines in the go.sum file.
+// The first line gives the hash of the module version's file tree.
+// The second line appends "/go.mod" to the version and gives the hash
+// of only the module version's (possibly synthesized) go.mod file.
+// The go.mod-only hash allows downloading and authenticating a
+// module version's go.mod file, which is needed to compute the
+// dependency graph, without also downloading all the module's source code.
+//
+// The hash begins with an algorithm prefix of the form "h:".
+// The only defined algorithm prefix is "h1:", which uses SHA-256.
+//
+// Module authentication failures
+//
+// The go command maintains a cache of downloaded packages and computes
+// and records the cryptographic checksum of each package at download time.
+// In normal operation, the go command checks the main module's go.sum file
+// against these precomputed checksums instead of recomputing them on
+// each command invocation. The 'go mod verify' command checks that
+// the cached copies of module downloads still match both their recorded
+// checksums and the entries in go.sum.
+//
+// In day-to-day development, the checksum of a given module version
+// should never change. Each time a dependency is used by a given main
+// module, the go command checks its local cached copy, freshly
+// downloaded or not, against the main module's go.sum. If the checksums
+// don't match, the go command reports the mismatch as a security error
+// and refuses to run the build. When this happens, proceed with caution:
+// code changing unexpectedly means today's build will not match
+// yesterday's, and the unexpected change may not be beneficial.
+//
+// If the go command reports a mismatch in go.sum, the downloaded code
+// for the reported module version does not match the one used in a
+// previous build of the main module. It is important at that point
+// to find out what the right checksum should be, to decide whether
+// go.sum is wrong or the downloaded code is wrong. Usually go.sum is right:
+// you want to use the same code you used yesterday.
+//
+// If a downloaded module is not yet included in go.sum and it is a publicly
+// available module, the go command consults the Go checksum database to fetch
+// the expected go.sum lines. If the downloaded code does not match those
+// lines, the go command reports the mismatch and exits. Note that the
+// database is not consulted for module versions already listed in go.sum.
+//
+// If a go.sum mismatch is reported, it is always worth investigating why
+// the code downloaded today differs from what was downloaded yesterday.
+//
+// The GOSUMDB environment variable identifies the name of checksum database
+// to use and optionally its public key and URL, as in:
+//
+// GOSUMDB="sum.golang.org"
+// GOSUMDB="sum.golang.org+"
+// GOSUMDB="sum.golang.org+ https://sum.golang.org"
+//
+// The go command knows the public key of sum.golang.org; use of any other
+// database requires giving the public key explicitly. The URL defaults to
+// "https://" followed by the database name.
+//
+// GOSUMDB defaults to "sum.golang.org", the Go checksum database run by Google.
+// See https://sum.golang.org/privacy for the service's privacy policy.
+//
+// If GOSUMDB is set to "off", or if "go get" is invoked with the -insecure flag,
+// the checksum database is not consulted, and all unrecognized modules are
+// accepted, at the cost of giving up the security guarantee of verified repeatable
+// downloads for all modules. A better way to bypass the checksum database
+// for specific modules is to use the GOPRIVATE or GONOSUMDB environment
+// variables. See 'go help module-private' for details.
+//
+// The 'go env -w' command (see 'go help env') can be used to set these variables
+// for future go command invocations.
+//
+//
+// Module configuration for non-public modules
+//
+// The go command defaults to downloading modules from the public Go module
+// mirror at proxy.golang.org. It also defaults to validating downloaded modules,
+// regardless of source, against the public Go checksum database at sum.golang.org.
+// These defaults work well for publicly available source code.
+//
+// The GOPRIVATE environment variable controls which modules the go command
+// considers to be private (not available publicly) and should therefore not use the
+// proxy or checksum database. The variable is a comma-separated list of
+// glob patterns (in the syntax of Go's path.Match) of module path prefixes.
+// For example,
+//
+// GOPRIVATE=*.corp.example.com,rsc.io/private
+//
+// causes the go command to treat as private any module with a path prefix
+// matching either pattern, including git.corp.example.com/xyzzy, rsc.io/private,
+// and rsc.io/private/quux.
+//
+// The GOPRIVATE environment variable may be used by other tools as well to
+// identify non-public modules. For example, an editor could use GOPRIVATE
+// to decide whether to hyperlink a package import to a godoc.org page.
+//
+// For fine-grained control over module download and validation, the GONOPROXY
+// and GONOSUMDB environment variables accept the same kind of glob list
+// and override GOPRIVATE for the specific decision of whether to use the proxy
+// and checksum database, respectively.
+//
+// For example, if a company ran a module proxy serving private modules,
+// users would configure go using:
+//
+// GOPRIVATE=*.corp.example.com
+// GOPROXY=proxy.example.com
+// GONOPROXY=none
+//
+// This would tell the go comamnd and other tools that modules beginning with
+// a corp.example.com subdomain are private but that the company proxy should
+// be used for downloading both public and private modules, because
+// GONOPROXY has been set to a pattern that won't match any modules,
+// overriding GOPRIVATE.
+//
+// The 'go env -w' command (see 'go help env') can be used to set these variables
+// for future go command invocations.
+//
+//
// Package lists and patterns
//
// Many commands apply to a set of packages:
@@ -2718,102 +2854,6 @@
// by the go tool, as are directories named "testdata".
//
//
-// Module authentication using go.sum
-//
-// The go command tries to authenticate every downloaded module,
-// checking that the bits downloaded for a specific module version today
-// match bits downloaded yesterday. This ensures repeatable builds
-// and detects introduction of unexpected changes, malicious or not.
-//
-// In each module's root, alongside go.mod, the go command maintains
-// a file named go.sum containing the cryptographic checksums of the
-// module's dependencies.
-//
-// The form of each line in go.sum is three fields:
-//
-// [/go.mod]
-//
-// Each known module version results in two lines in the go.sum file.
-// The first line gives the hash of the module version's file tree.
-// The second line appends "/go.mod" to the version and gives the hash
-// of only the module version's (possibly synthesized) go.mod file.
-// The go.mod-only hash allows downloading and authenticating a
-// module version's go.mod file, which is needed to compute the
-// dependency graph, without also downloading all the module's source code.
-//
-// The hash begins with an algorithm prefix of the form "h:".
-// The only defined algorithm prefix is "h1:", which uses SHA-256.
-//
-// Module authentication failures
-//
-// The go command maintains a cache of downloaded packages and computes
-// and records the cryptographic checksum of each package at download time.
-// In normal operation, the go command checks the main module's go.sum file
-// against these precomputed checksums instead of recomputing them on
-// each command invocation. The 'go mod verify' command checks that
-// the cached copies of module downloads still match both their recorded
-// checksums and the entries in go.sum.
-//
-// In day-to-day development, the checksum of a given module version
-// should never change. Each time a dependency is used by a given main
-// module, the go command checks its local cached copy, freshly
-// downloaded or not, against the main module's go.sum. If the checksums
-// don't match, the go command reports the mismatch as a security error
-// and refuses to run the build. When this happens, proceed with caution:
-// code changing unexpectedly means today's build will not match
-// yesterday's, and the unexpected change may not be beneficial.
-//
-// If the go command reports a mismatch in go.sum, the downloaded code
-// for the reported module version does not match the one used in a
-// previous build of the main module. It is important at that point
-// to find out what the right checksum should be, to decide whether
-// go.sum is wrong or the downloaded code is wrong. Usually go.sum is right:
-// you want to use the same code you used yesterday.
-//
-// If a downloaded module is not yet included in go.sum and it is a publicly
-// available module, the go command consults the Go checksum database to fetch
-// the expected go.sum lines. If the downloaded code does not match those
-// lines, the go command reports the mismatch and exits. Note that the
-// database is not consulted for module versions already listed in go.sum.
-//
-// If a go.sum mismatch is reported, it is always worth investigating why
-// the code downloaded today differs from what was downloaded yesterday.
-//
-// The GOSUMDB environment variable identifies the name of checksum database
-// to use and optionally its public key and URL, as in:
-//
-// GOSUMDB="sum.golang.org"
-// GOSUMDB="sum.golang.org+"
-// GOSUMDB="sum.golang.org+ https://sum.golang.org"
-//
-// The go command knows the public key of sum.golang.org; use of any other
-// database requires giving the public key explicitly. The URL defaults to
-// "https://" followed by the database name.
-//
-// GOSUMDB defaults to "sum.golang.org", the Go checksum database run by Google.
-// See https://sum.golang.org/privacy for the service's privacy policy.
-//
-// If GOSUMDB is set to "off", or if "go get" is invoked with the -insecure flag,
-// the checksum database is not consulted, and all unrecognized modules are
-// accepted, at the cost of giving up the security guarantee of verified repeatable
-// downloads for all modules. A better way to bypass the checksum database
-// for specific modules is to use the GONOSUMDB environment variable.
-//
-// The GONOSUMDB environment variable is a comma-separated list of
-// glob patterns (in the syntax of Go's path.Match) of module path prefixes
-// that should not be compared against the checksum database.
-// For example,
-//
-// GONOSUMDB=*.corp.example.com,rsc.io/private
-//
-// disables checksum database lookups for modules with path prefixes matching
-// either pattern, including "git.corp.example.com/xyzzy", "rsc.io/private",
-// and "rsc.io/private/quux".
-//
-// The 'go env -w' command (see 'go help env') can be used to set these variables
-// for future go command invocations.
-//
-//
// Testing flags
//
// The 'go test' command takes both flags that apply to 'go test' itself
diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go
index bee9384d76..e762687e08 100644
--- a/src/cmd/go/go_test.go
+++ b/src/cmd/go/go_test.go
@@ -29,6 +29,7 @@ import (
"cmd/go/internal/cache"
"cmd/go/internal/cfg"
+ "cmd/go/internal/robustio"
"cmd/internal/sys"
)
@@ -685,7 +686,7 @@ func (tg *testgoData) creatingTemp(path string) {
if tg.wd != "" && !filepath.IsAbs(path) {
path = filepath.Join(tg.pwd(), path)
}
- tg.must(os.RemoveAll(path))
+ tg.must(robustio.RemoveAll(path))
tg.temps = append(tg.temps, path)
}
@@ -887,7 +888,7 @@ func removeAll(dir string) error {
}
return nil
})
- return os.RemoveAll(dir)
+ return robustio.RemoveAll(dir)
}
// failSSH puts an ssh executable in the PATH that always fails.
@@ -1181,7 +1182,7 @@ func testMove(t *testing.T, vcs, url, base, config string) {
case "svn":
// SVN doesn't believe in text files so we can't just edit the config.
// Check out a different repo into the wrong place.
- tg.must(os.RemoveAll(tg.path("src/code.google.com/p/rsc-svn")))
+ tg.must(robustio.RemoveAll(tg.path("src/code.google.com/p/rsc-svn")))
tg.run("get", "-d", "-u", "code.google.com/p/rsc-svn2/trunk")
tg.must(os.Rename(tg.path("src/code.google.com/p/rsc-svn2"), tg.path("src/code.google.com/p/rsc-svn")))
default:
@@ -1222,10 +1223,12 @@ func TestInternalCache(t *testing.T) {
}
func TestMoveGit(t *testing.T) {
+ testenv.MustHaveExecPath(t, "git")
testMove(t, "git", "rsc.io/pdf", "pdf", "rsc.io/pdf/.git/config")
}
func TestMoveHG(t *testing.T) {
+ testenv.MustHaveExecPath(t, "hg")
testMove(t, "hg", "vcs-test.golang.org/go/custom-hg-hello", "custom-hg-hello", "vcs-test.golang.org/go/custom-hg-hello/.hg/hgrc")
}
@@ -1287,9 +1290,7 @@ func TestImportCycle(t *testing.T) {
// cmd/go: custom import path checking should not apply to Go packages without import comment.
func TestIssue10952(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
- if _, err := exec.LookPath("git"); err != nil {
- t.Skip("skipping because git binary not found")
- }
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -1305,9 +1306,7 @@ func TestIssue10952(t *testing.T) {
func TestIssue16471(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
- if _, err := exec.LookPath("git"); err != nil {
- t.Skip("skipping because git binary not found")
- }
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -1323,9 +1322,7 @@ func TestIssue16471(t *testing.T) {
// Test git clone URL that uses SCP-like syntax and custom import path checking.
func TestIssue11457(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
- if _, err := exec.LookPath("git"); err != nil {
- t.Skip("skipping because git binary not found")
- }
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -1350,9 +1347,7 @@ func TestIssue11457(t *testing.T) {
func TestGetGitDefaultBranch(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
- if _, err := exec.LookPath("git"); err != nil {
- t.Skip("skipping because git binary not found")
- }
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -1378,9 +1373,7 @@ func TestGetGitDefaultBranch(t *testing.T) {
// Security issue. Don't disable. See golang.org/issue/22125.
func TestAccidentalGitCheckout(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
- if _, err := exec.LookPath("git"); err != nil {
- t.Skip("skipping because git binary not found")
- }
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -1653,6 +1646,7 @@ func TestInstallToGOBINCommandLinePackage(t *testing.T) {
func TestGoGetNonPkg(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -1669,6 +1663,7 @@ func TestGoGetNonPkg(t *testing.T) {
func TestGoGetTestOnlyPkg(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -1699,7 +1694,7 @@ func TestInstalls(t *testing.T) {
goarch := strings.TrimSpace(tg.getStdout())
tg.setenv("GOARCH", goarch)
fixbin := filepath.Join(goroot, "pkg", "tool", goos+"_"+goarch, "fix") + exeSuffix
- tg.must(os.RemoveAll(fixbin))
+ tg.must(robustio.RemoveAll(fixbin))
tg.run("install", "cmd/fix")
tg.wantExecutable(fixbin, "did not install cmd/fix to $GOROOT/pkg/tool")
tg.must(os.Remove(fixbin))
@@ -2058,6 +2053,7 @@ func TestDefaultGOPATH(t *testing.T) {
func TestDefaultGOPATHGet(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -2070,13 +2066,13 @@ func TestDefaultGOPATHGet(t *testing.T) {
tg.grepStderr("created GOPATH="+regexp.QuoteMeta(tg.path("home/go"))+"; see 'go help gopath'", "did not create GOPATH")
// no warning if directory already exists
- tg.must(os.RemoveAll(tg.path("home/go")))
+ tg.must(robustio.RemoveAll(tg.path("home/go")))
tg.tempDir("home/go")
tg.run("get", "github.com/golang/example/hello")
tg.grepStderrNot(".", "expected no output on standard error")
// error if $HOME/go is a file
- tg.must(os.RemoveAll(tg.path("home/go")))
+ tg.must(robustio.RemoveAll(tg.path("home/go")))
tg.tempFile("home/go", "")
tg.runFail("get", "github.com/golang/example/hello")
tg.grepStderr(`mkdir .*[/\\]go: .*(not a directory|cannot find the path)`, "expected error because $HOME/go is a file")
@@ -2439,6 +2435,7 @@ func TestSymlinkWarning(t *testing.T) {
// Issue 8181.
func TestGoGetDashTIssue8181(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -2453,6 +2450,7 @@ func TestGoGetDashTIssue8181(t *testing.T) {
func TestIssue11307(t *testing.T) {
// go get -u was not working except in checkout directory
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -2875,7 +2873,7 @@ func TestCgoDependsOnSyscall(t *testing.T) {
files, err := filepath.Glob(filepath.Join(runtime.GOROOT(), "pkg", "*_race"))
tg.must(err)
for _, file := range files {
- tg.check(os.RemoveAll(file))
+ tg.check(robustio.RemoveAll(file))
}
tg.tempFile("src/foo/foo.go", `
package foo
@@ -2931,6 +2929,7 @@ func TestCgoPkgConfig(t *testing.T) {
tg.run("env", "PKG_CONFIG")
pkgConfig := strings.TrimSpace(tg.getStdout())
+ testenv.MustHaveExecPath(t, pkgConfig)
if out, err := exec.Command(pkgConfig, "--atleast-pkgconfig-version", "0.24").CombinedOutput(); err != nil {
t.Skipf("%s --atleast-pkgconfig-version 0.24: %v\n%s", pkgConfig, err, out)
}
@@ -3033,9 +3032,7 @@ func TestIssue7573(t *testing.T) {
if !canCgo {
t.Skip("skipping because cgo not enabled")
}
- if _, err := exec.LookPath("gccgo"); err != nil {
- t.Skip("skipping because no gccgo compiler found")
- }
+ testenv.MustHaveExecPath(t, "gccgo")
tg := testgo(t)
defer tg.cleanup()
@@ -3324,6 +3321,7 @@ func TestGoGenerateBadImports(t *testing.T) {
func TestGoGetCustomDomainWildcard(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -3335,6 +3333,7 @@ func TestGoGetCustomDomainWildcard(t *testing.T) {
func TestGoGetInternalWildcard(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -3407,6 +3406,7 @@ func TestVetWithOnlyCgoFiles(t *testing.T) {
// Issue 9767, 19769.
func TestGoGetDotSlashDownload(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -3662,6 +3662,7 @@ func TestImportLocal(t *testing.T) {
func TestGoGetInsecure(t *testing.T) {
test := func(t *testing.T, modules bool) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -3702,6 +3703,7 @@ func TestGoGetInsecure(t *testing.T) {
func TestGoGetUpdateInsecure(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -3726,6 +3728,7 @@ func TestGoGetUpdateInsecure(t *testing.T) {
func TestGoGetUpdateUnknownProtocol(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -3760,6 +3763,7 @@ func TestGoGetUpdateUnknownProtocol(t *testing.T) {
func TestGoGetInsecureCustomDomain(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -3862,6 +3866,7 @@ func TestGoGetUpdate(t *testing.T) {
// former dependencies, not current ones.
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -3889,6 +3894,7 @@ func TestGoGetUpdate(t *testing.T) {
// Issue #20512.
func TestGoGetRace(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
if !canRace {
t.Skip("skipping because race detector not supported")
}
@@ -3905,6 +3911,7 @@ func TestGoGetDomainRoot(t *testing.T) {
// go get foo.io (not foo.io/subdir) was not working consistently.
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -3919,10 +3926,10 @@ func TestGoGetDomainRoot(t *testing.T) {
tg.run("get", "go-get-issue-9357.appspot.com")
tg.run("get", "-u", "go-get-issue-9357.appspot.com")
- tg.must(os.RemoveAll(tg.path("src/go-get-issue-9357.appspot.com")))
+ tg.must(robustio.RemoveAll(tg.path("src/go-get-issue-9357.appspot.com")))
tg.run("get", "go-get-issue-9357.appspot.com")
- tg.must(os.RemoveAll(tg.path("src/go-get-issue-9357.appspot.com")))
+ tg.must(robustio.RemoveAll(tg.path("src/go-get-issue-9357.appspot.com")))
tg.run("get", "-u", "go-get-issue-9357.appspot.com")
}
@@ -4303,6 +4310,7 @@ func TestGenerateUsesBuildContext(t *testing.T) {
// Issue 14450: go get -u .../ tried to import not downloaded package
func TestGoGetUpdateWithWildcard(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -4514,8 +4522,9 @@ func TestLinkXImportPathEscape(t *testing.T) {
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
+ tg.makeTempdir()
tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
- exe := "./linkx" + exeSuffix
+ exe := tg.path("linkx" + exeSuffix)
tg.creatingTemp(exe)
tg.run("build", "-o", exe, "-ldflags", "-X=my.pkg.Text=linkXworked", "my.pkg/main")
out, err := exec.Command(exe).CombinedOutput()
@@ -4751,7 +4760,7 @@ func TestExecutableGOROOT(t *testing.T) {
check(t, symGoTool, newRoot)
})
- tg.must(os.RemoveAll(tg.path("new/pkg")))
+ tg.must(robustio.RemoveAll(tg.path("new/pkg")))
// Binaries built in the new tree should report the
// new tree when they call runtime.GOROOT.
@@ -5051,9 +5060,8 @@ func TestExecBuildX(t *testing.T) {
t.Skip("skipping because cgo not enabled")
}
- if runtime.GOOS == "plan9" || runtime.GOOS == "windows" {
- t.Skipf("skipping because unix shell is not supported on %s", runtime.GOOS)
- }
+ testenv.MustHaveExecPath(t, "/usr/bin/env")
+ testenv.MustHaveExecPath(t, "bash")
tg := testgo(t)
defer tg.cleanup()
@@ -5103,7 +5111,7 @@ func TestExecBuildX(t *testing.T) {
if len(matches) == 0 {
t.Fatal("no WORK directory")
}
- tg.must(os.RemoveAll(matches[1]))
+ tg.must(robustio.RemoveAll(matches[1]))
}
func TestParallelNumber(t *testing.T) {
@@ -5134,9 +5142,10 @@ func TestUpxCompression(t *testing.T) {
t.Skipf("skipping upx test on %s/%s", runtime.GOOS, runtime.GOARCH)
}
+ testenv.MustHaveExecPath(t, "upx")
out, err := exec.Command("upx", "--version").CombinedOutput()
if err != nil {
- t.Skip("skipping because upx is not available")
+ t.Fatalf("upx --version failed: %v", err)
}
// upx --version prints `upx ` in the first line of output:
@@ -5145,13 +5154,13 @@ func TestUpxCompression(t *testing.T) {
re := regexp.MustCompile(`([[:digit:]]+)\.([[:digit:]]+)`)
upxVersion := re.FindStringSubmatch(string(out))
if len(upxVersion) != 3 {
- t.Errorf("bad upx version string: %s", upxVersion)
+ t.Fatalf("bad upx version string: %s", upxVersion)
}
major, err1 := strconv.Atoi(upxVersion[1])
minor, err2 := strconv.Atoi(upxVersion[2])
if err1 != nil || err2 != nil {
- t.Errorf("bad upx version string: %s", upxVersion[0])
+ t.Fatalf("bad upx version string: %s", upxVersion[0])
}
// Anything below 3.94 is known not to work with go binaries
@@ -5204,26 +5213,29 @@ func TestQEMUUserMode(t *testing.T) {
src, obj := tg.path("main.go"), tg.path("main")
for _, arch := range testArchs {
- out, err := exec.Command("qemu-"+arch.qemu, "--version").CombinedOutput()
- if err != nil {
- t.Logf("Skipping %s test (qemu-%s not available)", arch.g, arch.qemu)
- continue
- }
+ arch := arch
+ t.Run(arch.g, func(t *testing.T) {
+ qemu := "qemu-" + arch.qemu
+ testenv.MustHaveExecPath(t, qemu)
- tg.setenv("GOARCH", arch.g)
- tg.run("build", "-o", obj, src)
+ out, err := exec.Command(qemu, "--version").CombinedOutput()
+ if err != nil {
+ t.Fatalf("%s --version failed: %v", qemu, err)
+ }
- out, err = exec.Command("qemu-"+arch.qemu, obj).CombinedOutput()
- if err != nil {
- t.Logf("qemu-%s output:\n%s\n", arch.qemu, out)
- t.Errorf("qemu-%s failed with %v", arch.qemu, err)
- continue
- }
- if want := "hello qemu-user"; string(out) != want {
- t.Errorf("bad output from qemu-%s:\ngot %s; want %s", arch.qemu, out, want)
- }
+ tg.setenv("GOARCH", arch.g)
+ tg.run("build", "-o", obj, src)
+
+ out, err = exec.Command(qemu, obj).CombinedOutput()
+ if err != nil {
+ t.Logf("%s output:\n%s\n", qemu, out)
+ t.Fatalf("%s failed with %v", qemu, err)
+ }
+ if want := "hello qemu-user"; string(out) != want {
+ t.Errorf("bad output from %s:\ngot %s; want %s", qemu, out, want)
+ }
+ })
}
-
}
func TestCacheListStale(t *testing.T) {
diff --git a/src/cmd/go/go_windows_test.go b/src/cmd/go/go_windows_test.go
index d65d91f712..3999166ed9 100644
--- a/src/cmd/go/go_windows_test.go
+++ b/src/cmd/go/go_windows_test.go
@@ -12,6 +12,8 @@ import (
"path/filepath"
"strings"
"testing"
+
+ "cmd/go/internal/robustio"
)
func TestAbsolutePath(t *testing.T) {
@@ -21,7 +23,7 @@ func TestAbsolutePath(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- defer os.RemoveAll(tmp)
+ defer robustio.RemoveAll(tmp)
file := filepath.Join(tmp, "a.go")
err = ioutil.WriteFile(file, []byte{}, 0644)
diff --git a/src/cmd/go/internal/cache/cache.go b/src/cmd/go/internal/cache/cache.go
index c1d073806e..116279c977 100644
--- a/src/cmd/go/internal/cache/cache.go
+++ b/src/cmd/go/internal/cache/cache.go
@@ -261,7 +261,7 @@ func (c *Cache) Trim() {
// We maintain in dir/trim.txt the time of the last completed cache trim.
// If the cache has been trimmed recently enough, do nothing.
// This is the common case.
- data, _ := ioutil.ReadFile(filepath.Join(c.dir, "trim.txt"))
+ data, _ := renameio.ReadFile(filepath.Join(c.dir, "trim.txt"))
t, err := strconv.ParseInt(strings.TrimSpace(string(data)), 10, 64)
if err == nil && now.Sub(time.Unix(t, 0)) < trimInterval {
return
diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
index 77d8bab14f..a0b51a72c3 100644
--- a/src/cmd/go/internal/cfg/cfg.go
+++ b/src/cmd/go/internal/cfg/cfg.go
@@ -265,6 +265,7 @@ var knownEnv = `
GOOS
GOPATH
GOPPC64
+ GOPRIVATE
GOPROXY
GOROOT
GOSUMDB
@@ -291,30 +292,13 @@ var (
GOPPC64 = envOr("GOPPC64", fmt.Sprintf("%s%d", "power", objabi.GOPPC64))
GOWASM = envOr("GOWASM", fmt.Sprint(objabi.GOWASM))
- GOPROXY = goproxy()
- GOSUMDB = gosumdb()
- GONOPROXY = Getenv("GONOPROXY")
- GONOSUMDB = Getenv("GONOSUMDB")
+ GOPROXY = envOr("GOPROXY", "https://proxy.golang.org,direct")
+ GOSUMDB = envOr("GOSUMDB", "sum.golang.org")
+ GOPRIVATE = Getenv("GOPRIVATE")
+ GONOPROXY = envOr("GONOPROXY", GOPRIVATE)
+ GONOSUMDB = envOr("GONOSUMDB", GOPRIVATE)
)
-func goproxy() string {
- v := Getenv("GOPROXY")
- if v != "" {
- return v
- }
-
- return "https://proxy.golang.org"
-}
-
-func gosumdb() string {
- v := Getenv("GOSUMDB")
- if v != "" {
- return v
- }
-
- return "sum.golang.org"
-}
-
// GetArchEnv returns the name and setting of the
// GOARCH-specific architecture environment variable.
// If the current architecture has no GOARCH-specific variable,
diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
index b3d12dd681..17852deed1 100644
--- a/src/cmd/go/internal/envcmd/env.go
+++ b/src/cmd/go/internal/envcmd/env.go
@@ -79,6 +79,7 @@ func MkEnv() []cfg.EnvVar {
{Name: "GONOSUMDB", Value: cfg.GONOSUMDB},
{Name: "GOOS", Value: cfg.Goos},
{Name: "GOPATH", Value: cfg.BuildContext.GOPATH},
+ {Name: "GOPRIVATE", Value: cfg.GOPRIVATE},
{Name: "GOPROXY", Value: cfg.GOPROXY},
{Name: "GOROOT", Value: cfg.GOROOT},
{Name: "GOSUMDB", Value: cfg.GOSUMDB},
diff --git a/src/cmd/go/internal/get/path.go b/src/cmd/go/internal/get/path.go
index d443bd28a9..67d7b8a47c 100644
--- a/src/cmd/go/internal/get/path.go
+++ b/src/cmd/go/internal/get/path.go
@@ -41,6 +41,9 @@ func checkPath(path string, fileName bool) error {
if path == "" {
return fmt.Errorf("empty string")
}
+ if path[0] == '-' {
+ return fmt.Errorf("leading dash")
+ }
if strings.Contains(path, "..") {
return fmt.Errorf("double dot")
}
diff --git a/src/cmd/go/internal/get/vcs.go b/src/cmd/go/internal/get/vcs.go
index c6516c8bb3..fca78b515f 100644
--- a/src/cmd/go/internal/get/vcs.go
+++ b/src/cmd/go/internal/get/vcs.go
@@ -112,7 +112,7 @@ var vcsHg = &vcsCmd{
name: "Mercurial",
cmd: "hg",
- createCmd: []string{"clone -U {repo} {dir}"},
+ createCmd: []string{"clone -U -- {repo} {dir}"},
downloadCmd: []string{"pull"},
// We allow both tag and branch names as 'tags'
@@ -128,7 +128,7 @@ var vcsHg = &vcsCmd{
tagSyncDefault: []string{"update default"},
scheme: []string{"https", "http", "ssh"},
- pingCmd: "identify {scheme}://{repo}",
+ pingCmd: "identify -- {scheme}://{repo}",
remoteRepo: hgRemoteRepo,
}
@@ -145,7 +145,7 @@ var vcsGit = &vcsCmd{
name: "Git",
cmd: "git",
- createCmd: []string{"clone {repo} {dir}", "-go-internal-cd {dir} submodule update --init --recursive"},
+ createCmd: []string{"clone -- {repo} {dir}", "-go-internal-cd {dir} submodule update --init --recursive"},
downloadCmd: []string{"pull --ff-only", "submodule update --init --recursive"},
tagCmd: []tagCmd{
@@ -165,7 +165,7 @@ var vcsGit = &vcsCmd{
tagSyncDefault: []string{"submodule update --init --recursive"},
scheme: []string{"git", "https", "http", "git+ssh", "ssh"},
- pingCmd: "ls-remote {scheme}://{repo}",
+ pingCmd: "ls-remote -- {scheme}://{repo}",
remoteRepo: gitRemoteRepo,
}
@@ -222,7 +222,7 @@ var vcsBzr = &vcsCmd{
name: "Bazaar",
cmd: "bzr",
- createCmd: []string{"branch {repo} {dir}"},
+ createCmd: []string{"branch -- {repo} {dir}"},
// Without --overwrite bzr will not pull tags that changed.
// Replace by --overwrite-tags after http://pad.lv/681792 goes in.
@@ -233,7 +233,7 @@ var vcsBzr = &vcsCmd{
tagSyncDefault: []string{"update -r revno:-1"},
scheme: []string{"https", "http", "bzr", "bzr+ssh"},
- pingCmd: "info {scheme}://{repo}",
+ pingCmd: "info -- {scheme}://{repo}",
remoteRepo: bzrRemoteRepo,
resolveRepo: bzrResolveRepo,
}
@@ -284,14 +284,14 @@ var vcsSvn = &vcsCmd{
name: "Subversion",
cmd: "svn",
- createCmd: []string{"checkout {repo} {dir}"},
+ createCmd: []string{"checkout -- {repo} {dir}"},
downloadCmd: []string{"update"},
// There is no tag command in subversion.
// The branch information is all in the path names.
scheme: []string{"https", "http", "svn", "svn+ssh"},
- pingCmd: "info {scheme}://{repo}",
+ pingCmd: "info -- {scheme}://{repo}",
remoteRepo: svnRemoteRepo,
}
@@ -334,7 +334,7 @@ var vcsFossil = &vcsCmd{
name: "Fossil",
cmd: "fossil",
- createCmd: []string{"-go-internal-mkdir {dir} clone {repo} " + filepath.Join("{dir}", fossilRepoName), "-go-internal-cd {dir} open .fossil"},
+ createCmd: []string{"-go-internal-mkdir {dir} clone -- {repo} " + filepath.Join("{dir}", fossilRepoName), "-go-internal-cd {dir} open .fossil"},
downloadCmd: []string{"up"},
tagCmd: []tagCmd{{"tag ls", `(.*)`}},
@@ -856,6 +856,9 @@ func validateRepoRoot(repoRoot string) error {
if url.Scheme == "" {
return errors.New("no scheme")
}
+ if url.Scheme == "file" {
+ return errors.New("file scheme disallowed")
+ }
return nil
}
diff --git a/src/cmd/go/internal/help/helpdoc.go b/src/cmd/go/internal/help/helpdoc.go
index 43ad57f2c0..c2b5fb4b83 100644
--- a/src/cmd/go/internal/help/helpdoc.go
+++ b/src/cmd/go/internal/help/helpdoc.go
@@ -509,9 +509,17 @@ General-purpose environment variables:
GOPATH
For more details see: 'go help gopath'.
GOPROXY
- URL of Go module proxy. See 'go help goproxy'.
+ URL of Go module proxy. See 'go help modules'.
+ GOPRIVATE, GONOPROXY, GONOSUMDB
+ Comma-separated list of glob patterns (in the syntax of Go's path.Match)
+ of module path prefixes that should always be fetched directly
+ or that should not be compared against the checksum database.
+ See 'go help module-private'.
GOROOT
The root of the go tree.
+ GOSUMDB
+ The name of checksum database to use and optionally its public key and
+ URL. See 'go help module-auth'.
GOTMPDIR
The directory where the go command will write
temporary source files, packages, and binaries.
diff --git a/src/cmd/go/internal/imports/tags.go b/src/cmd/go/internal/imports/tags.go
index 1c22a472b8..14b4e21a02 100644
--- a/src/cmd/go/internal/imports/tags.go
+++ b/src/cmd/go/internal/imports/tags.go
@@ -8,6 +8,9 @@ import "cmd/go/internal/cfg"
var tags map[string]bool
+// Tags returns a set of build tags that are true for the target platform.
+// It includes GOOS, GOARCH, the compiler, possibly "cgo",
+// release tags like "go1.13", and user-specified build tags.
func Tags() map[string]bool {
if tags == nil {
tags = loadTags()
@@ -32,3 +35,15 @@ func loadTags() map[string]bool {
}
return tags
}
+
+var anyTags map[string]bool
+
+// AnyTags returns a special set of build tags that satisfy nearly all
+// build tag expressions. Only "ignore" and malformed build tag requirements
+// are considered false.
+func AnyTags() map[string]bool {
+ if anyTags == nil {
+ anyTags = map[string]bool{"*": true}
+ }
+ return anyTags
+}
diff --git a/src/cmd/go/internal/load/path.go b/src/cmd/go/internal/load/path.go
index 0211b284a4..584cdff891 100644
--- a/src/cmd/go/internal/load/path.go
+++ b/src/cmd/go/internal/load/path.go
@@ -6,32 +6,8 @@ package load
import (
"path/filepath"
- "strings"
)
-// hasSubdir reports whether dir is a subdirectory of
-// (possibly multiple levels below) root.
-// If so, it sets rel to the path fragment that must be
-// appended to root to reach dir.
-func hasSubdir(root, dir string) (rel string, ok bool) {
- if p, err := filepath.EvalSymlinks(root); err == nil {
- root = p
- }
- if p, err := filepath.EvalSymlinks(dir); err == nil {
- dir = p
- }
- const sep = string(filepath.Separator)
- root = filepath.Clean(root)
- if !strings.HasSuffix(root, sep) {
- root += sep
- }
- dir = filepath.Clean(dir)
- if !strings.HasPrefix(dir, root) {
- return "", false
- }
- return filepath.ToSlash(dir[len(root):]), true
-}
-
// expandPath returns the symlink-expanded form of path.
func expandPath(p string) string {
x, err := filepath.EvalSymlinks(p)
diff --git a/src/cmd/go/internal/modcmd/download.go b/src/cmd/go/internal/modcmd/download.go
index 9f8c410b82..71b660d6fd 100644
--- a/src/cmd/go/internal/modcmd/download.go
+++ b/src/cmd/go/internal/modcmd/download.go
@@ -5,6 +5,7 @@
package modcmd
import (
+ "cmd/go/internal/cfg"
"encoding/json"
"os"
@@ -67,6 +68,13 @@ type moduleJSON struct {
}
func runDownload(cmd *base.Command, args []string) {
+ // Check whether modules are enabled and whether we're in a module.
+ if cfg.Getenv("GO111MODULE") == "off" {
+ base.Fatalf("go: modules disabled by GO111MODULE=off; see 'go help modules'")
+ }
+ if !modload.HasModRoot() && len(args) == 0 {
+ base.Fatalf("go mod download: no modules specified (see 'go help mod download')")
+ }
if len(args) == 0 {
args = []string{"all"}
}
diff --git a/src/cmd/go/internal/modcmd/graph.go b/src/cmd/go/internal/modcmd/graph.go
index 5825c6d8ca..8fcb84f280 100644
--- a/src/cmd/go/internal/modcmd/graph.go
+++ b/src/cmd/go/internal/modcmd/graph.go
@@ -8,6 +8,7 @@ package modcmd
import (
"bufio"
+ "cmd/go/internal/cfg"
"os"
"sort"
@@ -33,6 +34,14 @@ func runGraph(cmd *base.Command, args []string) {
if len(args) > 0 {
base.Fatalf("go mod graph: graph takes no arguments")
}
+ // Checks go mod expected behavior
+ if !modload.Enabled() {
+ if cfg.Getenv("GO111MODULE") == "off" {
+ base.Fatalf("go: modules disabled by GO111MODULE=off; see 'go help modules'")
+ } else {
+ base.Fatalf("go: cannot find main module; see 'go help modules'")
+ }
+ }
modload.LoadBuildList()
reqs := modload.MinReqs()
diff --git a/src/cmd/go/internal/modcmd/vendor.go b/src/cmd/go/internal/modcmd/vendor.go
index 44cabd5dea..75513f1d9c 100644
--- a/src/cmd/go/internal/modcmd/vendor.go
+++ b/src/cmd/go/internal/modcmd/vendor.go
@@ -166,8 +166,6 @@ func matchMetadata(dir string, info os.FileInfo) bool {
return false
}
-var anyTagsExceptIgnore = map[string]bool{"*": true}
-
// matchPotentialSourceFile reports whether info may be relevant to a build operation.
func matchPotentialSourceFile(dir string, info os.FileInfo) bool {
if strings.HasSuffix(info.Name(), "_test.go") {
@@ -181,7 +179,7 @@ func matchPotentialSourceFile(dir string, info os.FileInfo) bool {
defer f.Close()
content, err := imports.ReadImports(f, false, nil)
- if err == nil && !imports.ShouldBuild(content, anyTagsExceptIgnore) {
+ if err == nil && !imports.ShouldBuild(content, imports.AnyTags()) {
// The file is explicitly tagged "ignore", so it can't affect the build.
// Leave it out.
return false
diff --git a/src/cmd/go/internal/modcmd/verify.go b/src/cmd/go/internal/modcmd/verify.go
index 381c18d58f..81fc44dc97 100644
--- a/src/cmd/go/internal/modcmd/verify.go
+++ b/src/cmd/go/internal/modcmd/verify.go
@@ -6,6 +6,7 @@ package modcmd
import (
"bytes"
+ "cmd/go/internal/cfg"
"fmt"
"io/ioutil"
"os"
@@ -36,6 +37,14 @@ func runVerify(cmd *base.Command, args []string) {
// NOTE(rsc): Could take a module pattern.
base.Fatalf("go mod verify: verify takes no arguments")
}
+ // Checks go mod expected behavior
+ if !modload.Enabled() {
+ if cfg.Getenv("GO111MODULE") == "off" {
+ base.Fatalf("go: modules disabled by GO111MODULE=off; see 'go help modules'")
+ } else {
+ base.Fatalf("go: cannot find main module; see 'go help modules'")
+ }
+ }
ok := true
for _, mod := range modload.LoadBuildList()[1:] {
ok = verifyMod(mod) && ok
diff --git a/src/cmd/go/internal/modconv/convert_test.go b/src/cmd/go/internal/modconv/convert_test.go
index d6316e36e9..32727e79eb 100644
--- a/src/cmd/go/internal/modconv/convert_test.go
+++ b/src/cmd/go/internal/modconv/convert_test.go
@@ -28,7 +28,7 @@ func TestMain(m *testing.M) {
}
func testMain(m *testing.M) int {
- modfetch.SetProxy("direct")
+ cfg.GOPROXY = "direct"
if _, err := exec.LookPath("git"); err != nil {
fmt.Fprintln(os.Stderr, "skipping because git binary not found")
@@ -106,11 +106,11 @@ func TestConvertLegacyConfig(t *testing.T) {
github.com/AdRoll/goamz v0.0.0-20150130162828-d3664b76d905
github.com/MSOpenTech/azure-sdk-for-go v0.0.0-20150323223030-d90753bcad2e
github.com/Sirupsen/logrus v0.7.3
- github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd
+ github.com/bugsnag/bugsnag-go v1.0.3-0.20141110184014-b1d153021fcd
github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b
github.com/bugsnag/panicwrap v0.0.0-20141110184334-e5f9854865b9
- github.com/codegangsta/cli v0.0.0-20150131031259-6086d7927ec3
- github.com/docker/docker v0.0.0-20150204013315-165ea5c158cf
+ github.com/codegangsta/cli v1.4.2-0.20150131031259-6086d7927ec3
+ github.com/docker/docker v1.4.2-0.20150204013315-165ea5c158cf
github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1
github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7
github.com/gorilla/context v0.0.0-20140604161150-14f550f51af5
@@ -118,7 +118,7 @@ func TestConvertLegacyConfig(t *testing.T) {
github.com/gorilla/mux v0.0.0-20140926153814-e444e69cbd2e
github.com/jlhawn/go-crypto v0.0.0-20150401213827-cd738dde20f0
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43
- github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50
+ github.com/yvasiyarov/gorelic v0.0.7-0.20141212073537-a9bba5b9ab50
github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f
golang.org/x/net v0.0.0-20150202051010-1dfe7915deaf
gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789
@@ -138,7 +138,7 @@ func TestConvertLegacyConfig(t *testing.T) {
github.com/googleapis/gax-go v2.0.0+incompatible
golang.org/x/net v0.0.0-20180216171745-136a25c244d3
golang.org/x/oauth2 v0.0.0-20180207181906-543e37812f10
- golang.org/x/text v0.0.0-20180208041248-4e4a3210bb54
+ golang.org/x/text v0.3.1-0.20180208041248-4e4a3210bb54
google.golang.org/api v0.0.0-20180217000815-c7a403bb5fe1
google.golang.org/appengine v1.0.0
google.golang.org/genproto v0.0.0-20180206005123-2b5a72b8730b
diff --git a/src/cmd/go/internal/modconv/dep.go b/src/cmd/go/internal/modconv/dep.go
index f433300171..ccd1fc7b75 100644
--- a/src/cmd/go/internal/modconv/dep.go
+++ b/src/cmd/go/internal/modconv/dep.go
@@ -6,9 +6,9 @@ package modconv
import (
"fmt"
+ "internal/lazyregexp"
"net/url"
"path"
- "regexp"
"strconv"
"strings"
@@ -96,7 +96,7 @@ func ParseGopkgLock(file string, data []byte) (*modfile.File, error) {
return mf, nil
}
-var scpSyntaxReg = regexp.MustCompile(`^([a-zA-Z0-9_]+)@([a-zA-Z0-9._-]+):(.*)$`)
+var scpSyntaxReg = lazyregexp.New(`^([a-zA-Z0-9_]+)@([a-zA-Z0-9._-]+):(.*)$`)
func decodeSource(source string) (string, error) {
var u *url.URL
diff --git a/src/cmd/go/internal/modfetch/cache.go b/src/cmd/go/internal/modfetch/cache.go
index f269c47f59..b23776d874 100644
--- a/src/cmd/go/internal/modfetch/cache.go
+++ b/src/cmd/go/internal/modfetch/cache.go
@@ -15,6 +15,7 @@ import (
"strings"
"cmd/go/internal/base"
+ "cmd/go/internal/cfg"
"cmd/go/internal/lockedfile"
"cmd/go/internal/modfetch/codehost"
"cmd/go/internal/module"
@@ -258,12 +259,12 @@ func (r *cachingRepo) Zip(dst io.Writer, version string) error {
// Stat is like Lookup(path).Stat(rev) but avoids the
// repository path resolution in Lookup if the result is
// already cached on local disk.
-func Stat(path, rev string) (*RevInfo, error) {
+func Stat(proxy, path, rev string) (*RevInfo, error) {
_, info, err := readDiskStat(path, rev)
if err == nil {
return info, nil
}
- repo, err := Lookup(path)
+ repo, err := Lookup(proxy, path)
if err != nil {
return nil, err
}
@@ -276,9 +277,22 @@ func InfoFile(path, version string) (string, error) {
if !semver.IsValid(version) {
return "", fmt.Errorf("invalid version %q", version)
}
- if _, err := Stat(path, version); err != nil {
+
+ if file, _, err := readDiskStat(path, version); err == nil {
+ return file, nil
+ }
+
+ err := TryProxies(func(proxy string) error {
+ repo, err := Lookup(proxy, path)
+ if err == nil {
+ _, err = repo.Stat(version)
+ }
+ return err
+ })
+ if err != nil {
return "", err
}
+
// Stat should have populated the disk cache for us.
file, _, err := readDiskStat(path, version)
if err != nil {
@@ -294,21 +308,39 @@ func GoMod(path, rev string) ([]byte, error) {
// Convert commit hash to pseudo-version
// to increase cache hit rate.
if !semver.IsValid(rev) {
- info, err := Stat(path, rev)
- if err != nil {
- return nil, err
+ if _, info, err := readDiskStat(path, rev); err == nil {
+ rev = info.Version
+ } else {
+ err := TryProxies(func(proxy string) error {
+ repo, err := Lookup(proxy, path)
+ if err != nil {
+ return err
+ }
+ info, err := repo.Stat(rev)
+ if err == nil {
+ rev = info.Version
+ }
+ return err
+ })
+ if err != nil {
+ return nil, err
+ }
}
- rev = info.Version
}
+
_, data, err := readDiskGoMod(path, rev)
if err == nil {
return data, nil
}
- repo, err := Lookup(path)
- if err != nil {
- return nil, err
- }
- return repo.GoMod(rev)
+
+ err = TryProxies(func(proxy string) error {
+ repo, err := Lookup(proxy, path)
+ if err == nil {
+ data, err = repo.GoMod(rev)
+ }
+ return err
+ })
+ return data, err
}
// GoModFile is like GoMod but returns the name of the file containing
@@ -354,8 +386,29 @@ var errNotCached = fmt.Errorf("not in cache")
func readDiskStat(path, rev string) (file string, info *RevInfo, err error) {
file, data, err := readDiskCache(path, rev, "info")
if err != nil {
- if file, info, err := readDiskStatByHash(path, rev); err == nil {
- return file, info, nil
+ // If the cache already contains a pseudo-version with the given hash, we
+ // would previously return that pseudo-version without checking upstream.
+ // However, that produced an unfortunate side-effect: if the author added a
+ // tag to the repository, 'go get' would not pick up the effect of that new
+ // tag on the existing commits, and 'go' commands that referred to those
+ // commits would use the previous name instead of the new one.
+ //
+ // That's especially problematic if the original pseudo-version starts with
+ // v0.0.0-, as was the case for all pseudo-versions during vgo development,
+ // since a v0.0.0- pseudo-version has lower precedence than pretty much any
+ // tagged version.
+ //
+ // In practice, we're only looking up by hash during initial conversion of a
+ // legacy config and during an explicit 'go get', and a little extra latency
+ // for those operations seems worth the benefit of picking up more accurate
+ // versions.
+ //
+ // Fall back to this resolution scheme only if the GOPROXY setting prohibits
+ // us from resolving upstream tags.
+ if cfg.GOPROXY == "off" {
+ if file, info, err := readDiskStatByHash(path, rev); err == nil {
+ return file, info, nil
+ }
}
return file, nil, err
}
@@ -405,13 +458,23 @@ func readDiskStatByHash(path, rev string) (file string, info *RevInfo, err error
if err != nil {
return "", nil, errNotCached
}
+
+ // A given commit hash may map to more than one pseudo-version,
+ // depending on which tags are present on the repository.
+ // Take the highest such version.
+ var maxVersion string
suffix := "-" + rev + ".info"
+ err = errNotCached
for _, name := range names {
- if strings.HasSuffix(name, suffix) && IsPseudoVersion(strings.TrimSuffix(name, ".info")) {
- return readDiskStat(path, strings.TrimSuffix(name, ".info"))
+ if strings.HasSuffix(name, suffix) {
+ v := strings.TrimSuffix(name, ".info")
+ if IsPseudoVersion(v) && semver.Max(maxVersion, v) == v {
+ maxVersion = v
+ file, info, err = readDiskStat(path, strings.TrimSuffix(name, ".info"))
+ }
}
}
- return "", nil, errNotCached
+ return file, info, err
}
// oldVgoPrefix is the prefix in the old auto-generated cached go.mod files.
@@ -451,7 +514,7 @@ func readDiskCache(path, rev, suffix string) (file string, data []byte, err erro
if err != nil {
return "", nil, errNotCached
}
- data, err = ioutil.ReadFile(file)
+ data, err = renameio.ReadFile(file)
if err != nil {
return file, nil, errNotCached
}
@@ -545,7 +608,7 @@ func rewriteVersionList(dir string) {
buf.WriteString(v)
buf.WriteString("\n")
}
- old, _ := ioutil.ReadFile(listFile)
+ old, _ := renameio.ReadFile(listFile)
if bytes.Equal(buf.Bytes(), old) {
return
}
diff --git a/src/cmd/go/internal/modfetch/codehost/git.go b/src/cmd/go/internal/modfetch/codehost/git.go
index 272eadcb23..a1d451d61a 100644
--- a/src/cmd/go/internal/modfetch/codehost/git.go
+++ b/src/cmd/go/internal/modfetch/codehost/git.go
@@ -80,7 +80,7 @@ func newGitRepo(remote string, localOK bool) (Repo, error) {
// but this lets us say git fetch origin instead, which
// is a little nicer. More importantly, using a named remote
// avoids a problem with Git LFS. See golang.org/issue/25605.
- if _, err := Run(r.dir, "git", "remote", "add", "origin", r.remote); err != nil {
+ if _, err := Run(r.dir, "git", "remote", "add", "origin", "--", r.remote); err != nil {
os.RemoveAll(r.dir)
return nil, err
}
@@ -123,8 +123,10 @@ type gitRepo struct {
statCache par.Cache
refsOnce sync.Once
- refs map[string]string
- refsErr error
+ // refs maps branch and tag refs (e.g., "HEAD", "refs/heads/master")
+ // to commits (e.g., "37ffd2e798afde829a34e8955b716ab730b2a6d6")
+ refs map[string]string
+ refsErr error
localTagsOnce sync.Once
localTags map[string]bool
@@ -407,7 +409,7 @@ func (r *gitRepo) fetchUnshallow(refSpecs ...string) error {
// statLocal returns a RevInfo describing rev in the local git repository.
// It uses version as info.Version.
func (r *gitRepo) statLocal(version, rev string) (*RevInfo, error) {
- out, err := Run(r.dir, "git", "-c", "log.showsignature=false", "log", "-n1", "--format=format:%H %ct %D", rev)
+ out, err := Run(r.dir, "git", "-c", "log.showsignature=false", "log", "-n1", "--format=format:%H %ct %D", rev, "--")
if err != nil {
return nil, fmt.Errorf("unknown revision %s", rev)
}
diff --git a/src/cmd/go/internal/modfetch/codehost/vcs.go b/src/cmd/go/internal/modfetch/codehost/vcs.go
index bad802c9c3..34aeedebc5 100644
--- a/src/cmd/go/internal/modfetch/codehost/vcs.go
+++ b/src/cmd/go/internal/modfetch/codehost/vcs.go
@@ -143,7 +143,7 @@ var vcsCmds = map[string]*vcsCmd{
"hg": {
vcs: "hg",
init: func(remote string) []string {
- return []string{"hg", "clone", "-U", remote, "."}
+ return []string{"hg", "clone", "-U", "--", remote, "."}
},
tags: func(remote string) []string {
return []string{"hg", "tags", "-q"}
@@ -168,7 +168,7 @@ var vcsCmds = map[string]*vcsCmd{
if subdir != "" {
pattern = []string{"-I", subdir + "/**"}
}
- return str.StringList("hg", "archive", "-t", "zip", "--no-decode", "-r", rev, "--prefix=prefix/", pattern, target)
+ return str.StringList("hg", "archive", "-t", "zip", "--no-decode", "-r", rev, "--prefix=prefix/", pattern, "--", target)
},
},
@@ -176,7 +176,7 @@ var vcsCmds = map[string]*vcsCmd{
vcs: "svn",
init: nil, // no local checkout
tags: func(remote string) []string {
- return []string{"svn", "list", strings.TrimSuffix(remote, "/trunk") + "/tags"}
+ return []string{"svn", "list", "--", strings.TrimSuffix(remote, "/trunk") + "/tags"}
},
tagRE: re(`(?m)^(.*?)/?$`),
statLocal: func(rev, remote string) []string {
@@ -184,12 +184,12 @@ var vcsCmds = map[string]*vcsCmd{
if rev == "latest" {
suffix = ""
}
- return []string{"svn", "log", "-l1", "--xml", remote + suffix}
+ return []string{"svn", "log", "-l1", "--xml", "--", remote + suffix}
},
parseStat: svnParseStat,
latest: "latest",
readFile: func(rev, file, remote string) []string {
- return []string{"svn", "cat", remote + "/" + file + "@" + rev}
+ return []string{"svn", "cat", "--", remote + "/" + file + "@" + rev}
},
// TODO: zip
},
@@ -197,7 +197,7 @@ var vcsCmds = map[string]*vcsCmd{
"bzr": {
vcs: "bzr",
init: func(remote string) []string {
- return []string{"bzr", "branch", "--use-existing-dir", remote, "."}
+ return []string{"bzr", "branch", "--use-existing-dir", "--", remote, "."}
},
fetch: []string{
"bzr", "pull", "--overwrite-tags",
@@ -220,14 +220,14 @@ var vcsCmds = map[string]*vcsCmd{
if subdir != "" {
extra = []string{"./" + subdir}
}
- return str.StringList("bzr", "export", "--format=zip", "-r", rev, "--root=prefix/", target, extra)
+ return str.StringList("bzr", "export", "--format=zip", "-r", rev, "--root=prefix/", "--", target, extra)
},
},
"fossil": {
vcs: "fossil",
init: func(remote string) []string {
- return []string{"fossil", "clone", remote, ".fossil"}
+ return []string{"fossil", "clone", "--", remote, ".fossil"}
},
fetch: []string{"fossil", "pull", "-R", ".fossil"},
tags: func(remote string) []string {
@@ -249,7 +249,7 @@ var vcsCmds = map[string]*vcsCmd{
}
// Note that vcsRepo.ReadZip below rewrites this command
// to run in a different directory, to work around a fossil bug.
- return str.StringList("fossil", "zip", "-R", ".fossil", "--name", "prefix", extra, rev, target)
+ return str.StringList("fossil", "zip", "-R", ".fossil", "--name", "prefix", extra, "--", rev, target)
},
},
}
diff --git a/src/cmd/go/internal/modfetch/coderepo.go b/src/cmd/go/internal/modfetch/coderepo.go
index 3581f93fe7..59f2cc70b5 100644
--- a/src/cmd/go/internal/modfetch/coderepo.go
+++ b/src/cmd/go/internal/modfetch/coderepo.go
@@ -208,6 +208,11 @@ func (r *codeRepo) Latest() (*RevInfo, error) {
return r.convert(info, "")
}
+// convert converts a version as reported by the code host to a version as
+// interpreted by the module system.
+//
+// If statVers is a valid module version, it is used for the Version field.
+// Otherwise, the Version is derived from the passed-in info and recent tags.
func (r *codeRepo) convert(info *codehost.RevInfo, statVers string) (*RevInfo, error) {
info2 := &RevInfo{
Name: info.Name,
@@ -268,7 +273,7 @@ func (r *codeRepo) convert(info *codehost.RevInfo, statVers string) (*RevInfo, e
}
// Otherwise make a pseudo-version.
if info2.Version == "" {
- tag, _ := r.code.RecentTag(statVers, p)
+ tag, _ := r.code.RecentTag(info.Name, p)
v = tagToVersion(tag)
// TODO: Check that v is OK for r.pseudoMajor or else is OK for incompatible.
info2.Version = PseudoVersion(r.pseudoMajor, v, info.Time, info.Short)
diff --git a/src/cmd/go/internal/modfetch/coderepo_test.go b/src/cmd/go/internal/modfetch/coderepo_test.go
index 724602233c..2cf6f81122 100644
--- a/src/cmd/go/internal/modfetch/coderepo_test.go
+++ b/src/cmd/go/internal/modfetch/coderepo_test.go
@@ -25,7 +25,7 @@ func TestMain(m *testing.M) {
}
func testMain(m *testing.M) int {
- SetProxy("direct")
+ cfg.GOPROXY = "direct"
// The sum database is populated using a released version of the go command,
// but this test may include fixes for additional modules that previously
@@ -48,11 +48,12 @@ const (
vgotest1hg = "vcs-test.golang.org/hg/vgotest1.hg"
)
-var altVgotests = []string{
- vgotest1hg,
+var altVgotests = map[string]string{
+ "hg": vgotest1hg,
}
type codeRepoTest struct {
+ vcs string
path string
lookerr string
mpath string
@@ -70,6 +71,7 @@ type codeRepoTest struct {
var codeRepoTests = []codeRepoTest{
{
+ vcs: "git",
path: "github.com/rsc/vgotest1",
rev: "v0.0.0",
version: "v0.0.0",
@@ -83,6 +85,7 @@ var codeRepoTests = []codeRepoTest{
},
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1",
rev: "v1.0.0",
version: "v1.0.0",
@@ -96,6 +99,7 @@ var codeRepoTests = []codeRepoTest{
},
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1/v2",
rev: "v2.0.0",
version: "v2.0.0",
@@ -105,6 +109,7 @@ var codeRepoTests = []codeRepoTest{
ziperr: "missing github.com/rsc/vgotest1/go.mod and .../v2/go.mod at revision v2.0.0",
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1",
rev: "80d85c5",
version: "v1.0.0",
@@ -118,6 +123,7 @@ var codeRepoTests = []codeRepoTest{
},
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1",
rev: "mytag",
version: "v1.0.0",
@@ -131,6 +137,7 @@ var codeRepoTests = []codeRepoTest{
},
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1/v2",
rev: "45f53230a",
version: "v2.0.0",
@@ -141,6 +148,7 @@ var codeRepoTests = []codeRepoTest{
ziperr: "missing github.com/rsc/vgotest1/go.mod and .../v2/go.mod at revision v2.0.0",
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1/v54321",
rev: "80d85c5",
version: "v54321.0.0-20180219231006-80d85c5d4d17",
@@ -150,16 +158,19 @@ var codeRepoTests = []codeRepoTest{
ziperr: "missing github.com/rsc/vgotest1/go.mod and .../v54321/go.mod at revision 80d85c5d4d17",
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1/submod",
rev: "v1.0.0",
err: "unknown revision submod/v1.0.0",
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1/submod",
rev: "v1.0.3",
err: "unknown revision submod/v1.0.3",
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1/submod",
rev: "v1.0.4",
version: "v1.0.4",
@@ -174,6 +185,7 @@ var codeRepoTests = []codeRepoTest{
},
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1",
rev: "v1.1.0",
version: "v1.1.0",
@@ -189,6 +201,7 @@ var codeRepoTests = []codeRepoTest{
},
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1/v2",
rev: "v2.0.1",
version: "v2.0.1",
@@ -198,6 +211,7 @@ var codeRepoTests = []codeRepoTest{
gomod: "module \"github.com/rsc/vgotest1/v2\" // root go.mod\n",
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1/v2",
rev: "v2.0.3",
version: "v2.0.3",
@@ -207,6 +221,7 @@ var codeRepoTests = []codeRepoTest{
gomoderr: "github.com/rsc/vgotest1/v2/go.mod has non-.../v2 module path \"github.com/rsc/vgotest\" at revision v2.0.3",
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1/v2",
rev: "v2.0.4",
version: "v2.0.4",
@@ -216,6 +231,7 @@ var codeRepoTests = []codeRepoTest{
gomoderr: "github.com/rsc/vgotest1/go.mod and .../v2/go.mod both have .../v2 module paths at revision v2.0.4",
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1/v2",
rev: "v2.0.5",
version: "v2.0.5",
@@ -226,6 +242,7 @@ var codeRepoTests = []codeRepoTest{
},
{
// redirect to github
+ vcs: "git",
path: "rsc.io/quote",
rev: "v1.0.0",
version: "v1.0.0",
@@ -236,6 +253,7 @@ var codeRepoTests = []codeRepoTest{
},
{
// redirect to static hosting proxy
+ vcs: "mod",
path: "swtch.com/testmod",
rev: "v1.0.0",
version: "v1.0.0",
@@ -245,6 +263,7 @@ var codeRepoTests = []codeRepoTest{
},
{
// redirect to googlesource
+ vcs: "git",
path: "golang.org/x/text",
rev: "4e4a3210bb",
version: "v0.3.1-0.20180208041248-4e4a3210bb54",
@@ -253,6 +272,7 @@ var codeRepoTests = []codeRepoTest{
time: time.Date(2018, 2, 8, 4, 12, 48, 0, time.UTC),
},
{
+ vcs: "git",
path: "github.com/pkg/errors",
rev: "v0.8.0",
version: "v0.8.0",
@@ -264,17 +284,20 @@ var codeRepoTests = []codeRepoTest{
// package in subdirectory - custom domain
// In general we can't reject these definitively in Lookup,
// but gopkg.in is special.
+ vcs: "git",
path: "gopkg.in/yaml.v2/abc",
lookerr: "invalid module path \"gopkg.in/yaml.v2/abc\"",
},
{
// package in subdirectory - github
// Because it's a package, Stat should fail entirely.
+ vcs: "git",
path: "github.com/rsc/quote/buggy",
rev: "c4d4236f",
err: "missing github.com/rsc/quote/buggy/go.mod at revision c4d4236f9242",
},
{
+ vcs: "git",
path: "gopkg.in/yaml.v2",
rev: "d670f940",
version: "v2.0.0",
@@ -284,6 +307,7 @@ var codeRepoTests = []codeRepoTest{
gomod: "module gopkg.in/yaml.v2\n",
},
{
+ vcs: "git",
path: "gopkg.in/check.v1",
rev: "20d25e280405",
version: "v1.0.0-20161208181325-20d25e280405",
@@ -293,6 +317,7 @@ var codeRepoTests = []codeRepoTest{
gomod: "module gopkg.in/check.v1\n",
},
{
+ vcs: "git",
path: "gopkg.in/yaml.v2",
rev: "v2",
version: "v2.2.3-0.20190319135612-7b8349ac747c",
@@ -302,6 +327,7 @@ var codeRepoTests = []codeRepoTest{
gomod: "module \"gopkg.in/yaml.v2\"\n\nrequire (\n\t\"gopkg.in/check.v1\" v0.0.0-20161208181325-20d25e280405\n)\n",
},
{
+ vcs: "git",
path: "vcs-test.golang.org/go/mod/gitrepo1",
rev: "master",
version: "v1.2.4-annotated",
@@ -311,6 +337,7 @@ var codeRepoTests = []codeRepoTest{
gomod: "module vcs-test.golang.org/go/mod/gitrepo1\n",
},
{
+ vcs: "git",
path: "gopkg.in/natefinch/lumberjack.v2",
rev: "latest",
version: "v2.0.0-20170531160350-a96e63847dc3",
@@ -320,6 +347,7 @@ var codeRepoTests = []codeRepoTest{
gomod: "module gopkg.in/natefinch/lumberjack.v2\n",
},
{
+ vcs: "git",
path: "gopkg.in/natefinch/lumberjack.v2",
// This repo has a v2.1 tag.
// We only allow semver references to tags that are fully qualified, as in v2.1.0.
@@ -335,6 +363,7 @@ var codeRepoTests = []codeRepoTest{
gomod: "module gopkg.in/natefinch/lumberjack.v2\n",
},
{
+ vcs: "git",
path: "vcs-test.golang.org/go/v2module/v2",
rev: "v2.0.0",
version: "v2.0.0",
@@ -359,8 +388,11 @@ func TestCodeRepo(t *testing.T) {
f := func(tt codeRepoTest) func(t *testing.T) {
return func(t *testing.T) {
t.Parallel()
+ if tt.vcs != "mod" {
+ testenv.MustHaveExecPath(t, tt.vcs)
+ }
- repo, err := Lookup(tt.path)
+ repo, err := Lookup("direct", tt.path)
if tt.lookerr != "" {
if err != nil && err.Error() == tt.lookerr {
return
@@ -457,9 +489,10 @@ func TestCodeRepo(t *testing.T) {
}
t.Run(strings.ReplaceAll(tt.path, "/", "_")+"/"+tt.rev, f(tt))
if strings.HasPrefix(tt.path, vgotest1git) {
- for _, alt := range altVgotests {
+ for vcs, alt := range altVgotests {
// Note: Communicating with f through tt; should be cleaned up.
old := tt
+ tt.vcs = vcs
tt.path = alt + strings.TrimPrefix(tt.path, vgotest1git)
if strings.HasPrefix(tt.mpath, vgotest1git) {
tt.mpath = alt + strings.TrimPrefix(tt.mpath, vgotest1git)
@@ -515,32 +548,39 @@ func remap(name string, m map[string]string) string {
}
var codeRepoVersionsTests = []struct {
+ vcs string
path string
prefix string
versions []string
}{
{
+ vcs: "git",
path: "github.com/rsc/vgotest1",
versions: []string{"v0.0.0", "v0.0.1", "v1.0.0", "v1.0.1", "v1.0.2", "v1.0.3", "v1.1.0", "v2.0.0+incompatible"},
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1",
prefix: "v1.0",
versions: []string{"v1.0.0", "v1.0.1", "v1.0.2", "v1.0.3"},
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1/v2",
versions: []string{"v2.0.0", "v2.0.1", "v2.0.2", "v2.0.3", "v2.0.4", "v2.0.5", "v2.0.6"},
},
{
+ vcs: "mod",
path: "swtch.com/testmod",
versions: []string{"v1.0.0", "v1.1.1"},
},
{
+ vcs: "git",
path: "gopkg.in/russross/blackfriday.v2",
versions: []string{"v2.0.0", "v2.0.1"},
},
{
+ vcs: "git",
path: "gopkg.in/natefinch/lumberjack.v2",
versions: []string{"v2.0.0"},
},
@@ -560,8 +600,11 @@ func TestCodeRepoVersions(t *testing.T) {
t.Run(strings.ReplaceAll(tt.path, "/", "_"), func(t *testing.T) {
tt := tt
t.Parallel()
+ if tt.vcs != "mod" {
+ testenv.MustHaveExecPath(t, tt.vcs)
+ }
- repo, err := Lookup(tt.path)
+ repo, err := Lookup("direct", tt.path)
if err != nil {
t.Fatalf("Lookup(%q): %v", tt.path, err)
}
@@ -578,23 +621,28 @@ func TestCodeRepoVersions(t *testing.T) {
}
var latestTests = []struct {
+ vcs string
path string
version string
err string
}{
{
+ vcs: "git",
path: "github.com/rsc/empty",
err: "no commits",
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1",
version: "v0.0.0-20180219223237-a08abb797a67",
},
{
+ vcs: "git",
path: "github.com/rsc/vgotest1/subdir",
err: "missing github.com/rsc/vgotest1/subdir/go.mod at revision a08abb797a67",
},
{
+ vcs: "mod",
path: "swtch.com/testmod",
version: "v1.1.1",
},
@@ -615,8 +663,11 @@ func TestLatest(t *testing.T) {
t.Run(name, func(t *testing.T) {
tt := tt
t.Parallel()
+ if tt.vcs != "mod" {
+ testenv.MustHaveExecPath(t, tt.vcs)
+ }
- repo, err := Lookup(tt.path)
+ repo, err := Lookup("direct", tt.path)
if err != nil {
t.Fatalf("Lookup(%q): %v", tt.path, err)
}
diff --git a/src/cmd/go/internal/modfetch/fetch.go b/src/cmd/go/internal/modfetch/fetch.go
index d40d2c6fac..bc1d35e690 100644
--- a/src/cmd/go/internal/modfetch/fetch.go
+++ b/src/cmd/go/internal/modfetch/fetch.go
@@ -205,13 +205,16 @@ func downloadZip(mod module.Version, zipfile string) (err error) {
}
}()
- repo, err := Lookup(mod.Path)
+ err = TryProxies(func(proxy string) error {
+ repo, err := Lookup(proxy, mod.Path)
+ if err != nil {
+ return err
+ }
+ return repo.Zip(f, mod.Version)
+ })
if err != nil {
return err
}
- if err := repo.Zip(f, mod.Version); err != nil {
- return err
- }
// Double-check that the paths within the zip file are well-formed.
//
@@ -290,7 +293,7 @@ func initGoSum() bool {
goSum.m = make(map[module.Version][]string)
goSum.checked = make(map[modSum]bool)
- data, err := ioutil.ReadFile(GoSumFile)
+ data, err := renameio.ReadFile(GoSumFile)
if err != nil && !os.IsNotExist(err) {
base.Fatalf("go: %v", err)
}
@@ -300,7 +303,7 @@ func initGoSum() bool {
// Add old go.modverify file.
// We'll delete go.modverify in WriteGoSum.
alt := strings.TrimSuffix(GoSumFile, ".sum") + ".modverify"
- if data, err := ioutil.ReadFile(alt); err == nil {
+ if data, err := renameio.ReadFile(alt); err == nil {
migrate := make(map[module.Version][]string)
readGoSum(migrate, alt, data)
for mod, sums := range migrate {
@@ -360,7 +363,7 @@ func checkMod(mod module.Version) {
if err != nil {
base.Fatalf("verifying %s@%s: %v", mod.Path, mod.Version, err)
}
- data, err := ioutil.ReadFile(ziphash)
+ data, err := renameio.ReadFile(ziphash)
if err != nil {
if os.IsNotExist(err) {
// This can happen if someone does rm -rf GOPATH/src/cache/download. So it goes.
@@ -487,7 +490,7 @@ func Sum(mod module.Version) string {
if err != nil {
return ""
}
- data, err := ioutil.ReadFile(ziphash)
+ data, err := renameio.ReadFile(ziphash)
if err != nil {
return ""
}
@@ -535,7 +538,7 @@ func WriteGoSum() {
if !goSum.overwrite {
// Re-read the go.sum file to incorporate any sums added by other processes
// in the meantime.
- data, err := ioutil.ReadFile(GoSumFile)
+ data, err := renameio.ReadFile(GoSumFile)
if err != nil && !os.IsNotExist(err) {
base.Fatalf("go: re-reading go.sum: %v", err)
}
@@ -628,7 +631,7 @@ For more information, see 'go help module-auth'.
`
-var HelpSum = &base.Command{
+var HelpModuleAuth = &base.Command{
UsageLine: "module-auth",
Short: "module authentication using go.sum",
Long: `
@@ -709,18 +712,56 @@ If GOSUMDB is set to "off", or if "go get" is invoked with the -insecure flag,
the checksum database is not consulted, and all unrecognized modules are
accepted, at the cost of giving up the security guarantee of verified repeatable
downloads for all modules. A better way to bypass the checksum database
-for specific modules is to use the GONOSUMDB environment variable.
-
-The GONOSUMDB environment variable is a comma-separated list of
-glob patterns (in the syntax of Go's path.Match) of module path prefixes
-that should not be compared against the checksum database.
-For example,
-
- GONOSUMDB=*.corp.example.com,rsc.io/private
-
-disables checksum database lookups for modules with path prefixes matching
-either pattern, including "git.corp.example.com/xyzzy", "rsc.io/private",
-and "rsc.io/private/quux".
+for specific modules is to use the GOPRIVATE or GONOSUMDB environment
+variables. See 'go help module-private' for details.
+
+The 'go env -w' command (see 'go help env') can be used to set these variables
+for future go command invocations.
+`,
+}
+
+var HelpModulePrivate = &base.Command{
+ UsageLine: "module-private",
+ Short: "module configuration for non-public modules",
+ Long: `
+The go command defaults to downloading modules from the public Go module
+mirror at proxy.golang.org. It also defaults to validating downloaded modules,
+regardless of source, against the public Go checksum database at sum.golang.org.
+These defaults work well for publicly available source code.
+
+The GOPRIVATE environment variable controls which modules the go command
+considers to be private (not available publicly) and should therefore not use the
+proxy or checksum database. The variable is a comma-separated list of
+glob patterns (in the syntax of Go's path.Match) of module path prefixes.
+For example,
+
+ GOPRIVATE=*.corp.example.com,rsc.io/private
+
+causes the go command to treat as private any module with a path prefix
+matching either pattern, including git.corp.example.com/xyzzy, rsc.io/private,
+and rsc.io/private/quux.
+
+The GOPRIVATE environment variable may be used by other tools as well to
+identify non-public modules. For example, an editor could use GOPRIVATE
+to decide whether to hyperlink a package import to a godoc.org page.
+
+For fine-grained control over module download and validation, the GONOPROXY
+and GONOSUMDB environment variables accept the same kind of glob list
+and override GOPRIVATE for the specific decision of whether to use the proxy
+and checksum database, respectively.
+
+For example, if a company ran a module proxy serving private modules,
+users would configure go using:
+
+ GOPRIVATE=*.corp.example.com
+ GOPROXY=proxy.example.com
+ GONOPROXY=none
+
+This would tell the go comamnd and other tools that modules beginning with
+a corp.example.com subdomain are private but that the company proxy should
+be used for downloading both public and private modules, because
+GONOPROXY has been set to a pattern that won't match any modules,
+overriding GOPRIVATE.
The 'go env -w' command (see 'go help env') can be used to set these variables
for future go command invocations.
diff --git a/src/cmd/go/internal/modfetch/proxy.go b/src/cmd/go/internal/modfetch/proxy.go
index 5f0432ceed..ce74e826e1 100644
--- a/src/cmd/go/internal/modfetch/proxy.go
+++ b/src/cmd/go/internal/modfetch/proxy.go
@@ -12,13 +12,12 @@ import (
"io/ioutil"
"net/url"
"os"
+ "path"
pathpkg "path"
"path/filepath"
- "runtime"
"strings"
"sync"
"time"
- "unicode"
"cmd/go/internal/base"
"cmd/go/internal/cfg"
@@ -84,16 +83,6 @@ cached module versions with GOPROXY=https://example.com/proxy.
`,
}
-var proxyURL = cfg.Getenv("GOPROXY")
-
-// SetProxy sets the proxy to use when fetching modules.
-// It accepts the same syntax as the GOPROXY environment variable,
-// which also provides its default configuration.
-// SetProxy must not be called after the first module fetch has begun.
-func SetProxy(url string) {
- proxyURL = url
-}
-
var proxyOnce struct {
sync.Once
list []string
@@ -102,13 +91,32 @@ var proxyOnce struct {
func proxyURLs() ([]string, error) {
proxyOnce.Do(func() {
- for _, proxyURL := range strings.Split(proxyURL, ",") {
+ if cfg.GONOPROXY != "" && cfg.GOPROXY != "direct" {
+ proxyOnce.list = append(proxyOnce.list, "noproxy")
+ }
+ for _, proxyURL := range strings.Split(cfg.GOPROXY, ",") {
+ proxyURL = strings.TrimSpace(proxyURL)
if proxyURL == "" {
continue
}
+ if proxyURL == "off" {
+ // "off" always fails hard, so can stop walking list.
+ proxyOnce.list = append(proxyOnce.list, "off")
+ break
+ }
if proxyURL == "direct" {
proxyOnce.list = append(proxyOnce.list, "direct")
- continue
+ // For now, "direct" is the end of the line. We may decide to add some
+ // sort of fallback behavior for them in the future, so ignore
+ // subsequent entries for forward-compatibility.
+ break
+ }
+
+ // Single-word tokens are reserved for built-in behaviors, and anything
+ // containing the string ":/" or matching an absolute file path must be a
+ // complete URL. For all other paths, implicitly add "https://".
+ if strings.ContainsAny(proxyURL, ".:/") && !strings.Contains(proxyURL, ":/") && !filepath.IsAbs(proxyURL) && !path.IsAbs(proxyURL) {
+ proxyURL = "https://" + proxyURL
}
// Check that newProxyRepo accepts the URL.
@@ -125,32 +133,30 @@ func proxyURLs() ([]string, error) {
return proxyOnce.list, proxyOnce.err
}
-func lookupProxy(path string) (Repo, error) {
- list, err := proxyURLs()
+// TryProxies iterates f over each configured proxy (including "noproxy" and
+// "direct" if applicable) until f returns an error that is not
+// equivalent to os.ErrNotExist.
+//
+// TryProxies then returns that final error.
+//
+// If GOPROXY is set to "off", TryProxies invokes f once with the argument
+// "off".
+func TryProxies(f func(proxy string) error) error {
+ proxies, err := proxyURLs()
if err != nil {
- return nil, err
+ return err
+ }
+ if len(proxies) == 0 {
+ return f("off")
}
- var repos listRepo
- for _, u := range list {
- var r Repo
- if u == "direct" {
- // lookupDirect does actual network traffic.
- // Especially if GOPROXY="http://mainproxy,direct",
- // avoid the network until we need it by using a lazyRepo wrapper.
- r = &lazyRepo{setup: lookupDirect, path: path}
- } else {
- // The URL itself was checked in proxyURLs.
- // The only possible error here is a bad path,
- // so we can return it unconditionally.
- r, err = newProxyRepo(u, path)
- if err != nil {
- return nil, err
- }
+ for _, proxy := range proxies {
+ err = f(proxy)
+ if !errors.Is(err, os.ErrNotExist) {
+ break
}
- repos = append(repos, r)
}
- return repos, nil
+ return err
}
type proxyRepo struct {
@@ -201,18 +207,6 @@ func (p *proxyRepo) getBytes(path string) ([]byte, error) {
func (p *proxyRepo) getBody(path string) (io.ReadCloser, error) {
fullPath := pathpkg.Join(p.url.Path, path)
- if p.url.Scheme == "file" {
- rawPath, err := url.PathUnescape(fullPath)
- if err != nil {
- return nil, err
- }
- if runtime.GOOS == "windows" && len(rawPath) >= 4 && rawPath[0] == '/' && unicode.IsLetter(rune(rawPath[1])) && rawPath[2] == ':' {
- // On Windows, file URLs look like "file:///C:/foo/bar". url.Path will
- // start with a slash which must be removed. See golang.org/issue/6027.
- rawPath = rawPath[1:]
- }
- return os.Open(filepath.FromSlash(rawPath))
- }
target := *p.url
target.Path = fullPath
@@ -342,117 +336,3 @@ func (p *proxyRepo) Zip(dst io.Writer, version string) error {
func pathEscape(s string) string {
return strings.ReplaceAll(url.PathEscape(s), "%2F", "/")
}
-
-// A lazyRepo is a lazily-initialized Repo,
-// constructed on demand by calling setup.
-type lazyRepo struct {
- path string
- setup func(string) (Repo, error)
- once sync.Once
- repo Repo
- err error
-}
-
-func (r *lazyRepo) init() {
- r.repo, r.err = r.setup(r.path)
-}
-
-func (r *lazyRepo) ModulePath() string {
- return r.path
-}
-
-func (r *lazyRepo) Versions(prefix string) ([]string, error) {
- if r.once.Do(r.init); r.err != nil {
- return nil, r.err
- }
- return r.repo.Versions(prefix)
-}
-
-func (r *lazyRepo) Stat(rev string) (*RevInfo, error) {
- if r.once.Do(r.init); r.err != nil {
- return nil, r.err
- }
- return r.repo.Stat(rev)
-}
-
-func (r *lazyRepo) Latest() (*RevInfo, error) {
- if r.once.Do(r.init); r.err != nil {
- return nil, r.err
- }
- return r.repo.Latest()
-}
-
-func (r *lazyRepo) GoMod(version string) ([]byte, error) {
- if r.once.Do(r.init); r.err != nil {
- return nil, r.err
- }
- return r.repo.GoMod(version)
-}
-
-func (r *lazyRepo) Zip(dst io.Writer, version string) error {
- if r.once.Do(r.init); r.err != nil {
- return r.err
- }
- return r.repo.Zip(dst, version)
-}
-
-// A listRepo is a preference list of Repos.
-// The list must be non-empty and all Repos
-// must return the same result from ModulePath.
-// For each method, the repos are tried in order
-// until one succeeds or returns a non-ErrNotExist (non-404) error.
-type listRepo []Repo
-
-func (l listRepo) ModulePath() string {
- return l[0].ModulePath()
-}
-
-func (l listRepo) Versions(prefix string) ([]string, error) {
- for i, r := range l {
- v, err := r.Versions(prefix)
- if i == len(l)-1 || !errors.Is(err, os.ErrNotExist) {
- return v, err
- }
- }
- panic("no repos")
-}
-
-func (l listRepo) Stat(rev string) (*RevInfo, error) {
- for i, r := range l {
- info, err := r.Stat(rev)
- if i == len(l)-1 || !errors.Is(err, os.ErrNotExist) {
- return info, err
- }
- }
- panic("no repos")
-}
-
-func (l listRepo) Latest() (*RevInfo, error) {
- for i, r := range l {
- info, err := r.Latest()
- if i == len(l)-1 || !errors.Is(err, os.ErrNotExist) {
- return info, err
- }
- }
- panic("no repos")
-}
-
-func (l listRepo) GoMod(version string) ([]byte, error) {
- for i, r := range l {
- data, err := r.GoMod(version)
- if i == len(l)-1 || !errors.Is(err, os.ErrNotExist) {
- return data, err
- }
- }
- panic("no repos")
-}
-
-func (l listRepo) Zip(dst io.Writer, version string) error {
- for i, r := range l {
- err := r.Zip(dst, version)
- if i == len(l)-1 || !errors.Is(err, os.ErrNotExist) {
- return err
- }
- }
- panic("no repos")
-}
diff --git a/src/cmd/go/internal/modfetch/repo.go b/src/cmd/go/internal/modfetch/repo.go
index 053256be4b..95351269db 100644
--- a/src/cmd/go/internal/modfetch/repo.go
+++ b/src/cmd/go/internal/modfetch/repo.go
@@ -5,6 +5,7 @@
package modfetch
import (
+ "errors"
"fmt"
"io"
"os"
@@ -172,20 +173,32 @@ type RevInfo struct {
var lookupCache par.Cache
-// Lookup returns the module with the given module path.
+type lookupCacheKey struct {
+ proxy, path string
+}
+
+// Lookup returns the module with the given module path,
+// fetched through the given proxy.
+//
+// The distinguished proxy "direct" indicates that the path should be fetched
+// from its origin, and "noproxy" indicates that the patch should be fetched
+// directly only if GONOPROXY matches the given path.
+//
+// For the distinguished proxy "off", Lookup always returns a non-nil error.
+//
// A successful return does not guarantee that the module
// has any defined versions.
-func Lookup(path string) (Repo, error) {
+func Lookup(proxy, path string) (Repo, error) {
if traceRepo {
- defer logCall("Lookup(%q)", path)()
+ defer logCall("Lookup(%q, %q)", proxy, path)()
}
type cached struct {
r Repo
err error
}
- c := lookupCache.Do(path, func() interface{} {
- r, err := lookup(path)
+ c := lookupCache.Do(lookupCacheKey{proxy, path}, func() interface{} {
+ r, err := lookup(proxy, path)
if err == nil {
if traceRepo {
r = newLoggingRepo(r)
@@ -199,19 +212,39 @@ func Lookup(path string) (Repo, error) {
}
// lookup returns the module with the given module path.
-func lookup(path string) (r Repo, err error) {
+func lookup(proxy, path string) (r Repo, err error) {
if cfg.BuildMod == "vendor" {
- return nil, fmt.Errorf("module lookup disabled by -mod=%s", cfg.BuildMod)
+ return nil, errModVendor
}
- if proxyURL == "off" {
- return nil, fmt.Errorf("module lookup disabled by GOPROXY=%s", proxyURL)
+
+ if str.GlobsMatchPath(cfg.GONOPROXY, path) {
+ switch proxy {
+ case "noproxy", "direct":
+ return lookupDirect(path)
+ default:
+ return nil, errNoproxy
+ }
}
- if proxyURL != "" && proxyURL != "direct" && !str.GlobsMatchPath(cfg.GONOPROXY, path) {
- return lookupProxy(path)
+
+ switch proxy {
+ case "off":
+ return nil, errProxyOff
+ case "direct":
+ return lookupDirect(path)
+ case "noproxy":
+ return nil, errUseProxy
+ default:
+ return newProxyRepo(proxy, path)
}
- return lookupDirect(path)
}
+var (
+ errModVendor = errors.New("module lookup disabled by -mod=vendor")
+ errProxyOff = errors.New("module lookup disabled by GOPROXY=off")
+ errNoproxy error = notExistError("disabled by GOPRIVATE/GONOPROXY")
+ errUseProxy error = notExistError("path does not match GOPRIVATE/GONOPROXY")
+)
+
func lookupDirect(path string) (Repo, error) {
security := web.SecureOnly
if get.Insecure {
@@ -220,7 +253,7 @@ func lookupDirect(path string) (Repo, error) {
rr, err := get.RepoRootForImportPath(path, get.PreferMod, security)
if err != nil {
// We don't know where to find code for a module with this path.
- return nil, err
+ return nil, notExistError(err.Error())
}
if rr.VCS == "mod" {
@@ -286,7 +319,7 @@ func ImportRepoRev(path, rev string) (Repo, *RevInfo, error) {
return nil, nil, err
}
- info, err := repo.(*codeRepo).convert(revInfo, "")
+ info, err := repo.(*codeRepo).convert(revInfo, rev)
if err != nil {
return nil, nil, err
}
@@ -362,3 +395,13 @@ func (l *loggingRepo) Zip(dst io.Writer, version string) error {
defer logCall("Repo[%s]: Zip(%s, %q)", l.r.ModulePath(), dstName, version)()
return l.r.Zip(dst, version)
}
+
+// A notExistError is like os.ErrNotExist, but with a custom message
+type notExistError string
+
+func (e notExistError) Error() string {
+ return string(e)
+}
+func (notExistError) Is(target error) bool {
+ return target == os.ErrNotExist
+}
diff --git a/src/cmd/go/internal/modfetch/sumdb.go b/src/cmd/go/internal/modfetch/sumdb.go
index 0af7219914..66a09d32c2 100644
--- a/src/cmd/go/internal/modfetch/sumdb.go
+++ b/src/cmd/go/internal/modfetch/sumdb.go
@@ -142,7 +142,10 @@ func (c *dbClient) initBase() {
return
}
for _, proxyURL := range urls {
- if proxyURL == "direct" {
+ if proxyURL == "noproxy" {
+ continue
+ }
+ if proxyURL == "direct" || proxyURL == "off" {
break
}
proxy, err := url.Parse(proxyURL)
diff --git a/src/cmd/go/internal/modget/get.go b/src/cmd/go/internal/modget/get.go
index d5ab59490c..93d6a15dae 100644
--- a/src/cmd/go/internal/modget/get.go
+++ b/src/cmd/go/internal/modget/get.go
@@ -9,15 +9,14 @@ import (
"cmd/go/internal/base"
"cmd/go/internal/cfg"
"cmd/go/internal/get"
+ "cmd/go/internal/imports"
"cmd/go/internal/load"
- "cmd/go/internal/modfetch"
"cmd/go/internal/modload"
"cmd/go/internal/module"
"cmd/go/internal/mvs"
"cmd/go/internal/par"
"cmd/go/internal/search"
"cmd/go/internal/semver"
- "cmd/go/internal/str"
"cmd/go/internal/work"
"errors"
"fmt"
@@ -29,9 +28,9 @@ import (
)
var CmdGet = &base.Command{
- // Note: -d -m -u are listed explicitly because they are the most common get flags.
+ // Note: -d -u are listed explicitly because they are the most common get flags.
// Do not send CLs removing them because they're covered by [get flags].
- UsageLine: "go get [-d] [-m] [-t] [-u] [-v] [-insecure] [build flags] [packages]",
+ UsageLine: "go get [-d] [-t] [-u] [-v] [-insecure] [build flags] [packages]",
Short: "add dependencies to current module and install them",
Long: `
Get resolves and adds dependencies to the current development module
@@ -60,11 +59,12 @@ dependency should be removed entirely, downgrading or removing modules
depending on it as needed.
The version suffix @latest explicitly requests the latest minor release of the
-given path.
-
-The suffix @patch requests the latest patch release: if the path is already in
-the build list, the selected version will have the same minor version.
-If the path is not already in the build list, @patch is equivalent to @latest.
+given path. The suffix @patch requests the latest patch release: if the path
+is already in the build list, the selected version will have the same minor
+version. If the path is not already in the build list, @patch is equivalent
+to @latest. Neither @latest nor @patch will cause 'go get' to downgrade a module
+in the build list if it is required at a newer pre-release version that is
+newer than the latest released version.
Although get defaults to using the latest version of the module containing
a named package, it does not use the latest version of that module's
@@ -78,9 +78,12 @@ those requirements by taking the maximum requested version.)
The -t flag instructs get to consider modules needed to build tests of
packages specified on the command line.
-The -u flag instructs get to update dependencies to use newer minor or
-patch releases when available. Continuing the previous example,
-'go get -u A' will use the latest A with B v1.3.1 (not B v1.2.3).
+The -u flag instructs get to update modules providing dependencies
+of packages named on the command line to use newer minor or patch
+releases when available. Continuing the previous example, 'go get -u A'
+will use the latest A with B v1.3.1 (not B v1.2.3). If B requires module C,
+but C does not provide any packages needed to build packages in A
+(not including tests), then C will not be updated.
The -u=patch flag (not -u patch) also instructs get to update dependencies,
but changes the default to select patch releases.
@@ -97,18 +100,6 @@ this automatically. Similarly, downgrading one dependency may
require downgrading other dependencies, and 'go get' does
this automatically as well.
-The -m flag instructs get to stop here, after resolving, upgrading,
-and downgrading modules and updating go.mod. When using -m,
-each specified package path must be a module path as well,
-not the import path of a package below the module root.
-
-When the -m and -u flags are used together, 'go get' will upgrade
-modules that provide packages depended on by the modules named on
-the command line. For example, 'go get -u -m A' will upgrade A and
-any module providing packages imported by packages in A.
-'go get -u -m' will upgrade modules that provided packages needed
-by the main module.
-
The -insecure flag permits fetching from repositories and resolving
custom domains using insecure schemes such as HTTP. Use with caution.
@@ -227,12 +218,14 @@ type querySpec struct {
// vers specifies what version of the module to get.
vers string
- // forceModulePath is true if path should be interpreted as a module path
- // even if -m is not specified.
+ // forceModulePath is true if path should be interpreted as a module path.
+ // If forceModulePath is true, prevM must be set.
forceModulePath bool
// prevM is the previous version of the module. prevM is needed
- // if vers is "patch", and the module was previously in the build list.
+ // to determine the minor version number if vers is "patch". It's also
+ // used to avoid downgrades from prerelease versions newer than
+ // "latest" and "patch". If prevM is set, forceModulePath must be true.
prevM module.Version
}
@@ -267,13 +260,21 @@ func runGet(cmd *base.Command, args []string) {
if *getFix {
fmt.Fprintf(os.Stderr, "go get: -fix flag is a no-op when using modules\n")
}
+ if *getM {
+ base.Fatalf("go get: -m flag is no longer supported; consider -d to skip building packages")
+ }
modload.LoadTests = *getT
if cfg.BuildMod == "vendor" {
base.Fatalf("go get: disabled by -mod=%s", cfg.BuildMod)
}
- modload.LoadBuildList()
+ buildList := modload.LoadBuildList()
+ buildList = buildList[:len(buildList):len(buildList)] // copy on append
+ versionByPath := make(map[string]string)
+ for _, m := range buildList {
+ versionByPath[m.Path] = m.Version
+ }
// Do not allow any updating of go.mod until we've applied
// all the requested changes and checked that the result matches
@@ -318,12 +319,7 @@ func runGet(cmd *base.Command, args []string) {
// contains no wildcards (...), check that it is a package in
// the main module. If the path contains wildcards but matches no
// packages, we'll warn after package loading.
- if len(args) > 0 && *getM {
- base.Errorf("go get %s: -m requires a module path, but a relative path must be a package in the main module", arg)
- continue
- }
-
- if !*getM && !strings.Contains(path, "...") {
+ if !strings.Contains(path, "...") {
pkgPath := modload.DirImportPath(filepath.FromSlash(path))
if pkgs := modload.TargetPackages(pkgPath); len(pkgs) == 0 {
abs, err := filepath.Abs(path)
@@ -341,25 +337,7 @@ func runGet(cmd *base.Command, args []string) {
}
case strings.Contains(path, "..."):
- // If we're using -m, look up modules in the build list that match
- // the pattern. Report an error if no modules match.
- if *getM {
- match := search.MatchPattern(path)
- matched := false
- for _, m := range modload.BuildList() {
- if match(m.Path) || str.HasPathPrefix(path, m.Path) {
- queries = append(queries, &query{querySpec: querySpec{path: m.Path, vers: vers, prevM: m, forceModulePath: true}, arg: arg})
- matched = true
- }
- }
- if !matched {
- base.Errorf("go get %s: pattern matches no modules in build list", arg)
- continue
- }
- break
- }
-
- // If we're not using -m, wait until we load packages to look up modules.
+ // Wait until we load packages to look up modules.
// We don't know yet whether any modules in the build list provide
// packages matching the pattern. For example, suppose
// golang.org/x/tools and golang.org/x/tools/playground are separate
@@ -369,50 +347,83 @@ func runGet(cmd *base.Command, args []string) {
// upgrade golang.org/x/tools.
case path == "all":
- // This is the package pattern "all" not the module pattern "all",
- // even if *getM. We won't create any queries yet, since we're going to
- // need to load packages anyway.
+ // Don't query modules until we load packages. We'll automatically
+ // look up any missing modules.
case search.IsMetaPackage(path):
base.Errorf("go get %s: explicit requirement on standard-library module %s not allowed", path, path)
continue
default:
- // The argument is a package path or module path or both.
- q := &query{querySpec: querySpec{path: path, vers: vers}, arg: arg}
- if vers == "patch" {
- if *getM {
- for _, m := range modload.BuildList() {
- if m.Path == path {
- q.prevM = m
- break
- }
- }
- queries = append(queries, q)
- } else {
- // We need to know the module containing path before asking for
- // a specific version. Wait until we load packages later.
+ // The argument is a package path.
+ if pkgs := modload.TargetPackages(path); len(pkgs) != 0 {
+ // The path is in the main module. Nothing to query.
+ if vers != "" && vers != "latest" && vers != "patch" {
+ base.Errorf("go get %s: can't request explicit version of path in main module", arg)
}
- } else {
- // The requested version of path doesn't depend on the existing version,
- // so don't bother resolving it.
- queries = append(queries, q)
+ continue
}
+
+ first := path
+ if i := strings.IndexByte(first, '/'); i >= 0 {
+ first = path
+ }
+ if !strings.Contains(first, ".") {
+ // The path doesn't have a dot in the first component and cannot be
+ // queried as a module. It may be a package in the standard library,
+ // which is fine, so don't report an error unless we encounter
+ // a problem loading packages below.
+ continue
+ }
+
+ // If we're querying "latest" or "patch", we need to know the current
+ // version of the module. For "latest", we want to avoid accidentally
+ // downgrading from a newer prerelease. For "patch", we need to query
+ // the correct minor version.
+ // Here, we check if "path" is the name of a module in the build list
+ // (other than the main module) and set prevM if so. If "path" isn't
+ // a module in the build list, the current version doesn't matter
+ // since it's either an unknown module or a package within a module
+ // that we'll discover later.
+ q := &query{querySpec: querySpec{path: path, vers: vers}, arg: arg}
+ if v, ok := versionByPath[path]; ok && path != modload.Target.Path {
+ q.prevM = module.Version{Path: path, Version: v}
+ q.forceModulePath = true
+ }
+ queries = append(queries, q)
}
}
base.ExitIfErrors()
- // Query modules referenced by command line arguments at requested versions,
- // and add them to the build list. We need to do this before loading packages
- // since patterns that refer to packages in unknown modules can't be
- // expanded. This also avoids looking up new modules while loading packages,
- // only to downgrade later.
+ // Query modules referenced by command line arguments at requested versions.
+ // We need to do this before loading packages since patterns that refer to
+ // packages in unknown modules can't be expanded. This also avoids looking
+ // up new modules while loading packages, only to downgrade later.
queryCache := make(map[querySpec]*query)
byPath := runQueries(queryCache, queries, nil)
- // Add queried modules to the build list. This prevents some additional
- // lookups for modules at "latest" when we load packages later.
- buildList, err := mvs.UpgradeAll(modload.Target, newUpgrader(byPath, nil))
+ // Add missing modules to the build list.
+ // We call SetBuildList here and elsewhere, since newUpgrader,
+ // ImportPathsQuiet, and other functions read the global build list.
+ for _, q := range queries {
+ if _, ok := versionByPath[q.m.Path]; !ok && q.m.Version != "none" {
+ buildList = append(buildList, q.m)
+ }
+ }
+ versionByPath = nil // out of date now; rebuilt later when needed
+ modload.SetBuildList(buildList)
+
+ // Upgrade modules specifically named on the command line. This is our only
+ // chance to upgrade modules without root packages (modOnly below).
+ // This also skips loading packages at an old version, only to upgrade
+ // and reload at a new version.
+ upgrade := make(map[string]*query)
+ for path, q := range byPath {
+ if q.path == q.m.Path && q.m.Version != "none" {
+ upgrade[path] = q
+ }
+ }
+ buildList, err := mvs.UpgradeAll(modload.Target, newUpgrader(upgrade, nil))
if err != nil {
base.Fatalf("go get: %v", err)
}
@@ -430,7 +441,7 @@ func runGet(cmd *base.Command, args []string) {
modOnly[q.m.Path] = q
continue
}
- if !*getM && q.path == q.m.Path {
+ if q.path == q.m.Path {
wg.Add(1)
go func(q *query) {
if hasPkg, err := modload.ModuleHasRootPackage(q.m); err != nil {
@@ -477,17 +488,12 @@ func runGet(cmd *base.Command, args []string) {
// Don't load packages if pkgPatterns is empty. Both
// modload.ImportPathsQuiet and ModulePackages convert an empty list
// of patterns to []string{"."}, which is not what we want.
- if *getM {
- matches = modload.ModulePackages(pkgPatterns)
- } else {
- matches = modload.ImportPathsQuiet(pkgPatterns)
- }
+ matches = modload.ImportPathsQuiet(pkgPatterns, imports.AnyTags())
seenPkgs = make(map[string]bool)
- install = make([]string, 0, len(pkgPatterns))
for i, match := range matches {
arg := pkgGets[i]
- if !*getM && len(match.Pkgs) == 0 {
+ if len(match.Pkgs) == 0 {
// If the pattern did not match any packages, look up a new module.
// If the pattern doesn't match anything on the last iteration,
// we'll print a warning after the outer loop.
@@ -497,7 +503,6 @@ func runGet(cmd *base.Command, args []string) {
continue
}
- install = append(install, arg.path)
allStd := true
for _, pkg := range match.Pkgs {
if !seenPkgs[pkg] {
@@ -514,14 +519,14 @@ func runGet(cmd *base.Command, args []string) {
continue
}
allStd = false
+ if m.Path == modload.Target.Path {
+ // pkg is in the main module.
+ continue
+ }
addQuery(&query{querySpec: querySpec{path: m.Path, vers: arg.vers, forceModulePath: true, prevM: m}, arg: arg.raw})
}
- if allStd {
- if *getM {
- base.Errorf("go get %s: cannot use pattern %q with -m", arg.raw, arg.raw)
- } else if arg.path != arg.raw {
- base.Errorf("go get %s: cannot use pattern %q with explicit version", arg.raw, arg.raw)
- }
+ if allStd && arg.path != arg.raw {
+ base.Errorf("go get %s: cannot use pattern %q with explicit version", arg.raw, arg.raw)
}
}
}
@@ -552,8 +557,10 @@ func runGet(cmd *base.Command, args []string) {
}
prevBuildList = buildList
}
- if !*getM {
- search.WarnUnmatched(matches) // don't warn on every iteration
+ if !*getD {
+ // Only print warnings after the last iteration,
+ // and only if we aren't going to build.
+ search.WarnUnmatched(matches)
}
// Handle downgrades.
@@ -576,7 +583,6 @@ func runGet(cmd *base.Command, args []string) {
// Scan for any upgrades lost by the downgrades.
var lostUpgrades []*query
- var versionByPath map[string]string
if len(down) > 0 {
versionByPath = make(map[string]string)
for _, m := range modload.BuildList() {
@@ -645,16 +651,19 @@ func runGet(cmd *base.Command, args []string) {
modload.AllowWriteGoMod()
modload.WriteGoMod()
- // If -m or -d was specified, we're done after the module work. We've
- // already downloaded modules by loading packages above. If neither flag
- // we specified, we need build and install the packages.
- // Note that 'go get -u' without any arguments results in len(install) == 1:
- // search.CleanImportPaths returns "." for empty args.
- if *getM || *getD || len(install) == 0 {
+ // If -d was specified, we're done after the module work.
+ // We've already downloaded modules by loading packages above.
+ // Otherwise, we need to build and install the packages matched by
+ // command line arguments. This may be a different set of packages,
+ // since we only build packages for the target platform.
+ // Note that 'go get -u' without arguments is equivalent to
+ // 'go get -u .', so we'll typically build the package in the current
+ // directory.
+ if *getD || len(pkgPatterns) == 0 {
return
}
work.BuildInit()
- pkgs := load.PackagesForBuild(install)
+ pkgs := load.PackagesForBuild(pkgPatterns)
work.InstallPackages(install, pkgs)
}
@@ -715,18 +724,24 @@ func runQueries(cache map[querySpec]*query, queries []*query, modOnly map[string
// If forceModulePath is set, getQuery must interpret path
// as a module path.
func getQuery(path, vers string, prevM module.Version, forceModulePath bool) (module.Version, error) {
- switch vers {
- case "":
- vers = "latest"
- case "patch":
- if prevM.Version == "" {
- vers = "latest"
- } else {
- vers = semver.MajorMinor(prevM.Version)
- }
+ if (prevM.Version != "") != forceModulePath {
+ // We resolve package patterns by calling QueryPattern, which does not
+ // accept a previous version and therefore cannot take it into account for
+ // the "latest" or "patch" queries.
+ // If we are resolving a package path or pattern, the caller has already
+ // resolved any existing packages to their containing module(s), and
+ // will set both prevM.Version and forceModulePath for those modules.
+ // The only remaining package patterns are those that are not already
+ // provided by the build list, which are indicated by
+ // an empty prevM.Version.
+ base.Fatalf("go get: internal error: prevM may be set if and only if forceModulePath is set")
}
- if forceModulePath || *getM || !strings.Contains(path, "...") {
+ if vers == "" || vers == "patch" && prevM.Version == "" {
+ vers = "latest"
+ }
+
+ if forceModulePath || !strings.Contains(path, "...") {
if path == modload.Target.Path {
if vers != "latest" {
return module.Version{}, fmt.Errorf("can't get a specific version of the main module")
@@ -734,13 +749,13 @@ func getQuery(path, vers string, prevM module.Version, forceModulePath bool) (mo
}
// If the path doesn't contain a wildcard, try interpreting it as a module path.
- info, err := modload.Query(path, vers, modload.Allowed)
+ info, err := modload.Query(path, vers, prevM.Version, modload.Allowed)
if err == nil {
return module.Version{Path: path, Version: info.Version}, nil
}
// If the query fails, and the path must be a real module, report the query error.
- if forceModulePath || *getM {
+ if forceModulePath {
return module.Version{}, err
}
}
@@ -799,6 +814,9 @@ func newUpgrader(cmdline map[string]*query, pkgs map[string]bool) *upgrader {
work = work[1:]
m := modload.PackageModule(pkg)
u.upgrade[m.Path] = true
+
+ // testImports is empty unless test imports were actually loaded,
+ // i.e., -t was set or "all" was one of the arguments.
imports, testImports := modload.PackageImports(pkg)
for _, imp := range imports {
add(imp)
@@ -872,18 +890,14 @@ func (u *upgrader) Upgrade(m module.Version) (module.Version, error) {
}
// Run query required by upgrade semantics.
- // Note that query "latest" is not the same as
- // using repo.Latest.
- // The query only falls back to untagged versions
- // if nothing is tagged. The Latest method
- // only ever returns untagged versions,
- // which is not what we want.
- query := "latest"
- if getU == "patch" {
- // For patch upgrade, query "v1.2".
- query = semver.MajorMinor(m.Version)
- }
- info, err := modload.Query(m.Path, query, modload.Allowed)
+ // Note that Query "latest" is not the same as using repo.Latest,
+ // which may return a pseudoversion for the latest commit.
+ // Query "latest" returns the newest tagged version or the newest
+ // prerelease version if there are no non-prereleases, or repo.Latest
+ // if there aren't any tagged versions. Since we're providing the previous
+ // version, Query will confirm the latest version is actually newer
+ // and will return the current version if not.
+ info, err := modload.Query(m.Path, string(getU), m.Version, modload.Allowed)
if err != nil {
// Report error but return m, to let version selection continue.
// (Reporting the error will fail the command at the next base.ExitIfErrors.)
@@ -898,18 +912,6 @@ func (u *upgrader) Upgrade(m module.Version) (module.Version, error) {
return m, nil
}
- // If we're on a later prerelease, keep using it,
- // even though normally an Upgrade will ignore prereleases.
- if semver.Compare(info.Version, m.Version) < 0 {
- return m, nil
- }
-
- // If we're on a pseudo-version chronologically after the latest tagged version, keep using it.
- // This avoids some accidental downgrades.
- if mTime, err := modfetch.PseudoVersionTime(m.Version); err == nil && info.Time.Before(mTime) {
- return m, nil
- }
-
return module.Version{Path: m.Path, Version: info.Version}, nil
}
diff --git a/src/cmd/go/internal/modload/build.go b/src/cmd/go/internal/modload/build.go
index 66a0a75d96..c26c8a2f59 100644
--- a/src/cmd/go/internal/modload/build.go
+++ b/src/cmd/go/internal/modload/build.go
@@ -79,7 +79,7 @@ func addUpdate(m *modinfo.ModulePublic) {
return
}
- if info, err := Query(m.Path, "latest", Allowed); err == nil && semver.Compare(info.Version, m.Version) > 0 {
+ if info, err := Query(m.Path, "latest", m.Version, Allowed); err == nil && semver.Compare(info.Version, m.Version) > 0 {
m.Update = &modinfo.ModulePublic{
Path: m.Path,
Version: info.Version,
@@ -127,7 +127,7 @@ func moduleInfo(m module.Version, fromBuildList bool) *modinfo.ModulePublic {
// complete fills in the extra fields in m.
complete := func(m *modinfo.ModulePublic) {
if m.Version != "" {
- if q, err := Query(m.Path, m.Version, nil); err != nil {
+ if q, err := Query(m.Path, m.Version, "", nil); err != nil {
m.Error = &modinfo.ModuleError{Err: err.Error()}
} else {
m.Version = q.Version
diff --git a/src/cmd/go/internal/modload/help.go b/src/cmd/go/internal/modload/help.go
index 96fec8451e..9ce8dfb33b 100644
--- a/src/cmd/go/internal/modload/help.go
+++ b/src/cmd/go/internal/modload/help.go
@@ -21,23 +21,26 @@ which source files are used in a given build.
Module support
-Go 1.13 includes official support for Go modules,
-including a module-aware 'go get' command.
-Module-aware mode is active by default.
+Go 1.13 includes support for Go modules. Module-aware mode is active by default
+whenever a go.mod file is found in, or in a parent of, the current directory.
+
+The quickest way to take advantage of module support is to check out your
+repository, create a go.mod file (described in the next section) there, and run
+go commands from within that file tree.
For more fine-grained control, Go 1.13 continues to respect
a temporary environment variable, GO111MODULE, which can be set to one
-of three string values: off, auto, or on (the default).
-If GO111MODULE=on or is unset, then the go command requires the use of
-modules, never consulting GOPATH. We refer to this as the command
+of three string values: off, on, or auto (the default).
+If GO111MODULE=on, then the go command requires the use of modules,
+never consulting GOPATH. We refer to this as the command
being module-aware or running in "module-aware mode".
-If GO111MODULE=auto, then the go command enables or disables module
-support based on the current directory. Module support is enabled only
-when the current directory is outside GOPATH/src and itself contains a
-go.mod file or is below a directory containing a go.mod file.
If GO111MODULE=off, then the go command never uses
module support. Instead it looks in vendor directories and GOPATH
to find dependencies; we now refer to this as "GOPATH mode."
+If GO111MODULE=auto or is unset, then the go command enables or disables
+module support based on the current directory.
+Module support is enabled only when the current directory contains a
+go.mod file or is below a directory containing a go.mod file.
In module-aware mode, GOPATH no longer defines the meaning of imports
during a build, but it still stores downloaded dependencies (in GOPATH/pkg/mod)
@@ -331,7 +334,9 @@ Module downloading and verification
The go command can fetch modules from a proxy or connect to source control
servers directly, according to the setting of the GOPROXY environment
variable (see 'go help env'). The default setting for GOPROXY is
-"https://proxy.golang.org", the Go module mirror run by Google.
+"https://proxy.golang.org,direct", which means to try the
+Go module mirror run by Google and fall back to a direct connection
+if the proxy reports that it does not have the module (HTTP error 404 or 410).
See https://proxy.golang.org/privacy for the service's privacy policy.
If GOPROXY is set to the string "direct", downloads use a direct connection
to source control servers. Setting GOPROXY to "off" disallows downloading
@@ -343,25 +348,15 @@ HTTP response. The string "direct" may appear in the proxy list,
to cause a direct connection to be attempted at that point in the search.
Any proxies listed after "direct" are never consulted.
-The GONOPROXY environment variable is a comma-separated list of
-glob patterns (in the syntax of Go's path.Match) of module path prefixes
-that should always be fetched directly, ignoring the GOPROXY setting.
-For example,
-
- GONOPROXY=*.corp.example.com,rsc.io/private
-
-forces a direct connection to download modules with path prefixes matching
-either pattern, including "git.corp.example.com/xyzzy", "rsc.io/private",
-and "rsc.io/private/quux".
-
-The 'go env -w' command (see 'go help env') can be used to set these variables
-for future go command invocations.
+The GOPRIVATE and GONOPROXY environment variables allow bypassing
+the proxy for selected modules. See 'go help module-private' for details.
No matter the source of the modules, the go command checks downloads against
known checksums, to detect unexpected changes in the content of any specific
module version from one day to the next. This check first consults the current
-module's go.sum file but falls back to the Go checksum database.
-See 'go help module-auth' for details.
+module's go.sum file but falls back to the Go checksum database, controlled by
+the GOSUMDB and GONOSUMDB environment variables. See 'go help module-auth'
+for details.
See 'go help goproxy' for details about the proxy protocol and also
the format of the cached downloaded packages.
diff --git a/src/cmd/go/internal/modload/import.go b/src/cmd/go/internal/modload/import.go
index 3f2007ca2b..dacc876701 100644
--- a/src/cmd/go/internal/modload/import.go
+++ b/src/cmd/go/internal/modload/import.go
@@ -18,7 +18,6 @@ import (
"cmd/go/internal/cfg"
"cmd/go/internal/modfetch"
- "cmd/go/internal/modfetch/codehost"
"cmd/go/internal/module"
"cmd/go/internal/par"
"cmd/go/internal/search"
@@ -188,10 +187,13 @@ func Import(path string) (m module.Version, dir string, err error) {
candidates, err := QueryPackage(path, "latest", Allowed)
if err != nil {
- if _, ok := err.(*codehost.VCSError); ok {
+ if errors.Is(err, os.ErrNotExist) {
+ // Return "cannot find module providing package […]" instead of whatever
+ // low-level error QueryPackage produced.
+ return module.Version{}, "", &ImportMissingError{ImportPath: path}
+ } else {
return module.Version{}, "", err
}
- return module.Version{}, "", &ImportMissingError{ImportPath: path}
}
m = candidates[0].Mod
newMissingVersion := ""
diff --git a/src/cmd/go/internal/modload/import_test.go b/src/cmd/go/internal/modload/import_test.go
index 9422a3d960..c6ade5d17f 100644
--- a/src/cmd/go/internal/modload/import_test.go
+++ b/src/cmd/go/internal/modload/import_test.go
@@ -21,7 +21,7 @@ var importTests = []struct {
},
{
path: "golang.org/x/net",
- err: "cannot find module providing package golang.org/x/net",
+ err: "module golang.org/x/net@.* found, but does not contain package golang.org/x/net",
},
{
path: "golang.org/x/text",
@@ -43,6 +43,7 @@ var importTests = []struct {
func TestImport(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
for _, tt := range importTests {
t.Run(strings.ReplaceAll(tt.path, "/", "_"), func(t *testing.T) {
diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go
index 14fadbf74e..a8fd06fa38 100644
--- a/src/cmd/go/internal/modload/init.go
+++ b/src/cmd/go/internal/modload/init.go
@@ -316,7 +316,7 @@ func InitMod() {
}
gomod := filepath.Join(modRoot, "go.mod")
- data, err := ioutil.ReadFile(gomod)
+ data, err := renameio.ReadFile(gomod)
if err != nil {
base.Fatalf("go: %v", err)
}
@@ -696,7 +696,7 @@ func WriteGoMod() {
defer unlock()
file := filepath.Join(modRoot, "go.mod")
- old, err := ioutil.ReadFile(file)
+ old, err := renameio.ReadFile(file)
if !bytes.Equal(old, modFileData) {
if bytes.Equal(old, new) {
// Some other process wrote the same go.mod file that we were about to write.
@@ -739,7 +739,7 @@ func fixVersion(path, vers string) (string, error) {
return vers, nil
}
- info, err := Query(path, vers, nil)
+ info, err := Query(path, vers, "", nil)
if err != nil {
return "", err
}
diff --git a/src/cmd/go/internal/modload/list.go b/src/cmd/go/internal/modload/list.go
index 2f1a3c24d2..c571ddc5f5 100644
--- a/src/cmd/go/internal/modload/list.go
+++ b/src/cmd/go/internal/modload/list.go
@@ -55,18 +55,28 @@ func listModules(args []string, listVersions bool) []*modinfo.ModulePublic {
base.Fatalf("go: cannot use relative path %s to specify module", arg)
}
if i := strings.Index(arg, "@"); i >= 0 {
- info, err := Query(arg[:i], arg[i+1:], nil)
+ path := arg[:i]
+ vers := arg[i+1:]
+ var current string
+ for _, m := range buildList {
+ if m.Path == path {
+ current = m.Version
+ break
+ }
+ }
+
+ info, err := Query(path, vers, current, nil)
if err != nil {
mods = append(mods, &modinfo.ModulePublic{
- Path: arg[:i],
- Version: arg[i+1:],
+ Path: path,
+ Version: vers,
Error: &modinfo.ModuleError{
Err: err.Error(),
},
})
continue
}
- mods = append(mods, moduleInfo(module.Version{Path: arg[:i], Version: info.Version}, false))
+ mods = append(mods, moduleInfo(module.Version{Path: path, Version: info.Version}, false))
continue
}
@@ -101,11 +111,18 @@ func listModules(args []string, listVersions bool) []*modinfo.ModulePublic {
// Don't make the user provide an explicit '@latest' when they're
// explicitly asking what the available versions are.
// Instead, resolve the module, even if it isn't an existing dependency.
- info, err := Query(arg, "latest", nil)
+ info, err := Query(arg, "latest", "", nil)
if err == nil {
mods = append(mods, moduleInfo(module.Version{Path: arg, Version: info.Version}, false))
- continue
+ } else {
+ mods = append(mods, &modinfo.ModulePublic{
+ Path: arg,
+ Error: &modinfo.ModuleError{
+ Err: err.Error(),
+ },
+ })
}
+ continue
}
mods = append(mods, &modinfo.ModulePublic{
Path: arg,
diff --git a/src/cmd/go/internal/modload/load.go b/src/cmd/go/internal/modload/load.go
index b64b5b68cd..f05975d331 100644
--- a/src/cmd/go/internal/modload/load.go
+++ b/src/cmd/go/internal/modload/load.go
@@ -33,8 +33,7 @@ import (
// buildList is the list of modules to use for building packages.
// It is initialized by calling ImportPaths, ImportFromFiles,
-// ModulePackages, LoadALL, or LoadBuildList, each of which uses
-// loaded.load.
+// LoadALL, or LoadBuildList, each of which uses loaded.load.
//
// Ideally, exactly ONE of those functions would be called,
// and exactly once. Most of the time, that's true.
@@ -52,15 +51,19 @@ var buildList []module.Version
var loaded *loader
// ImportPaths returns the set of packages matching the args (patterns),
-// adding modules to the build list as needed to satisfy new imports.
+// on the target platform. Modules may be added to the build list
+// to satisfy new imports.
func ImportPaths(patterns []string) []*search.Match {
- matches := ImportPathsQuiet(patterns)
+ matches := ImportPathsQuiet(patterns, imports.Tags())
search.WarnUnmatched(matches)
return matches
}
-// ImportPathsQuiet is like ImportPaths but does not warn about patterns with no matches.
-func ImportPathsQuiet(patterns []string) []*search.Match {
+// ImportPathsQuiet is like ImportPaths but does not warn about patterns with
+// no matches. It also lets the caller specify a set of build tags to match
+// packages. The build tags should typically be imports.Tags() or
+// imports.AnyTags(); a nil map has no special meaning.
+func ImportPathsQuiet(patterns []string, tags map[string]bool) []*search.Match {
var fsDirs [][]string
updateMatches := func(matches []*search.Match, iterating bool) {
for i, m := range matches {
@@ -170,81 +173,6 @@ func ImportPathsQuiet(patterns []string) []*search.Match {
}
}
- return loadPatterns(patterns, true, updateMatches)
-}
-
-// ModulePackages returns packages provided by each module in patterns.
-// patterns may contain module paths, patterns matching module paths,
-// "all" (interpreted as package pattern "all"), and "." (interpreted
-// as the main module). Additional modules (including modules providing
-// dependencies) may be added to the build list or upgraded.
-func ModulePackages(patterns []string) []*search.Match {
- updateMatches := func(matches []*search.Match, iterating bool) {
- for _, m := range matches {
- switch {
- case search.IsRelativePath(m.Pattern) || filepath.IsAbs(m.Pattern):
- if m.Pattern != "." {
- base.Errorf("go: path %s is not a module", m.Pattern)
- continue
- }
- m.Pkgs = matchPackages("...", loaded.tags, false, []module.Version{Target})
-
- case strings.Contains(m.Pattern, "..."):
- match := search.MatchPattern(m.Pattern)
- var matched []module.Version
- for _, mod := range buildList {
- if match(mod.Path) || str.HasPathPrefix(m.Pattern, mod.Path) {
- matched = append(matched, mod)
- }
- }
- m.Pkgs = matchPackages(m.Pattern, loaded.tags, false, matched)
-
- case m.Pattern == "all":
- loaded.testAll = true
- if iterating {
- // Enumerate the packages in the main module.
- // We'll load the dependencies as we find them.
- m.Pkgs = matchPackages("...", loaded.tags, false, []module.Version{Target})
- } else {
- // Starting with the packages in the main module,
- // enumerate the full list of "all".
- m.Pkgs = loaded.computePatternAll(m.Pkgs)
- }
-
- default:
- found := false
- for _, mod := range buildList {
- if mod.Path == m.Pattern {
- found = true
- m.Pkgs = matchPackages("...", loaded.tags, false, []module.Version{mod})
- break
- }
- }
- if !found {
- base.Errorf("go %s: module not in build list", m.Pattern)
- }
- }
- }
- }
- return loadPatterns(patterns, false, updateMatches)
-}
-
-// loadPatterns returns a set of packages matching the args (patterns),
-// adding modules to the build list as needed to satisfy new imports.
-//
-// useTags indicates whether to use the default build constraints to
-// filter source files. If useTags is false, only "ignore" and malformed
-// build tag requirements are considered false.
-//
-// The interpretation of patterns is determined by updateMatches, which will be
-// called repeatedly until the build list is finalized. updateMatches should
-// should store a list of matching packages in each search.Match when it is
-// called. The iterating parameter is true if the build list has not been
-// finalized yet.
-//
-// If errors are encountered, loadPatterns will print them and exit.
-// On success, loadPatterns will update the build list and write go.mod.
-func loadPatterns(patterns []string, useTags bool, updateMatches func(matches []*search.Match, iterating bool)) []*search.Match {
InitMod()
var matches []*search.Match
@@ -255,10 +183,7 @@ func loadPatterns(patterns []string, useTags bool, updateMatches func(matches []
})
}
- loaded = newLoader()
- if !useTags {
- loaded.tags = anyTags
- }
+ loaded = newLoader(tags)
loaded.load(func() []string {
var roots []string
updateMatches(matches, true)
@@ -337,12 +262,13 @@ func warnPattern(pattern string, list []string) []string {
func ImportFromFiles(gofiles []string) {
InitMod()
- imports, testImports, err := imports.ScanFiles(gofiles, imports.Tags())
+ tags := imports.Tags()
+ imports, testImports, err := imports.ScanFiles(gofiles, tags)
if err != nil {
base.Fatalf("go: %v", err)
}
- loaded = newLoader()
+ loaded = newLoader(tags)
loaded.load(func() []string {
var roots []string
roots = append(roots, imports...)
@@ -391,7 +317,7 @@ func LoadBuildList() []module.Version {
}
func ReloadBuildList() []module.Version {
- loaded = newLoader()
+ loaded = newLoader(imports.Tags())
loaded.load(func() []string { return nil })
return buildList
}
@@ -417,9 +343,8 @@ func LoadVendor() []string {
func loadAll(testAll bool) []string {
InitMod()
- loaded = newLoader()
+ loaded = newLoader(imports.AnyTags())
loaded.isALL = true
- loaded.tags = anyTags
loaded.testAll = testAll
if !testAll {
loaded.testRoots = true
@@ -438,15 +363,11 @@ func loadAll(testAll bool) []string {
return paths
}
-// anyTags is a special tags map that satisfies nearly all build tag expressions.
-// Only "ignore" and malformed build tag requirements are considered false.
-var anyTags = map[string]bool{"*": true}
-
// TargetPackages returns the list of packages in the target (top-level) module
// matching pattern, which may be relative to the working directory, under all
// build tag settings.
func TargetPackages(pattern string) []string {
- return matchPackages(pattern, anyTags, false, []module.Version{Target})
+ return matchPackages(pattern, imports.AnyTags(), false, []module.Version{Target})
}
// BuildList returns the module build list,
@@ -589,9 +510,9 @@ type loader struct {
// LoadTests controls whether the loaders load tests of the root packages.
var LoadTests bool
-func newLoader() *loader {
+func newLoader(tags map[string]bool) *loader {
ld := new(loader)
- ld.tags = imports.Tags()
+ ld.tags = tags
ld.testRoots = LoadTests
// Inside the "std" and "cmd" modules, we prefer to use the vendor directory
@@ -1208,11 +1129,15 @@ func (*mvsReqs) Upgrade(m module.Version) (module.Version, error) {
func versions(path string) ([]string, error) {
// Note: modfetch.Lookup and repo.Versions are cached,
// so there's no need for us to add extra caching here.
- repo, err := modfetch.Lookup(path)
- if err != nil {
- return nil, err
- }
- return repo.Versions("")
+ var versions []string
+ err := modfetch.TryProxies(func(proxy string) error {
+ repo, err := modfetch.Lookup(proxy, path)
+ if err == nil {
+ versions, err = repo.Versions("")
+ }
+ return err
+ })
+ return versions, err
}
// Previous returns the tagged version of m.Path immediately prior to
diff --git a/src/cmd/go/internal/modload/query.go b/src/cmd/go/internal/modload/query.go
index f0f67c193c..614592806d 100644
--- a/src/cmd/go/internal/modload/query.go
+++ b/src/cmd/go/internal/modload/query.go
@@ -5,13 +5,15 @@
package modload
import (
+ "errors"
"fmt"
+ "os"
pathpkg "path"
"strings"
"sync"
+ "cmd/go/internal/imports"
"cmd/go/internal/modfetch"
- "cmd/go/internal/modfetch/codehost"
"cmd/go/internal/module"
"cmd/go/internal/search"
"cmd/go/internal/semver"
@@ -22,22 +24,45 @@ import (
// The module must be a complete module path.
// The version must take one of the following forms:
//
-// - the literal string "latest", denoting the latest available, allowed tagged version,
-// with non-prereleases preferred over prereleases.
-// If there are no tagged versions in the repo, latest returns the most recent commit.
-// - v1, denoting the latest available tagged version v1.x.x.
-// - v1.2, denoting the latest available tagged version v1.2.x.
-// - v1.2.3, a semantic version string denoting that tagged version.
-// - v1.2.3, >=v1.2.3,
-// denoting the version closest to the target and satisfying the given operator,
-// with non-prereleases preferred over prereleases.
-// - a repository commit identifier or tag, denoting that commit.
+// - the literal string "latest", denoting the latest available, allowed
+// tagged version, with non-prereleases preferred over prereleases.
+// If there are no tagged versions in the repo, latest returns the most
+// recent commit.
+// - the literal string "patch", denoting the latest available tagged version
+// with the same major and minor number as current. If current is "",
+// "patch" is equivalent to "latest".
+// - v1, denoting the latest available tagged version v1.x.x.
+// - v1.2, denoting the latest available tagged version v1.2.x.
+// - v1.2.3, a semantic version string denoting that tagged version.
+// - v1.2.3, >=v1.2.3,
+// denoting the version closest to the target and satisfying the given operator,
+// with non-prereleases preferred over prereleases.
+// - a repository commit identifier or tag, denoting that commit.
//
-// If the allowed function is non-nil, Query excludes any versions for which allowed returns false.
+// current is optional, denoting the current version of the module.
+// If query is "latest" or "patch", current will be returned if it is a newer
+// semantic version or if it is a chronologically later pseudoversion. This
+// prevents accidental downgrades from newer prerelease or development
+// versions.
+//
+// If the allowed function is non-nil, Query excludes any versions for which
+// allowed returns false.
//
// If path is the path of the main module and the query is "latest",
// Query returns Target.Version as the version.
-func Query(path, query string, allowed func(module.Version) bool) (*modfetch.RevInfo, error) {
+func Query(path, query, current string, allowed func(module.Version) bool) (*modfetch.RevInfo, error) {
+ var info *modfetch.RevInfo
+ err := modfetch.TryProxies(func(proxy string) (err error) {
+ info, err = queryProxy(proxy, path, query, current, allowed)
+ return err
+ })
+ return info, err
+}
+
+func queryProxy(proxy, path, query, current string, allowed func(module.Version) bool) (*modfetch.RevInfo, error) {
+ if current != "" && !semver.IsValid(current) {
+ return nil, fmt.Errorf("invalid previous version %q", current)
+ }
if allowed == nil {
allowed = func(module.Version) bool { return true }
}
@@ -50,9 +75,22 @@ func Query(path, query string, allowed func(module.Version) bool) (*modfetch.Rev
var ok func(module.Version) bool
var prefix string
var preferOlder bool
+ var mayUseLatest bool
switch {
case query == "latest":
ok = allowed
+ mayUseLatest = true
+
+ case query == "patch":
+ if current == "" {
+ ok = allowed
+ mayUseLatest = true
+ } else {
+ prefix = semver.MajorMinor(current)
+ ok = func(m module.Version) bool {
+ return matchSemverPrefix(prefix, m.Version) && allowed(m)
+ }
+ }
case strings.HasPrefix(query, "<="):
v := query[len("<="):]
@@ -112,14 +150,14 @@ func Query(path, query string, allowed func(module.Version) bool) (*modfetch.Rev
// If the identifier is not a canonical semver tag — including if it's a
// semver tag with a +metadata suffix — then modfetch.Stat will populate
// info.Version with a suitable pseudo-version.
- info, err := modfetch.Stat(path, query)
+ info, err := modfetch.Stat(proxy, path, query)
if err != nil {
queryErr := err
// The full query doesn't correspond to a tag. If it is a semantic version
// with a +metadata suffix, see if there is a tag without that suffix:
// semantic versioning defines them to be equivalent.
if vers := module.CanonicalVersion(query); vers != "" && vers != query {
- info, err = modfetch.Stat(path, vers)
+ info, err = modfetch.Stat(proxy, path, vers)
}
if err != nil {
return nil, queryErr
@@ -146,7 +184,7 @@ func Query(path, query string, allowed func(module.Version) bool) (*modfetch.Rev
}
// Load versions and execute query.
- repo, err := modfetch.Lookup(path)
+ repo, err := modfetch.Lookup(proxy, path)
if err != nil {
return nil, err
}
@@ -155,41 +193,59 @@ func Query(path, query string, allowed func(module.Version) bool) (*modfetch.Rev
return nil, err
}
+ lookup := func(v string) (*modfetch.RevInfo, error) {
+ rev, err := repo.Stat(v)
+ if err != nil {
+ return nil, err
+ }
+
+ // For "latest" and "patch", make sure we don't accidentally downgrade
+ // from a newer prerelease or from a chronologically newer pseudoversion.
+ if current != "" && (query == "latest" || query == "patch") {
+ currentTime, err := modfetch.PseudoVersionTime(current)
+ if semver.Compare(rev.Version, current) < 0 || (err == nil && rev.Time.Before(currentTime)) {
+ return repo.Stat(current)
+ }
+ }
+
+ return rev, nil
+ }
+
if preferOlder {
for _, v := range versions {
if semver.Prerelease(v) == "" && ok(module.Version{Path: path, Version: v}) {
- return repo.Stat(v)
+ return lookup(v)
}
}
for _, v := range versions {
if semver.Prerelease(v) != "" && ok(module.Version{Path: path, Version: v}) {
- return repo.Stat(v)
+ return lookup(v)
}
}
} else {
for i := len(versions) - 1; i >= 0; i-- {
v := versions[i]
if semver.Prerelease(v) == "" && ok(module.Version{Path: path, Version: v}) {
- return repo.Stat(v)
+ return lookup(v)
}
}
for i := len(versions) - 1; i >= 0; i-- {
v := versions[i]
if semver.Prerelease(v) != "" && ok(module.Version{Path: path, Version: v}) {
- return repo.Stat(v)
+ return lookup(v)
}
}
}
- if query == "latest" {
+ if mayUseLatest {
// Special case for "latest": if no tags match, use latest commit in repo,
// provided it is not excluded.
- if info, err := repo.Latest(); err == nil && allowed(module.Version{Path: path, Version: info.Version}) {
- return info, nil
+ if latest, err := repo.Latest(); err == nil && allowed(module.Version{Path: path, Version: latest.Version}) {
+ return lookup(latest.Version)
}
}
- return nil, &NoMatchingVersionError{query: query}
+ return nil, &NoMatchingVersionError{query: query, current: current}
}
// isSemverPrefix reports whether v is a semantic version prefix: v1 or v1.2 (not v1.2.3).
@@ -248,14 +304,14 @@ func QueryPackage(path, query string, allowed func(module.Version) bool) ([]Quer
// If any matching package is in the main module, QueryPattern considers only
// the main module and only the version "latest", without checking for other
// possible modules.
-func QueryPattern(pattern string, query string, allowed func(module.Version) bool) ([]QueryResult, error) {
+func QueryPattern(pattern, query string, allowed func(module.Version) bool) ([]QueryResult, error) {
base := pattern
var match func(m module.Version, root string, isLocal bool) (pkgs []string)
if i := strings.Index(pattern, "..."); i >= 0 {
base = pathpkg.Dir(pattern[:i+3])
match = func(m module.Version, root string, isLocal bool) []string {
- return matchPackages(pattern, anyTags, false, []module.Version{m})
+ return matchPackages(pattern, imports.AnyTags(), false, []module.Version{m})
}
} else {
match = func(m module.Version, root string, isLocal bool) []string {
@@ -288,6 +344,74 @@ func QueryPattern(pattern string, query string, allowed func(module.Version) boo
}
}
+ var (
+ results []QueryResult
+ candidateModules = modulePrefixesExcludingTarget(base)
+ )
+ if len(candidateModules) == 0 {
+ return nil, fmt.Errorf("package %s is not in the main module (%s)", pattern, Target.Path)
+ }
+
+ err := modfetch.TryProxies(func(proxy string) error {
+ queryModule := func(path string) (r QueryResult, err error) {
+ r.Mod.Path = path
+ r.Rev, err = queryProxy(proxy, path, query, "", allowed)
+ if err != nil {
+ return r, err
+ }
+ r.Mod.Version = r.Rev.Version
+ root, isLocal, err := fetch(r.Mod)
+ if err != nil {
+ return r, err
+ }
+ r.Packages = match(r.Mod, root, isLocal)
+ if len(r.Packages) == 0 {
+ return r, &packageNotInModuleError{
+ mod: r.Mod,
+ query: query,
+ pattern: pattern,
+ }
+ }
+ return r, nil
+ }
+
+ var err error
+ results, err = queryPrefixModules(candidateModules, queryModule)
+ return err
+ })
+
+ return results, err
+}
+
+// modulePrefixesExcludingTarget returns all prefixes of path that may plausibly
+// exist as a module, excluding targetPrefix but otherwise including path
+// itself, sorted by descending length.
+func modulePrefixesExcludingTarget(path string) []string {
+ prefixes := make([]string, 0, strings.Count(path, "/")+1)
+
+ for {
+ if path != targetPrefix {
+ if _, _, ok := module.SplitPathVersion(path); ok {
+ prefixes = append(prefixes, path)
+ }
+ }
+
+ j := strings.LastIndexByte(path, '/')
+ if j < 0 {
+ break
+ }
+ path = path[:j]
+ }
+
+ return prefixes
+}
+
+type prefixResult struct {
+ QueryResult
+ err error
+}
+
+func queryPrefixModules(candidateModules []string, queryModule func(path string) (QueryResult, error)) (found []QueryResult, err error) {
// If the path we're attempting is not in the module cache and we don't have a
// fetch result cached either, we'll end up making a (potentially slow)
// request to the proxy or (often even slower) the origin server.
@@ -296,141 +420,96 @@ func QueryPattern(pattern string, query string, allowed func(module.Version) boo
QueryResult
err error
}
- results := make([]result, strings.Count(base, "/")+1) // by descending path length
- i, p := 0, base
+ results := make([]result, len(candidateModules))
var wg sync.WaitGroup
- wg.Add(len(results))
- for {
- go func(p string, r *result) (err error) {
- defer func() {
- r.err = err
- wg.Done()
- }()
-
- r.Mod.Path = p
- if HasModRoot() && p == Target.Path {
- r.Mod.Version = Target.Version
- r.Rev = &modfetch.RevInfo{Version: Target.Version}
- // We already know (from above) that Target does not contain any
- // packages matching pattern, so leave r.Packages empty.
- } else {
- r.Rev, err = Query(p, query, allowed)
- if err != nil {
- return err
- }
- r.Mod.Version = r.Rev.Version
- root, isLocal, err := fetch(r.Mod)
- if err != nil {
- return err
- }
- r.Packages = match(r.Mod, root, isLocal)
- }
- if len(r.Packages) == 0 {
- return &packageNotInModuleError{
- mod: r.Mod,
- query: query,
- pattern: pattern,
- }
- }
- return nil
+ wg.Add(len(candidateModules))
+ for i, p := range candidateModules {
+ go func(p string, r *result) {
+ r.QueryResult, r.err = queryModule(p)
+ wg.Done()
}(p, &results[i])
-
- j := strings.LastIndexByte(p, '/')
- if i++; i == len(results) {
- if j >= 0 {
- panic("undercounted slashes")
- }
- break
- }
- if j < 0 {
- panic("overcounted slashes")
- }
- p = p[:j]
}
wg.Wait()
// Classify the results. In case of failure, identify the error that the user
// is most likely to find helpful.
var (
- successes []QueryResult
- mostUseful result
+ noVersion *NoMatchingVersionError
+ noPackage *packageNotInModuleError
+ notExistErr error
)
for _, r := range results {
- if r.err == nil {
- successes = append(successes, r.QueryResult)
- continue
- }
-
- switch mostUseful.err.(type) {
+ switch rErr := r.err.(type) {
case nil:
- mostUseful = r
- continue
- case *packageNotInModuleError:
- // Any other error is more useful than one that reports that the main
- // module does not contain the requested packages.
- if mostUseful.Mod.Path == Target.Path {
- mostUseful = r
- continue
- }
- }
-
- switch r.err.(type) {
- case *codehost.VCSError:
- // A VCSError means that we've located a repository, but couldn't look
- // inside it for packages. That's a very strong signal, and should
- // override any others.
- return nil, r.err
- case *packageNotInModuleError:
- if r.Mod.Path == Target.Path {
- // Don't override a potentially-useful error for some other module with
- // a trivial error for the main module.
- continue
- }
- // A module with an appropriate prefix exists at the requested version,
- // but it does not contain the requested package(s).
- if _, worsePath := mostUseful.err.(*packageNotInModuleError); !worsePath {
- mostUseful = r
- }
+ found = append(found, r.QueryResult)
case *NoMatchingVersionError:
- // A module with an appropriate prefix exists, but not at the requested
- // version.
- _, worseError := mostUseful.err.(*packageNotInModuleError)
- _, worsePath := mostUseful.err.(*NoMatchingVersionError)
- if !(worseError || worsePath) {
- mostUseful = r
+ if noVersion == nil {
+ noVersion = rErr
+ }
+ case *packageNotInModuleError:
+ if noPackage == nil {
+ noPackage = rErr
+ }
+ default:
+ if errors.Is(rErr, os.ErrNotExist) {
+ if notExistErr == nil {
+ notExistErr = rErr
+ }
+ } else {
+ err = r.err
}
}
}
- // TODO(#26232): If len(successes) == 0 and some of the errors are 4xx HTTP
+ // TODO(#26232): If len(found) == 0 and some of the errors are 4xx HTTP
// codes, have the auth package recheck the failed paths.
// If we obtain new credentials for any of them, re-run the above loop.
- if len(successes) == 0 {
- // All of the possible module paths either did not exist at the requested
- // version, or did not contain the requested package(s).
- return nil, mostUseful.err
+ if len(found) == 0 && err == nil {
+ switch {
+ case noPackage != nil:
+ err = noPackage
+ case noVersion != nil:
+ err = noVersion
+ case notExistErr != nil:
+ err = notExistErr
+ default:
+ panic("queryPrefixModules: no modules found, but no error detected")
+ }
}
- // At least one module at the requested version contained the requested
- // package(s). Any remaining errors only describe the non-existence of
- // alternatives, so ignore them.
- return successes, nil
+ return found, err
}
// A NoMatchingVersionError indicates that Query found a module at the requested
// path, but not at any versions satisfying the query string and allow-function.
+//
+// NOTE: NoMatchingVersionError MUST NOT implement Is(os.ErrNotExist).
+//
+// If the module came from a proxy, that proxy had to return a successful status
+// code for the versions it knows about, and thus did not have the opportunity
+// to return a non-400 status code to suppress fallback.
type NoMatchingVersionError struct {
- query string
+ query, current string
}
func (e *NoMatchingVersionError) Error() string {
- return fmt.Sprintf("no matching versions for query %q", e.query)
+ currentSuffix := ""
+ if (e.query == "latest" || e.query == "patch") && e.current != "" {
+ currentSuffix = fmt.Sprintf(" (current version is %s)", e.current)
+ }
+ return fmt.Sprintf("no matching versions for query %q", e.query) + currentSuffix
}
// A packageNotInModuleError indicates that QueryPattern found a candidate
// module at the requested version, but that module did not contain any packages
// matching the requested pattern.
+//
+// NOTE: packageNotInModuleError MUST NOT implement Is(os.ErrNotExist).
+//
+// If the module came from a proxy, that proxy had to return a successful status
+// code for the versions it knows about, and thus did not have the opportunity
+// to return a non-400 status code to suppress fallback.
type packageNotInModuleError struct {
mod module.Version
query string
diff --git a/src/cmd/go/internal/modload/query_test.go b/src/cmd/go/internal/modload/query_test.go
index d2b9baa4d5..19c45b02b3 100644
--- a/src/cmd/go/internal/modload/query_test.go
+++ b/src/cmd/go/internal/modload/query_test.go
@@ -25,7 +25,7 @@ func TestMain(m *testing.M) {
}
func testMain(m *testing.M) int {
- modfetch.SetProxy("direct")
+ cfg.GOPROXY = "direct"
dir, err := ioutil.TempDir("", "modload-test-")
if err != nil {
@@ -50,11 +50,12 @@ var (
)
var queryTests = []struct {
- path string
- query string
- allow string
- vers string
- err string
+ path string
+ query string
+ current string
+ allow string
+ vers string
+ err string
}{
/*
git init
@@ -108,7 +109,18 @@ var queryTests = []struct {
{path: queryRepo, query: "v1.9.10-pre2+wrongmetadata", err: `unknown revision v1.9.10-pre2+wrongmetadata`},
{path: queryRepo, query: "v1.9.10-pre2", err: `unknown revision v1.9.10-pre2`},
{path: queryRepo, query: "latest", vers: "v1.9.9"},
+ {path: queryRepo, query: "latest", current: "v1.9.10-pre1", vers: "v1.9.10-pre1"},
+ {path: queryRepo, query: "latest", current: "v1.9.10-pre2+metadata", vers: "v1.9.10-pre2.0.20190513201126-42abcb6df8ee"},
+ {path: queryRepo, query: "latest", current: "v0.0.0-20990101120000-5ba9a4ea6213", vers: "v0.0.0-20990101120000-5ba9a4ea6213"},
{path: queryRepo, query: "latest", allow: "NOMATCH", err: `no matching versions for query "latest"`},
+ {path: queryRepo, query: "latest", current: "v1.9.9", allow: "NOMATCH", err: `no matching versions for query "latest" (current version is v1.9.9)`},
+ {path: queryRepo, query: "latest", current: "v1.99.99", err: `unknown revision v1.99.99`},
+ {path: queryRepo, query: "patch", current: "", vers: "v1.9.9"},
+ {path: queryRepo, query: "patch", current: "v0.1.0", vers: "v0.1.2"},
+ {path: queryRepo, query: "patch", current: "v1.9.0", vers: "v1.9.9"},
+ {path: queryRepo, query: "patch", current: "v1.9.10-pre1", vers: "v1.9.10-pre1"},
+ {path: queryRepo, query: "patch", current: "v1.9.10-pre2+metadata", vers: "v1.9.10-pre2.0.20190513201126-42abcb6df8ee"},
+ {path: queryRepo, query: "patch", current: "v1.99.99", err: `no matching versions for query "patch" (current version is v1.99.99)`},
{path: queryRepo, query: ">v1.9.9", vers: "v1.9.10-pre1"},
{path: queryRepo, query: ">v1.10.0", err: `no matching versions for query ">v1.10.0"`},
{path: queryRepo, query: ">=v1.10.0", err: `no matching versions for query ">=v1.10.0"`},
@@ -136,6 +148,7 @@ var queryTests = []struct {
func TestQuery(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
for _, tt := range queryTests {
allow := tt.allow
@@ -146,8 +159,8 @@ func TestQuery(t *testing.T) {
ok, _ := path.Match(allow, m.Version)
return ok
}
- t.Run(strings.ReplaceAll(tt.path, "/", "_")+"/"+tt.query+"/"+allow, func(t *testing.T) {
- info, err := Query(tt.path, tt.query, allowed)
+ t.Run(strings.ReplaceAll(tt.path, "/", "_")+"/"+tt.query+"/"+tt.current+"/"+allow, func(t *testing.T) {
+ info, err := Query(tt.path, tt.query, tt.current, allowed)
if tt.err != "" {
if err != nil && err.Error() == tt.err {
return
diff --git a/src/cmd/go/internal/module/module.go b/src/cmd/go/internal/module/module.go
index 481a90b1c4..bc76b92b91 100644
--- a/src/cmd/go/internal/module/module.go
+++ b/src/cmd/go/internal/module/module.go
@@ -169,6 +169,9 @@ func checkPath(path string, fileName bool) error {
if path == "" {
return fmt.Errorf("empty string")
}
+ if path[0] == '-' {
+ return fmt.Errorf("leading dash")
+ }
if strings.Contains(path, "..") {
return fmt.Errorf("double dot")
}
diff --git a/src/cmd/go/internal/module/module_test.go b/src/cmd/go/internal/module/module_test.go
index b40bd03dfa..b9f07bf57d 100644
--- a/src/cmd/go/internal/module/module_test.go
+++ b/src/cmd/go/internal/module/module_test.go
@@ -79,7 +79,7 @@ var checkPathTests = []struct {
{"/x.y/z", false, false, false},
{"x./z", false, false, false},
{".x/z", false, false, true},
- {"-x/z", false, true, true},
+ {"-x/z", false, false, false},
{"x..y/z", false, false, false},
{"x.y/z/../../w", false, false, false},
{"x.y//z", false, false, false},
diff --git a/src/cmd/go/internal/mvs/mvs.go b/src/cmd/go/internal/mvs/mvs.go
index 04273e733c..dca909e858 100644
--- a/src/cmd/go/internal/mvs/mvs.go
+++ b/src/cmd/go/internal/mvs/mvs.go
@@ -35,7 +35,7 @@ type Reqs interface {
// Max returns the maximum of v1 and v2 (it returns either v1 or v2).
//
// For all versions v, Max(v, "none") must be v,
- // and for the tanget passed as the first argument to MVS functions,
+ // and for the target passed as the first argument to MVS functions,
// Max(target, v) must be target.
//
// Note that v1 < v2 can be written Max(v1, v2) != v1
diff --git a/src/cmd/go/internal/renameio/error_windows.go b/src/cmd/go/internal/renameio/error_windows.go
deleted file mode 100644
index 30d0879e7f..0000000000
--- a/src/cmd/go/internal/renameio/error_windows.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2019 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 renameio
-
-import (
- "os"
- "syscall"
-)
-
-// isAccessDeniedError returns true if err was caused by ERROR_ACCESS_DENIED.
-func isAccessDeniedError(err error) bool {
- linkerr, ok := err.(*os.LinkError)
- if !ok {
- return false
- }
- errno, ok := linkerr.Err.(syscall.Errno)
- if !ok {
- return false
- }
- return errno == syscall.ERROR_ACCESS_DENIED
-}
diff --git a/src/cmd/go/internal/renameio/renameio.go b/src/cmd/go/internal/renameio/renameio.go
index 5fe5bb7dd4..d573cc690d 100644
--- a/src/cmd/go/internal/renameio/renameio.go
+++ b/src/cmd/go/internal/renameio/renameio.go
@@ -12,7 +12,8 @@ import (
"os"
"path/filepath"
"strconv"
- "time"
+
+ "cmd/go/internal/robustio"
)
const patternSuffix = ".tmp"
@@ -62,23 +63,20 @@ func WriteToFile(filename string, data io.Reader, perm os.FileMode) (err error)
return err
}
- var start time.Time
- for {
- err := os.Rename(f.Name(), filename)
- if err == nil || !isAccessDeniedError(err) {
- return err
- }
+ return robustio.Rename(f.Name(), filename)
+}
- // Windows seems to occasionally trigger spurious "Access is denied" errors
- // here (see golang.org/issue/31247). We're not sure why. It's probably
- // worth a little extra latency to avoid propagating the spurious errors.
- if start.IsZero() {
- start = time.Now()
- } else if time.Since(start) >= 500*time.Millisecond {
- return err
- }
- time.Sleep(5 * time.Millisecond)
- }
+// ReadFile is like ioutil.ReadFile, but on Windows retries spurious errors that
+// may occur if the file is concurrently replaced.
+//
+// Errors are classified heuristically and retries are bounded, so even this
+// function may occasionally return a spurious error on Windows.
+// If so, the error will likely wrap one of:
+// - syscall.ERROR_ACCESS_DENIED
+// - syscall.ERROR_FILE_NOT_FOUND
+// - internal/syscall/windows.ERROR_SHARING_VIOLATION
+func ReadFile(filename string) ([]byte, error) {
+ return robustio.ReadFile(filename)
}
// tempFile creates a new temporary file with given permission bits.
diff --git a/src/cmd/go/internal/renameio/renameio_test.go b/src/cmd/go/internal/renameio/renameio_test.go
index 53f879803e..81dba6d545 100644
--- a/src/cmd/go/internal/renameio/renameio_test.go
+++ b/src/cmd/go/internal/renameio/renameio_test.go
@@ -2,43 +2,144 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// Package renameio writes files atomically by renaming temporary files.
-
-//+build !nacl,!plan9,!windows,!js
+//+build !plan9
package renameio
import (
+ "encoding/binary"
+ "errors"
"io/ioutil"
+ "math/rand"
"os"
"path/filepath"
+ "runtime"
+ "sync"
+ "sync/atomic"
"syscall"
"testing"
+ "time"
+
+ "cmd/go/internal/robustio"
)
-func TestWriteFileModeAppliesUmask(t *testing.T) {
+func TestConcurrentReadsAndWrites(t *testing.T) {
dir, err := ioutil.TempDir("", "renameio")
if err != nil {
- t.Fatalf("Failed to create temporary directory: %v", err)
- }
-
- const mode = 0644
- const umask = 0007
- defer syscall.Umask(syscall.Umask(umask))
-
- file := filepath.Join(dir, "testWrite")
- err = WriteFile(file, []byte("go-build"), mode)
- if err != nil {
- t.Fatalf("Failed to write file: %v", err)
+ t.Fatal(err)
}
defer os.RemoveAll(dir)
+ path := filepath.Join(dir, "blob.bin")
- fi, err := os.Stat(file)
- if err != nil {
- t.Fatalf("Stat %q (looking for mode %#o): %s", file, mode, err)
+ const chunkWords = 8 << 10
+ buf := make([]byte, 2*chunkWords*8)
+ for i := uint64(0); i < 2*chunkWords; i++ {
+ binary.LittleEndian.PutUint64(buf[i*8:], i)
}
- if fi.Mode()&os.ModePerm != 0640 {
- t.Errorf("Stat %q: mode %#o want %#o", file, fi.Mode()&os.ModePerm, 0640)
+ var attempts int64 = 128
+ if !testing.Short() {
+ attempts *= 16
+ }
+ const parallel = 32
+
+ var sem = make(chan bool, parallel)
+
+ var (
+ writeSuccesses, readSuccesses int64 // atomic
+ writeErrnoSeen, readErrnoSeen sync.Map
+ )
+
+ for n := attempts; n > 0; n-- {
+ sem <- true
+ go func() {
+ defer func() { <-sem }()
+
+ time.Sleep(time.Duration(rand.Intn(100)) * time.Microsecond)
+ offset := rand.Intn(chunkWords)
+ chunk := buf[offset*8 : (offset+chunkWords)*8]
+ if err := WriteFile(path, chunk, 0666); err == nil {
+ atomic.AddInt64(&writeSuccesses, 1)
+ } else if robustio.IsEphemeralError(err) {
+ var (
+ errno syscall.Errno
+ dup bool
+ )
+ if errors.As(err, &errno) {
+ _, dup = writeErrnoSeen.LoadOrStore(errno, true)
+ }
+ if !dup {
+ t.Logf("ephemeral error: %v", err)
+ }
+ } else {
+ t.Errorf("unexpected error: %v", err)
+ }
+
+ time.Sleep(time.Duration(rand.Intn(100)) * time.Microsecond)
+ data, err := ReadFile(path)
+ if err == nil {
+ atomic.AddInt64(&readSuccesses, 1)
+ } else if robustio.IsEphemeralError(err) {
+ var (
+ errno syscall.Errno
+ dup bool
+ )
+ if errors.As(err, &errno) {
+ _, dup = readErrnoSeen.LoadOrStore(errno, true)
+ }
+ if !dup {
+ t.Logf("ephemeral error: %v", err)
+ }
+ return
+ } else {
+ t.Errorf("unexpected error: %v", err)
+ return
+ }
+
+ if len(data) != 8*chunkWords {
+ t.Errorf("read %d bytes, but each write is a %d-byte file", len(data), 8*chunkWords)
+ return
+ }
+
+ u := binary.LittleEndian.Uint64(data)
+ for i := 1; i < chunkWords; i++ {
+ next := binary.LittleEndian.Uint64(data[i*8:])
+ if next != u+1 {
+ t.Errorf("wrote sequential integers, but read integer out of sequence at offset %d", i)
+ return
+ }
+ u = next
+ }
+ }()
+ }
+
+ for n := parallel; n > 0; n-- {
+ sem <- true
+ }
+
+ var minWriteSuccesses int64 = attempts
+ if runtime.GOOS == "windows" {
+ // Windows produces frequent "Access is denied" errors under heavy rename load.
+ // As long as those are the only errors and *some* of the writes succeed, we're happy.
+ minWriteSuccesses = attempts / 4
+ }
+
+ if writeSuccesses < minWriteSuccesses {
+ t.Errorf("%d (of %d) writes succeeded; want ≥ %d", writeSuccesses, attempts, minWriteSuccesses)
+ } else {
+ t.Logf("%d (of %d) writes succeeded (ok: ≥ %d)", writeSuccesses, attempts, minWriteSuccesses)
+ }
+
+ var minReadSuccesses int64 = attempts
+ if runtime.GOOS == "windows" {
+ // Windows produces frequent "Access is denied" errors under heavy rename load.
+ // As long as those are the only errors and *some* of the writes succeed, we're happy.
+ minReadSuccesses = attempts / 4
+ }
+
+ if readSuccesses < minReadSuccesses {
+ t.Errorf("%d (of %d) reads succeeded; want ≥ %d", readSuccesses, attempts, minReadSuccesses)
+ } else {
+ t.Logf("%d (of %d) reads succeeded (ok: ≥ %d)", readSuccesses, attempts, minReadSuccesses)
}
}
diff --git a/src/cmd/go/internal/renameio/umask_test.go b/src/cmd/go/internal/renameio/umask_test.go
new file mode 100644
index 0000000000..1a471c9e4e
--- /dev/null
+++ b/src/cmd/go/internal/renameio/umask_test.go
@@ -0,0 +1,42 @@
+// Copyright 2019 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.
+
+//+build !nacl,!plan9,!windows,!js
+
+package renameio
+
+import (
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "syscall"
+ "testing"
+)
+
+func TestWriteFileModeAppliesUmask(t *testing.T) {
+ dir, err := ioutil.TempDir("", "renameio")
+ if err != nil {
+ t.Fatalf("Failed to create temporary directory: %v", err)
+ }
+
+ const mode = 0644
+ const umask = 0007
+ defer syscall.Umask(syscall.Umask(umask))
+
+ file := filepath.Join(dir, "testWrite")
+ err = WriteFile(file, []byte("go-build"), mode)
+ if err != nil {
+ t.Fatalf("Failed to write file: %v", err)
+ }
+ defer os.RemoveAll(dir)
+
+ fi, err := os.Stat(file)
+ if err != nil {
+ t.Fatalf("Stat %q (looking for mode %#o): %s", file, mode, err)
+ }
+
+ if fi.Mode()&os.ModePerm != 0640 {
+ t.Errorf("Stat %q: mode %#o want %#o", file, fi.Mode()&os.ModePerm, 0640)
+ }
+}
diff --git a/src/cmd/go/internal/robustio/robustio.go b/src/cmd/go/internal/robustio/robustio.go
new file mode 100644
index 0000000000..76e47ad1ff
--- /dev/null
+++ b/src/cmd/go/internal/robustio/robustio.go
@@ -0,0 +1,53 @@
+// Copyright 2019 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 robustio wraps I/O functions that are prone to failure on Windows,
+// transparently retrying errors up to an arbitrary timeout.
+//
+// Errors are classified heuristically and retries are bounded, so the functions
+// in this package do not completely eliminate spurious errors. However, they do
+// significantly reduce the rate of failure in practice.
+//
+// If so, the error will likely wrap one of:
+// The functions in this package do not completely eliminate spurious errors,
+// but substantially reduce their rate of occurrence in practice.
+package robustio
+
+// Rename is like os.Rename, but on Windows retries errors that may occur if the
+// file is concurrently read or overwritten.
+//
+// (See golang.org/issue/31247 and golang.org/issue/32188.)
+func Rename(oldpath, newpath string) error {
+ return rename(oldpath, newpath)
+}
+
+// ReadFile is like ioutil.ReadFile, but on Windows retries errors that may
+// occur if the file is concurrently replaced.
+//
+// (See golang.org/issue/31247 and golang.org/issue/32188.)
+func ReadFile(filename string) ([]byte, error) {
+ return readFile(filename)
+}
+
+// RemoveAll is like os.RemoveAll, but on Windows retries errors that may occur
+// if an executable file in the directory has recently been executed.
+//
+// (See golang.org/issue/19491.)
+func RemoveAll(path string) error {
+ return removeAll(path)
+}
+
+// IsEphemeralError reports whether err is one of the errors that the functions
+// in this package attempt to mitigate.
+//
+// Errors considered ephemeral include:
+// - syscall.ERROR_ACCESS_DENIED
+// - syscall.ERROR_FILE_NOT_FOUND
+// - internal/syscall/windows.ERROR_SHARING_VIOLATION
+//
+// This set may be expanded in the future; programs must not rely on the
+// non-ephemerality of any given error.
+func IsEphemeralError(err error) bool {
+ return isEphemeralError(err)
+}
diff --git a/src/cmd/go/internal/robustio/robustio_other.go b/src/cmd/go/internal/robustio/robustio_other.go
new file mode 100644
index 0000000000..91ca56cb82
--- /dev/null
+++ b/src/cmd/go/internal/robustio/robustio_other.go
@@ -0,0 +1,28 @@
+// Copyright 2019 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.
+
+//+build !windows
+
+package robustio
+
+import (
+ "io/ioutil"
+ "os"
+)
+
+func rename(oldpath, newpath string) error {
+ return os.Rename(oldpath, newpath)
+}
+
+func readFile(filename string) ([]byte, error) {
+ return ioutil.ReadFile(filename)
+}
+
+func removeAll(path string) error {
+ return os.RemoveAll(path)
+}
+
+func isEphemeralError(err error) bool {
+ return false
+}
diff --git a/src/cmd/go/internal/robustio/robustio_windows.go b/src/cmd/go/internal/robustio/robustio_windows.go
new file mode 100644
index 0000000000..a3d94e566f
--- /dev/null
+++ b/src/cmd/go/internal/robustio/robustio_windows.go
@@ -0,0 +1,105 @@
+// Copyright 2019 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 robustio
+
+import (
+ "errors"
+ "internal/syscall/windows"
+ "io/ioutil"
+ "math/rand"
+ "os"
+ "syscall"
+ "time"
+)
+
+const arbitraryTimeout = 500 * time.Millisecond
+
+// retry retries ephemeral errors from f up to an arbitrary timeout
+// to work around spurious filesystem errors on Windows
+func retry(f func() (err error, mayRetry bool)) error {
+ var (
+ bestErr error
+ lowestErrno syscall.Errno
+ start time.Time
+ nextSleep time.Duration = 1 * time.Millisecond
+ )
+ for {
+ err, mayRetry := f()
+ if err == nil || !mayRetry {
+ return err
+ }
+
+ var errno syscall.Errno
+ if errors.As(err, &errno) && (lowestErrno == 0 || errno < lowestErrno) {
+ bestErr = err
+ lowestErrno = errno
+ } else if bestErr == nil {
+ bestErr = err
+ }
+
+ if start.IsZero() {
+ start = time.Now()
+ } else if d := time.Since(start) + nextSleep; d >= arbitraryTimeout {
+ break
+ }
+ time.Sleep(nextSleep)
+ nextSleep += time.Duration(rand.Int63n(int64(nextSleep)))
+ }
+
+ return bestErr
+}
+
+// rename is like os.Rename, but retries ephemeral errors.
+//
+// It wraps os.Rename, which (as of 2019-06-04) uses MoveFileEx with
+// MOVEFILE_REPLACE_EXISTING.
+//
+// Windows also provides a different system call, ReplaceFile,
+// that provides similar semantics, but perhaps preserves more metadata. (The
+// documentation on the differences between the two is very sparse.)
+//
+// Empirical error rates with MoveFileEx are lower under modest concurrency, so
+// for now we're sticking with what the os package already provides.
+func rename(oldpath, newpath string) (err error) {
+ return retry(func() (err error, mayRetry bool) {
+ err = os.Rename(oldpath, newpath)
+ return err, isEphemeralError(err)
+ })
+}
+
+// readFile is like ioutil.ReadFile, but retries ephemeral errors.
+func readFile(filename string) ([]byte, error) {
+ var b []byte
+ err := retry(func() (err error, mayRetry bool) {
+ b, err = ioutil.ReadFile(filename)
+
+ // Unlike in rename, we do not retry ERROR_FILE_NOT_FOUND here: it can occur
+ // as a spurious error, but the file may also genuinely not exist, so the
+ // increase in robustness is probably not worth the extra latency.
+ return err, isEphemeralError(err) && !errors.Is(err, syscall.ERROR_FILE_NOT_FOUND)
+ })
+ return b, err
+}
+
+func removeAll(path string) error {
+ return retry(func() (err error, mayRetry bool) {
+ err = os.RemoveAll(path)
+ return err, isEphemeralError(err)
+ })
+}
+
+// isEphemeralError returns true if err may be resolved by waiting.
+func isEphemeralError(err error) bool {
+ var errno syscall.Errno
+ if errors.As(err, &errno) {
+ switch errno {
+ case syscall.ERROR_ACCESS_DENIED,
+ syscall.ERROR_FILE_NOT_FOUND,
+ windows.ERROR_SHARING_VIOLATION:
+ return true
+ }
+ }
+ return false
+}
diff --git a/src/cmd/go/internal/sumweb/server.go b/src/cmd/go/internal/sumweb/server.go
index 4619e9719b..5050805f87 100644
--- a/src/cmd/go/internal/sumweb/server.go
+++ b/src/cmd/go/internal/sumweb/server.go
@@ -7,9 +7,9 @@ package sumweb
import (
"context"
+ "internal/lazyregexp"
"net/http"
"os"
- "regexp"
"strings"
"cmd/go/internal/tlog"
@@ -59,7 +59,7 @@ var Paths = []string{
"/tile/",
}
-var modVerRE = regexp.MustCompile(`^[^@]+@v[0-9]+\.[0-9]+\.[0-9]+(-[^@]*)?(\+incompatible)?$`)
+var modVerRE = lazyregexp.New(`^[^@]+@v[0-9]+\.[0-9]+\.[0-9]+(-[^@]*)?(\+incompatible)?$`)
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
ctx, err := h.Server.NewContext(r)
diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go
index 8440a83951..eed2d437c9 100644
--- a/src/cmd/go/internal/test/test.go
+++ b/src/cmd/go/internal/test/test.go
@@ -507,6 +507,7 @@ var testVetFlags = []string{
// "-cgocall",
// "-composites",
// "-copylocks",
+ "-errorsas",
// "-httpresponse",
// "-lostcancel",
// "-methods",
diff --git a/src/cmd/go/internal/web/file_test.go b/src/cmd/go/internal/web/file_test.go
new file mode 100644
index 0000000000..e31ad71d4d
--- /dev/null
+++ b/src/cmd/go/internal/web/file_test.go
@@ -0,0 +1,58 @@
+// Copyright 2019 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 web
+
+import (
+ "errors"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "testing"
+)
+
+func TestGetFileURL(t *testing.T) {
+ const content = "Hello, file!\n"
+
+ f, err := ioutil.TempFile("", "web-TestGetFileURL")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, err := f.WriteString(content); err != nil {
+ t.Error(err)
+ }
+ if err := f.Close(); err != nil {
+ t.Fatal(err)
+ }
+
+ u, err := urlFromFilePath(f.Name())
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ b, err := GetBytes(u)
+ if err != nil {
+ t.Fatalf("GetBytes(%v) = _, %v", u, err)
+ }
+ if string(b) != content {
+ t.Fatalf("after writing %q to %s, GetBytes(%v) read %q", content, f.Name(), u, b)
+ }
+}
+
+func TestGetNonexistentFile(t *testing.T) {
+ path, err := filepath.Abs("nonexistent")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ u, err := urlFromFilePath(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ b, err := GetBytes(u)
+ if !errors.Is(err, os.ErrNotExist) {
+ t.Fatalf("GetBytes(%v) = %q, %v; want _, os.ErrNotExist", u, b, err)
+ }
+}
diff --git a/src/cmd/go/internal/web/http.go b/src/cmd/go/internal/web/http.go
index 51a5dfc54d..b790fe9916 100644
--- a/src/cmd/go/internal/web/http.go
+++ b/src/cmd/go/internal/web/http.go
@@ -14,9 +14,11 @@ package web
import (
"crypto/tls"
"fmt"
- "log"
+ "io/ioutil"
"net/http"
urlpkg "net/url"
+ "os"
+ "strings"
"time"
"cmd/go/internal/auth"
@@ -50,9 +52,33 @@ var securityPreservingHTTPClient = &http.Client{
}
func get(security SecurityMode, url *urlpkg.URL) (*Response, error) {
+ start := time.Now()
+
+ if url.Scheme == "file" {
+ return getFile(url)
+ }
+
+ if os.Getenv("TESTGOPROXY404") == "1" && url.Host == "proxy.golang.org" {
+ res := &Response{
+ URL: Redacted(url),
+ Status: "404 testing",
+ StatusCode: 404,
+ Header: make(map[string][]string),
+ Body: ioutil.NopCloser(strings.NewReader("")),
+ }
+ if cfg.BuildX {
+ fmt.Fprintf(os.Stderr, "# get %s: %v (%.3fs)\n", Redacted(url), res.Status, time.Since(start).Seconds())
+ }
+ return res, nil
+ }
+
fetch := func(url *urlpkg.URL) (*urlpkg.URL, *http.Response, error) {
- if cfg.BuildV {
- log.Printf("Fetching %s", url)
+ // Note: The -v build flag does not mean "print logging information",
+ // despite its historical misuse for this in GOPATH-based go get.
+ // We print extra logging in -x mode instead, which traces what
+ // commands are executed.
+ if cfg.BuildX {
+ fmt.Fprintf(os.Stderr, "# get %s\n", Redacted(url))
}
req, err := http.NewRequest("GET", url.String(), nil)
@@ -84,8 +110,8 @@ func get(security SecurityMode, url *urlpkg.URL) (*Response, error) {
fetched, res, err = fetch(secure)
if err != nil {
- if cfg.BuildV {
- log.Printf("https fetch failed: %v", err)
+ if cfg.BuildX {
+ fmt.Fprintf(os.Stderr, "# get %s: %v\n", Redacted(url), err)
}
if security != Insecure || url.Scheme == "https" {
// HTTPS failed, and we can't fall back to plain HTTP.
@@ -99,6 +125,9 @@ func get(security SecurityMode, url *urlpkg.URL) (*Response, error) {
switch url.Scheme {
case "http":
if security == SecureOnly {
+ if cfg.BuildX {
+ fmt.Fprintf(os.Stderr, "# get %s: insecure\n", Redacted(url))
+ }
return nil, fmt.Errorf("insecure URL: %s", Redacted(url))
}
case "":
@@ -106,6 +135,9 @@ func get(security SecurityMode, url *urlpkg.URL) (*Response, error) {
panic("should have returned after HTTPS failure")
}
default:
+ if cfg.BuildX {
+ fmt.Fprintf(os.Stderr, "# get %s: unsupported\n", Redacted(url))
+ }
return nil, fmt.Errorf("unsupported scheme: %s", Redacted(url))
}
@@ -113,11 +145,17 @@ func get(security SecurityMode, url *urlpkg.URL) (*Response, error) {
*insecure = *url
insecure.Scheme = "http"
if insecure.User != nil && security != Insecure {
+ if cfg.BuildX {
+ fmt.Fprintf(os.Stderr, "# get %s: insecure credentials\n", Redacted(url))
+ }
return nil, fmt.Errorf("refusing to pass credentials to insecure URL: %s", Redacted(insecure))
}
fetched, res, err = fetch(insecure)
if err != nil {
+ if cfg.BuildX {
+ fmt.Fprintf(os.Stderr, "# get %s: %v\n", Redacted(url), err)
+ }
// HTTP failed, and we already tried HTTPS if applicable.
// Report the error from the HTTP attempt.
return nil, err
@@ -126,8 +164,8 @@ func get(security SecurityMode, url *urlpkg.URL) (*Response, error) {
// Note: accepting a non-200 OK here, so people can serve a
// meta import in their http 404 page.
- if cfg.BuildV {
- log.Printf("reading from %s: status code %d", Redacted(fetched), res.StatusCode)
+ if cfg.BuildX {
+ fmt.Fprintf(os.Stderr, "# get %s: %v (%.3fs)\n", Redacted(url), res.Status, time.Since(start).Seconds())
}
r := &Response{
URL: Redacted(fetched),
@@ -139,4 +177,41 @@ func get(security SecurityMode, url *urlpkg.URL) (*Response, error) {
return r, nil
}
+func getFile(u *urlpkg.URL) (*Response, error) {
+ path, err := urlToFilePath(u)
+ if err != nil {
+ return nil, err
+ }
+ f, err := os.Open(path)
+
+ if os.IsNotExist(err) {
+ return &Response{
+ URL: Redacted(u),
+ Status: http.StatusText(http.StatusNotFound),
+ StatusCode: http.StatusNotFound,
+ Body: http.NoBody,
+ }, nil
+ }
+
+ if os.IsPermission(err) {
+ return &Response{
+ URL: Redacted(u),
+ Status: http.StatusText(http.StatusForbidden),
+ StatusCode: http.StatusForbidden,
+ Body: http.NoBody,
+ }, nil
+ }
+
+ if err != nil {
+ return nil, err
+ }
+
+ return &Response{
+ URL: Redacted(u),
+ Status: http.StatusText(http.StatusOK),
+ StatusCode: http.StatusOK,
+ Body: f,
+ }, nil
+}
+
func openBrowser(url string) bool { return browser.Open(url) }
diff --git a/src/cmd/go/internal/web/url.go b/src/cmd/go/internal/web/url.go
new file mode 100644
index 0000000000..146c51f0ae
--- /dev/null
+++ b/src/cmd/go/internal/web/url.go
@@ -0,0 +1,95 @@
+// Copyright 2019 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 web
+
+import (
+ "errors"
+ "net/url"
+ "path/filepath"
+ "strings"
+)
+
+// TODO(golang.org/issue/32456): If accepted, move these functions into the
+// net/url package.
+
+var errNotAbsolute = errors.New("path is not absolute")
+
+func urlToFilePath(u *url.URL) (string, error) {
+ if u.Scheme != "file" {
+ return "", errors.New("non-file URL")
+ }
+
+ checkAbs := func(path string) (string, error) {
+ if !filepath.IsAbs(path) {
+ return "", errNotAbsolute
+ }
+ return path, nil
+ }
+
+ if u.Path == "" {
+ if u.Host != "" || u.Opaque == "" {
+ return "", errors.New("file URL missing path")
+ }
+ return checkAbs(filepath.FromSlash(u.Opaque))
+ }
+
+ path, err := convertFileURLPath(u.Host, u.Path)
+ if err != nil {
+ return path, err
+ }
+ return checkAbs(path)
+}
+
+func urlFromFilePath(path string) (*url.URL, error) {
+ if !filepath.IsAbs(path) {
+ return nil, errNotAbsolute
+ }
+
+ // If path has a Windows volume name, convert the volume to a host and prefix
+ // per https://blogs.msdn.microsoft.com/ie/2006/12/06/file-uris-in-windows/.
+ if vol := filepath.VolumeName(path); vol != "" {
+ if strings.HasPrefix(vol, `\\`) {
+ path = filepath.ToSlash(path[2:])
+ i := strings.IndexByte(path, '/')
+
+ if i < 0 {
+ // A degenerate case.
+ // \\host.example.com (without a share name)
+ // becomes
+ // file://host.example.com/
+ return &url.URL{
+ Scheme: "file",
+ Host: path,
+ Path: "/",
+ }, nil
+ }
+
+ // \\host.example.com\Share\path\to\file
+ // becomes
+ // file://host.example.com/Share/path/to/file
+ return &url.URL{
+ Scheme: "file",
+ Host: path[:i],
+ Path: filepath.ToSlash(path[i:]),
+ }, nil
+ }
+
+ // C:\path\to\file
+ // becomes
+ // file:///C:/path/to/file
+ return &url.URL{
+ Scheme: "file",
+ Path: "/" + filepath.ToSlash(path),
+ }, nil
+ }
+
+ // /path/to/file
+ // becomes
+ // file:///path/to/file
+ return &url.URL{
+ Scheme: "file",
+ Path: filepath.ToSlash(path),
+ }, nil
+}
diff --git a/src/cmd/go/internal/web/url_other.go b/src/cmd/go/internal/web/url_other.go
new file mode 100644
index 0000000000..bd243e591a
--- /dev/null
+++ b/src/cmd/go/internal/web/url_other.go
@@ -0,0 +1,21 @@
+// Copyright 2019 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.
+
+//+build !windows
+
+package web
+
+import (
+ "errors"
+ "path/filepath"
+)
+
+func convertFileURLPath(host, path string) (string, error) {
+ switch host {
+ case "", "localhost":
+ default:
+ return "", errors.New("file URL specifies non-local host")
+ }
+ return filepath.FromSlash(path), nil
+}
diff --git a/src/cmd/go/internal/web/url_other_test.go b/src/cmd/go/internal/web/url_other_test.go
new file mode 100644
index 0000000000..b4a74d94b9
--- /dev/null
+++ b/src/cmd/go/internal/web/url_other_test.go
@@ -0,0 +1,36 @@
+// Copyright 2019 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.
+
+//+build !windows
+
+package web
+
+var urlTests = []struct {
+ url string
+ filePath string
+ canonicalURL string // If empty, assume equal to url.
+ wantErr string
+}{
+ // Examples from RFC 8089:
+ {
+ url: `file:///path/to/file`,
+ filePath: `/path/to/file`,
+ },
+ {
+ url: `file:/path/to/file`,
+ filePath: `/path/to/file`,
+ canonicalURL: `file:///path/to/file`,
+ },
+ {
+ url: `file://localhost/path/to/file`,
+ filePath: `/path/to/file`,
+ canonicalURL: `file:///path/to/file`,
+ },
+
+ // We reject non-local files.
+ {
+ url: `file://host.example.com/path/to/file`,
+ wantErr: "file URL specifies non-local host",
+ },
+}
diff --git a/src/cmd/go/internal/web/url_test.go b/src/cmd/go/internal/web/url_test.go
new file mode 100644
index 0000000000..8f462f5325
--- /dev/null
+++ b/src/cmd/go/internal/web/url_test.go
@@ -0,0 +1,77 @@
+// Copyright 2019 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 web
+
+import (
+ "net/url"
+ "testing"
+)
+
+func TestURLToFilePath(t *testing.T) {
+ for _, tc := range urlTests {
+ if tc.url == "" {
+ continue
+ }
+ tc := tc
+
+ t.Run(tc.url, func(t *testing.T) {
+ u, err := url.Parse(tc.url)
+ if err != nil {
+ t.Fatalf("url.Parse(%q): %v", tc.url, err)
+ }
+
+ path, err := urlToFilePath(u)
+ if err != nil {
+ if err.Error() == tc.wantErr {
+ return
+ }
+ if tc.wantErr == "" {
+ t.Fatalf("urlToFilePath(%v): %v; want ", u, err)
+ } else {
+ t.Fatalf("urlToFilePath(%v): %v; want %s", u, err, tc.wantErr)
+ }
+ }
+
+ if path != tc.filePath || tc.wantErr != "" {
+ t.Fatalf("urlToFilePath(%v) = %q, ; want %q, %s", u, path, tc.filePath, tc.wantErr)
+ }
+ })
+ }
+}
+
+func TestURLFromFilePath(t *testing.T) {
+ for _, tc := range urlTests {
+ if tc.filePath == "" {
+ continue
+ }
+ tc := tc
+
+ t.Run(tc.filePath, func(t *testing.T) {
+ u, err := urlFromFilePath(tc.filePath)
+ if err != nil {
+ if err.Error() == tc.wantErr {
+ return
+ }
+ if tc.wantErr == "" {
+ t.Fatalf("urlFromFilePath(%v): %v; want ", tc.filePath, err)
+ } else {
+ t.Fatalf("urlFromFilePath(%v): %v; want %s", tc.filePath, err, tc.wantErr)
+ }
+ }
+
+ if tc.wantErr != "" {
+ t.Fatalf("urlFromFilePath(%v) = ; want error: %s", tc.filePath, tc.wantErr)
+ }
+
+ wantURL := tc.url
+ if tc.canonicalURL != "" {
+ wantURL = tc.canonicalURL
+ }
+ if u.String() != wantURL {
+ t.Errorf("urlFromFilePath(%v) = %v; want %s", tc.filePath, u, wantURL)
+ }
+ })
+ }
+}
diff --git a/src/cmd/go/internal/web/url_windows.go b/src/cmd/go/internal/web/url_windows.go
new file mode 100644
index 0000000000..2a65ec83f6
--- /dev/null
+++ b/src/cmd/go/internal/web/url_windows.go
@@ -0,0 +1,43 @@
+// Copyright 2019 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 web
+
+import (
+ "errors"
+ "path/filepath"
+ "strings"
+)
+
+func convertFileURLPath(host, path string) (string, error) {
+ if len(path) == 0 || path[0] != '/' {
+ return "", errNotAbsolute
+ }
+
+ path = filepath.FromSlash(path)
+
+ // We interpret Windows file URLs per the description in
+ // https://blogs.msdn.microsoft.com/ie/2006/12/06/file-uris-in-windows/.
+
+ // The host part of a file URL (if any) is the UNC volume name,
+ // but RFC 8089 reserves the authority "localhost" for the local machine.
+ if host != "" && host != "localhost" {
+ // A common "legacy" format omits the leading slash before a drive letter,
+ // encoding the drive letter as the host instead of part of the path.
+ // (See https://blogs.msdn.microsoft.com/freeassociations/2005/05/19/the-bizarre-and-unhappy-story-of-file-urls/.)
+ // We do not support that format, but we should at least emit a more
+ // helpful error message for it.
+ if filepath.VolumeName(host) != "" {
+ return "", errors.New("file URL encodes volume in host field: too few slashes?")
+ }
+ return `\\` + host + path, nil
+ }
+
+ // If host is empty, path must contain an initial slash followed by a
+ // drive letter and path. Remove the slash and verify that the path is valid.
+ if vol := filepath.VolumeName(path[1:]); vol == "" || strings.HasPrefix(vol, `\\`) {
+ return "", errors.New("file URL missing drive letter")
+ }
+ return path[1:], nil
+}
diff --git a/src/cmd/go/internal/web/url_windows_test.go b/src/cmd/go/internal/web/url_windows_test.go
new file mode 100644
index 0000000000..06386a0389
--- /dev/null
+++ b/src/cmd/go/internal/web/url_windows_test.go
@@ -0,0 +1,94 @@
+// Copyright 2019 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 web
+
+var urlTests = []struct {
+ url string
+ filePath string
+ canonicalURL string // If empty, assume equal to url.
+ wantErr string
+}{
+ // Examples from https://blogs.msdn.microsoft.com/ie/2006/12/06/file-uris-in-windows/:
+
+ {
+ url: `file://laptop/My%20Documents/FileSchemeURIs.doc`,
+ filePath: `\\laptop\My Documents\FileSchemeURIs.doc`,
+ },
+ {
+ url: `file:///C:/Documents%20and%20Settings/davris/FileSchemeURIs.doc`,
+ filePath: `C:\Documents and Settings\davris\FileSchemeURIs.doc`,
+ },
+ {
+ url: `file:///D:/Program%20Files/Viewer/startup.htm`,
+ filePath: `D:\Program Files\Viewer\startup.htm`,
+ },
+ {
+ url: `file:///C:/Program%20Files/Music/Web%20Sys/main.html?REQUEST=RADIO`,
+ filePath: `C:\Program Files\Music\Web Sys\main.html`,
+ canonicalURL: `file:///C:/Program%20Files/Music/Web%20Sys/main.html`,
+ },
+ {
+ url: `file://applib/products/a-b/abc_9/4148.920a/media/start.swf`,
+ filePath: `\\applib\products\a-b\abc_9\4148.920a\media\start.swf`,
+ },
+ {
+ url: `file:////applib/products/a%2Db/abc%5F9/4148.920a/media/start.swf`,
+ wantErr: "file URL missing drive letter",
+ },
+ {
+ url: `C:\Program Files\Music\Web Sys\main.html?REQUEST=RADIO`,
+ wantErr: "non-file URL",
+ },
+
+ // The example "file://D:\Program Files\Viewer\startup.htm" errors out in
+ // url.Parse, so we substitute a slash-based path for testing instead.
+ {
+ url: `file://D:/Program Files/Viewer/startup.htm`,
+ wantErr: "file URL encodes volume in host field: too few slashes?",
+ },
+
+ // The blog post discourages the use of non-ASCII characters because they
+ // depend on the user's current codepage. However, when we are working with Go
+ // strings we assume UTF-8 encoding, and our url package refuses to encode
+ // URLs to non-ASCII strings.
+ {
+ url: `file:///C:/exampleㄓ.txt`,
+ filePath: `C:\exampleㄓ.txt`,
+ canonicalURL: `file:///C:/example%E3%84%93.txt`,
+ },
+ {
+ url: `file:///C:/example%E3%84%93.txt`,
+ filePath: `C:\exampleㄓ.txt`,
+ },
+
+ // Examples from RFC 8089:
+
+ // We allow the drive-letter variation from section E.2, because it is
+ // simpler to support than not to. However, we do not generate the shorter
+ // form in the reverse direction.
+ {
+ url: `file:c:/path/to/file`,
+ filePath: `c:\path\to\file`,
+ canonicalURL: `file:///c:/path/to/file`,
+ },
+
+ // We encode the UNC share name as the authority following section E.3.1,
+ // because that is what the Microsoft blog post explicitly recommends.
+ {
+ url: `file://host.example.com/Share/path/to/file.txt`,
+ filePath: `\\host.example.com\Share\path\to\file.txt`,
+ },
+
+ // We decline the four- and five-slash variations from section E.3.2.
+ // The paths in these URLs would change meaning under path.Clean.
+ {
+ url: `file:////host.example.com/path/to/file`,
+ wantErr: "file URL missing drive letter",
+ },
+ {
+ url: `file://///host.example.com/path/to/file`,
+ wantErr: "file URL missing drive letter",
+ },
+}
diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
index 9c03f0818d..ed5a149da3 100644
--- a/src/cmd/go/internal/work/build.go
+++ b/src/cmd/go/internal/work/build.go
@@ -404,6 +404,15 @@ var CmdInstall = &base.Command{
Long: `
Install compiles and installs the packages named by the import paths.
+Executables are installed in the directory named by the GOBIN environment
+variable, which defaults to $GOPATH/bin or $HOME/go/bin if the GOPATH
+environment variable is not set. Executables in $GOROOT
+are installed in $GOROOT/bin or $GOTOOLDIR instead of $GOBIN.
+
+When module-aware mode is disabled, other packages are installed in the
+directory $GOPATH/pkg/$GOOS_$GOARCH. When module-aware mode is enabled,
+other packages are built and cached but not installed.
+
The -i flag installs the dependencies of the named packages as well.
For more about the build flags, see 'go help build'.
diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
index 6f2d319bc2..c1bb9416cb 100644
--- a/src/cmd/go/internal/work/exec.go
+++ b/src/cmd/go/internal/work/exec.go
@@ -1682,25 +1682,6 @@ func (b *Builder) writeFile(file string, text []byte) error {
return ioutil.WriteFile(file, text, 0666)
}
-// appendFile appends the text to file.
-func (b *Builder) appendFile(file string, text []byte) error {
- if cfg.BuildN || cfg.BuildX {
- b.Showcmd("", "cat >>%s << 'EOF' # internal\n%sEOF", file, text)
- }
- if cfg.BuildN {
- return nil
- }
- f, err := os.OpenFile(file, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666)
- if err != nil {
- return err
- }
- defer f.Close()
- if _, err = f.Write(text); err != nil {
- return err
- }
- return f.Close()
-}
-
// Install the cgo export header file, if there is one.
func (b *Builder) installHeader(a *Action) error {
src := a.Objdir + "_cgo_install.h"
diff --git a/src/cmd/go/internal/work/gc.go b/src/cmd/go/internal/work/gc.go
index 6ec24b2855..86322946a6 100644
--- a/src/cmd/go/internal/work/gc.go
+++ b/src/cmd/go/internal/work/gc.go
@@ -309,55 +309,6 @@ func (gcToolchain) symabis(b *Builder, a *Action, sfiles []string) (string, erro
}
}
- // Gather known cross-package references from assembly code.
- var otherPkgs []string
- if p.ImportPath == "runtime" {
- // Assembly in the following packages references
- // symbols in runtime.
- otherPkgs = []string{"syscall", "internal/syscall/unix", "runtime/cgo"}
- } else if p.ImportPath == "runtime/internal/atomic" {
- // sync/atomic is an assembly wrapper around
- // runtime/internal/atomic.
- otherPkgs = []string{"sync/atomic"}
- }
- for _, p2name := range otherPkgs {
- p2 := load.LoadImportWithFlags(p2name, p.Dir, p, &load.ImportStack{}, nil, 0)
- if len(p2.SFiles) == 0 {
- continue
- }
-
- symabis2 := a.Objdir + "symabis2"
- if err := mkSymabis(p2, p2.SFiles, symabis2); err != nil {
- return "", err
- }
-
- // Filter out just the symbol refs and append them to
- // the symabis file.
- if cfg.BuildN {
- // -x will print the lines from symabis2 that are actually appended
- // to symabis. With -n, we don't know what those lines will be.
- b.Showcmd("", `grep '^ref' <%s | grep -v '^ref\s*""\.' >>%s`, symabis2, a.Objdir+"symabis")
- continue
- }
- abis2, err := ioutil.ReadFile(symabis2)
- if err != nil {
- return "", err
- }
- var refs bytes.Buffer
- for _, line := range strings.Split(string(abis2), "\n") {
- fs := strings.Fields(line)
- if len(fs) >= 2 && fs[0] == "ref" && !strings.HasPrefix(fs[1], `"".`) {
- fmt.Fprintf(&refs, "%s\n", line)
- }
- }
- if refs.Len() != 0 {
- symabis = a.Objdir + "symabis"
- if err := b.appendFile(symabis, refs.Bytes()); err != nil {
- return "", err
- }
- }
- }
-
return symabis, nil
}
diff --git a/src/cmd/go/internal/work/security.go b/src/cmd/go/internal/work/security.go
index ecfb9df1b2..0d8da21ae3 100644
--- a/src/cmd/go/internal/work/security.go
+++ b/src/cmd/go/internal/work/security.go
@@ -184,6 +184,8 @@ var validLinkerFlags = []*lazyregexp.Regexp{
re(`-Wl,-framework,[^,@\-][^,]+`),
re(`-Wl,-headerpad_max_install_names`),
re(`-Wl,--no-undefined`),
+ re(`-Wl,-R([^@\-][^,@]*$)`),
+ re(`-Wl,--just-symbols[=,]([^,@\-][^,@]+)`),
re(`-Wl,-rpath(-link)?[=,]([^,@\-][^,]+)`),
re(`-Wl,-s`),
re(`-Wl,-search_paths_first`),
@@ -213,6 +215,8 @@ var validLinkerFlagsWithNextArg = []string{
"-target",
"-Wl,-framework",
"-Wl,-rpath",
+ "-Wl,-R",
+ "-Wl,--just-symbols",
"-Wl,-undefined",
}
diff --git a/src/cmd/go/internal/work/security_test.go b/src/cmd/go/internal/work/security_test.go
index d23b6eadff..fd8caeab4e 100644
--- a/src/cmd/go/internal/work/security_test.go
+++ b/src/cmd/go/internal/work/security_test.go
@@ -125,6 +125,11 @@ var goodLinkerFlags = [][]string{
{"-pthread"},
{"-Wl,-rpath,foo"},
{"-Wl,-rpath,$ORIGIN/foo"},
+ {"-Wl,-R", "/foo"},
+ {"-Wl,-R", "foo"},
+ {"-Wl,-R,foo"},
+ {"-Wl,--just-symbols=foo"},
+ {"-Wl,--just-symbols,foo"},
{"-Wl,--warn-error"},
{"-Wl,--no-warn-error"},
{"foo.so"},
@@ -197,6 +202,9 @@ var badLinkerFlags = [][]string{
{"-x", "--c"},
{"-x", "@obj"},
{"-Wl,-rpath,@foo"},
+ {"-Wl,-R,foo,bar"},
+ {"-Wl,-R,@foo"},
+ {"-Wl,--just-symbols,@foo"},
{"../x.o"},
}
diff --git a/src/cmd/go/main.go b/src/cmd/go/main.go
index 0207862d0b..73da736882 100644
--- a/src/cmd/go/main.go
+++ b/src/cmd/go/main.go
@@ -71,8 +71,9 @@ func init() {
help.HelpImportPath,
modload.HelpModules,
modget.HelpModuleGet,
+ modfetch.HelpModuleAuth,
+ modfetch.HelpModulePrivate,
help.HelpPackages,
- modfetch.HelpSum,
test.HelpTestflag,
test.HelpTestfunc,
}
diff --git a/src/cmd/go/proxy_test.go b/src/cmd/go/proxy_test.go
index 71f709cb95..6919d32184 100644
--- a/src/cmd/go/proxy_test.go
+++ b/src/cmd/go/proxy_test.go
@@ -8,6 +8,7 @@ import (
"archive/zip"
"bytes"
"encoding/json"
+ "errors"
"flag"
"fmt"
"io"
@@ -181,6 +182,57 @@ func proxyHandler(w http.ResponseWriter, r *http.Request) {
return
}
+ // Module proxy request: /mod/path/@latest
+ // Rewrite to /mod/path/@v/.info where is the semantically
+ // latest version, including pseudo-versions.
+ if i := strings.LastIndex(path, "/@latest"); i >= 0 {
+ enc := path[:i]
+ modPath, err := module.DecodePath(enc)
+ if err != nil {
+ if !quiet {
+ fmt.Fprintf(os.Stderr, "go proxy_test: %v\n", err)
+ }
+ http.NotFound(w, r)
+ return
+ }
+
+ // Imitate what "latest" does in direct mode and what proxy.golang.org does.
+ // Use the latest released version.
+ // If there is no released version, use the latest prereleased version.
+ // Otherwise, use the latest pseudoversion.
+ var latestRelease, latestPrerelease, latestPseudo string
+ for _, m := range modList {
+ if m.Path != modPath {
+ continue
+ }
+ if modfetch.IsPseudoVersion(m.Version) && (latestPseudo == "" || semver.Compare(latestPseudo, m.Version) > 0) {
+ latestPseudo = m.Version
+ } else if semver.Prerelease(m.Version) != "" && (latestPrerelease == "" || semver.Compare(latestPrerelease, m.Version) > 0) {
+ latestPrerelease = m.Version
+ } else if latestRelease == "" || semver.Compare(latestRelease, m.Version) > 0 {
+ latestRelease = m.Version
+ }
+ }
+ var latest string
+ if latestRelease != "" {
+ latest = latestRelease
+ } else if latestPrerelease != "" {
+ latest = latestPrerelease
+ } else if latestPseudo != "" {
+ latest = latestPseudo
+ } else {
+ http.NotFound(w, r)
+ return
+ }
+
+ encVers, err := module.EncodeVersion(latest)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+ path = fmt.Sprintf("%s/@v/%s.info", enc, encVers)
+ }
+
// Module proxy request: /mod/path/@v/version[.suffix]
i := strings.Index(path, "/@v/")
if i < 0 {
@@ -197,16 +249,22 @@ func proxyHandler(w http.ResponseWriter, r *http.Request) {
return
}
if file == "list" {
- n := 0
+ // list returns a list of versions, not including pseudo-versions.
+ // If the module has no tagged versions, we should serve an empty 200.
+ // If the module doesn't exist, we should serve 404 or 410.
+ found := false
for _, m := range modList {
- if m.Path == path && !modfetch.IsPseudoVersion(m.Version) {
+ if m.Path != path {
+ continue
+ }
+ found = true
+ if !modfetch.IsPseudoVersion(m.Version) {
if err := module.Check(m.Path, m.Version); err == nil {
fmt.Fprintf(w, "%s\n", m.Version)
- n++
}
}
}
- if n == 0 {
+ if !found {
http.NotFound(w, r)
}
return
@@ -253,7 +311,11 @@ func proxyHandler(w http.ResponseWriter, r *http.Request) {
if !quiet {
fmt.Fprintf(os.Stderr, "go proxy: no archive %s %s: %v\n", path, vers, err)
}
- http.Error(w, "cannot load archive", 500)
+ if errors.Is(err, os.ErrNotExist) {
+ http.NotFound(w, r)
+ } else {
+ http.Error(w, "cannot load archive", 500)
+ }
return
}
diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go
index 499a1ccd3f..4dcb4b4e0d 100644
--- a/src/cmd/go/script_test.go
+++ b/src/cmd/go/script_test.go
@@ -24,8 +24,10 @@ import (
"testing"
"time"
+ "cmd/go/internal/cfg"
"cmd/go/internal/imports"
"cmd/go/internal/par"
+ "cmd/go/internal/robustio"
"cmd/go/internal/txtar"
"cmd/go/internal/work"
)
@@ -106,9 +108,11 @@ func (ts *testScript) setup() {
"CCACHE_DISABLE=1", // ccache breaks with non-existent HOME
"GOARCH=" + runtime.GOARCH,
"GOCACHE=" + testGOCACHE,
+ "GOEXE=" + cfg.ExeSuffix,
"GOOS=" + runtime.GOOS,
"GOPATH=" + filepath.Join(ts.workdir, "gopath"),
"GOPROXY=" + proxyURL,
+ "GOPRIVATE=",
"GOROOT=" + testGOROOT,
"GOSUMDB=" + testSumDBVerifierKey,
"GONOPROXY=",
@@ -123,11 +127,6 @@ func (ts *testScript) setup() {
ts.env = append(ts.env, "path="+testBin+string(filepath.ListSeparator)+os.Getenv("path"))
}
- if runtime.GOOS == "windows" {
- ts.env = append(ts.env, "exe=.exe")
- } else {
- ts.env = append(ts.env, "exe=")
- }
for _, key := range extraEnvKeys {
if val := os.Getenv(key); val != "" {
ts.env = append(ts.env, key+"="+val)
@@ -390,7 +389,7 @@ func (ts *testScript) cmdCc(neg bool, args []string) {
var b work.Builder
b.Init()
ts.cmdExec(neg, append(b.GccCmd(".", ""), args...))
- os.RemoveAll(b.WorkDir)
+ robustio.RemoveAll(b.WorkDir)
}
// cd changes to a different directory.
@@ -671,8 +670,8 @@ func (ts *testScript) cmdRm(neg bool, args []string) {
}
for _, arg := range args {
file := ts.mkabs(arg)
- removeAll(file) // does chmod and then attempts rm
- ts.check(os.RemoveAll(file)) // report error
+ removeAll(file) // does chmod and then attempts rm
+ ts.check(robustio.RemoveAll(file)) // report error
}
}
diff --git a/src/cmd/go/testdata/mod/example.com_noroot_v1.0.0.txt b/src/cmd/go/testdata/mod/example.com_noroot_v1.0.0.txt
new file mode 100644
index 0000000000..aa5febf710
--- /dev/null
+++ b/src/cmd/go/testdata/mod/example.com_noroot_v1.0.0.txt
@@ -0,0 +1,8 @@
+A module which has no root package.
+
+-- .mod --
+module example.com/noroot
+-- .info --
+{"Version":"v1.0.0"}
+-- pkg/pkg.go --
+package pkg
diff --git a/src/cmd/go/testdata/mod/example.com_noroot_v1.0.1.txt b/src/cmd/go/testdata/mod/example.com_noroot_v1.0.1.txt
new file mode 100644
index 0000000000..9b93717c84
--- /dev/null
+++ b/src/cmd/go/testdata/mod/example.com_noroot_v1.0.1.txt
@@ -0,0 +1,8 @@
+A module which has no root package.
+
+-- .mod --
+module example.com/noroot
+-- .info --
+{"Version":"v1.0.1"}
+-- pkg/pkg.go --
+package pkg
diff --git a/src/cmd/go/testdata/mod/example.com_notags_v0.0.0-20190507143103-cc8cbe209b64.txt b/src/cmd/go/testdata/mod/example.com_notags_v0.0.0-20190507143103-cc8cbe209b64.txt
new file mode 100644
index 0000000000..259774d542
--- /dev/null
+++ b/src/cmd/go/testdata/mod/example.com_notags_v0.0.0-20190507143103-cc8cbe209b64.txt
@@ -0,0 +1,9 @@
+Written by hand.
+The "latest" version of a module without any tags.
+
+-- .mod --
+module example.com/notags
+-- .info --
+{"Version":"v0.0.0-20190507143103-cc8cbe209b64","Time":"2019-05-07T07:31:03-07:00"}
+-- notags.go --
+package notags
diff --git a/src/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.0.0-20190429073000-30950c05d534.txt b/src/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.0.0-20190430073000-30950c05d534.txt
similarity index 57%
rename from src/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.0.0-20190429073000-30950c05d534.txt
rename to src/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.0.0-20190430073000-30950c05d534.txt
index 421e643d43..047ceb68c5 100644
--- a/src/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.0.0-20190429073000-30950c05d534.txt
+++ b/src/cmd/go/testdata/mod/example.com_pseudoupgrade_v0.0.0-20190430073000-30950c05d534.txt
@@ -5,7 +5,7 @@ written by hand
module example.com/pseudoupgrade
-- .info --
-{"Version":"v0.0.0-20190429073000-30950c05d534","Name":"v0.0.0-20190429073000-30950c05d534","Short":"30950c05d534","Time":"2019-04-29T07:30:00Z"}
+{"Version":"v0.0.0-20190430073000-30950c05d534","Name":"v0.0.0-20190430073000-30950c05d534","Short":"30950c05d534","Time":"2019-04-30T07:30:00Z"}
-- pseudoupgrade.go --
package pseudoupgrade
diff --git a/src/cmd/go/testdata/script/README b/src/cmd/go/testdata/script/README
index 3dceb735aa..66ab8515c3 100644
--- a/src/cmd/go/testdata/script/README
+++ b/src/cmd/go/testdata/script/README
@@ -28,6 +28,7 @@ Scripts also have access to these other environment variables:
GOARCH=
GOCACHE=
+ GOEXE=
GOOS=
GOPATH=$WORK/gopath
GOPROXY=
@@ -38,8 +39,6 @@ Scripts also have access to these other environment variables:
devnull=
goversion=
-The environment variable $exe (lowercase) is an empty string on most systems, ".exe" on Windows.
-
The scripts supporting files are unpacked relative to $GOPATH/src (aka $WORK/gopath/src)
and then the script begins execution in that directory as well. Thus the example above runs
in $WORK/gopath/src with GOPATH=$WORK/gopath and $WORK/gopath/src/hello.go
diff --git a/src/cmd/go/testdata/script/build_cache_link.txt b/src/cmd/go/testdata/script/build_cache_link.txt
index e80d776473..b9c740ac10 100644
--- a/src/cmd/go/testdata/script/build_cache_link.txt
+++ b/src/cmd/go/testdata/script/build_cache_link.txt
@@ -16,9 +16,9 @@ go build -o $devnull -x main.go
stderr '(link|gccgo)( |\.exe)'
# ... but the output binary can serve as a cache.
-go build -o main$exe -x main.go
+go build -o main$GOEXE -x main.go
stderr '(link|gccgo)( |\.exe)'
-go build -o main$exe -x main.go
+go build -o main$GOEXE -x main.go
! stderr '(link|gccgo)( |\.exe)'
-- main.go --
diff --git a/src/cmd/go/testdata/script/build_multi_main.txt b/src/cmd/go/testdata/script/build_multi_main.txt
index 89fe2bec13..1d4926d979 100644
--- a/src/cmd/go/testdata/script/build_multi_main.txt
+++ b/src/cmd/go/testdata/script/build_multi_main.txt
@@ -29,5 +29,5 @@ package pkg1
-- pkg2/pkg2.go --
package pkg2
--- c1$exe/keep.txt --
+-- c1$GOEXE/keep.txt --
Create c1 directory.
diff --git a/src/cmd/go/testdata/script/env_write.txt b/src/cmd/go/testdata/script/env_write.txt
index bdc348c953..695cc83f3d 100644
--- a/src/cmd/go/testdata/script/env_write.txt
+++ b/src/cmd/go/testdata/script/env_write.txt
@@ -5,7 +5,7 @@ env AppData=$HOME/windowsappdata
env home=$HOME/plan9home
go env GOENV
[aix] stdout $HOME/.config/go/env
-[darwin] stdout $HOME/Library/Preferences/go/env
+[darwin] stdout $HOME'/Library/Application Support/go/env'
[freebsd] stdout $HOME/.config/go/env
[linux] stdout $HOME/.config/go/env
[netbsd] stdout $HOME/.config/go/env
diff --git a/src/cmd/go/testdata/script/get_404_meta.txt b/src/cmd/go/testdata/script/get_404_meta.txt
index 32f13c9367..b71cc7fe01 100644
--- a/src/cmd/go/testdata/script/get_404_meta.txt
+++ b/src/cmd/go/testdata/script/get_404_meta.txt
@@ -1,6 +1,7 @@
# golang.org/issue/13037: 'go get' was not parsing tags in 404 served over HTTPS.
[!net] skip
+[!exec:git] skip
env GO111MODULE=off
go get -d -insecure bazil.org/fuse/fs/fstestutil
diff --git a/src/cmd/go/testdata/script/get_insecure_redirect.txt b/src/cmd/go/testdata/script/get_insecure_redirect.txt
index 6d20418fb2..a83b17672d 100644
--- a/src/cmd/go/testdata/script/get_insecure_redirect.txt
+++ b/src/cmd/go/testdata/script/get_insecure_redirect.txt
@@ -1,9 +1,11 @@
# golang.org/issue/29591: 'go get' was following plain-HTTP redirects even without -insecure.
[!net] skip
+[!exec:git] skip
env GO111MODULE=on
-env GOPROXY=
+env GOPROXY=direct
+env GOSUMDB=off
! go get -d vcs-test.golang.org/insecure/go/insecure
stderr 'redirected .* to insecure URL'
diff --git a/src/cmd/go/testdata/script/install_cleans_build.txt b/src/cmd/go/testdata/script/install_cleans_build.txt
index a169a60bda..dc85eb8cef 100644
--- a/src/cmd/go/testdata/script/install_cleans_build.txt
+++ b/src/cmd/go/testdata/script/install_cleans_build.txt
@@ -4,21 +4,21 @@ env GO111MODULE=off
# 'go install' with no arguments should clean up after go build
cd mycmd
go build
-exists mycmd$exe
+exists mycmd$GOEXE
go install
-! exists mycmd$exe
+! exists mycmd$GOEXE
# 'go install mycmd' does not clean up, even in the mycmd directory
go build
-exists mycmd$exe
+exists mycmd$GOEXE
go install mycmd
-exists mycmd$exe
+exists mycmd$GOEXE
# 'go install mycmd' should not clean up in an unrelated current directory either
cd ..
-cp mycmd/mycmd$exe mycmd$exe
+cp mycmd/mycmd$GOEXE mycmd$GOEXE
go install mycmd
-exists mycmd$exe
+exists mycmd$GOEXE
-- mycmd/main.go --
package main
diff --git a/src/cmd/go/testdata/script/mod_build_versioned.txt b/src/cmd/go/testdata/script/mod_build_versioned.txt
index 1b387361a7..d1d74de10c 100644
--- a/src/cmd/go/testdata/script/mod_build_versioned.txt
+++ b/src/cmd/go/testdata/script/mod_build_versioned.txt
@@ -1,17 +1,17 @@
env GO111MODULE=on
[short] skip
-go get -m rsc.io/fortune/v2
+go get -d rsc.io/fortune/v2
-# The default executable name shouldn't be v2$exe
+# The default executable name shouldn't be v2$GOEXE
go build rsc.io/fortune/v2
-! exists v2$exe
-exists fortune$exe
+! exists v2$GOEXE
+exists fortune$GOEXE
-# The default test binary name shouldn't be v2.test$exe
+# The default test binary name shouldn't be v2.test$GOEXE
go test -c rsc.io/fortune/v2
-! exists v2.test$exe
-exists fortune.test$exe
+! exists v2.test$GOEXE
+exists fortune.test$GOEXE
-- go.mod --
module scratch
diff --git a/src/cmd/go/testdata/script/mod_file_proxy.txt b/src/cmd/go/testdata/script/mod_file_proxy.txt
index cf097f8c80..38d9fd25fb 100644
--- a/src/cmd/go/testdata/script/mod_file_proxy.txt
+++ b/src/cmd/go/testdata/script/mod_file_proxy.txt
@@ -11,11 +11,12 @@ go list
grep v1.5.1 $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/list
# Use download cache as file:/// proxy.
-[windows] stop # TODO: file://$WORK puts backslashes in the URL
env GOPATH=$WORK/gopath2
-env GOPROXY=file:///nonexist
+[windows] env GOPROXY=file:///C:/nonexist
+[!windows] env GOPROXY=file:///nonexist
! go list
-env GOPROXY=file://$WORK/gopath1/pkg/mod/cache/download
+[windows] env GOPROXY=file:///$WORK/gopath1/pkg/mod/cache/download
+[!windows] env GOPROXY=file://$WORK/gopath1/pkg/mod/cache/download
go list
grep v1.5.1 $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/list
diff --git a/src/cmd/go/testdata/script/mod_get_commit.txt b/src/cmd/go/testdata/script/mod_get_commit.txt
index f88eb692fd..a906babbd5 100644
--- a/src/cmd/go/testdata/script/mod_get_commit.txt
+++ b/src/cmd/go/testdata/script/mod_get_commit.txt
@@ -4,21 +4,14 @@ env GOPROXY=$GOPROXY/quiet
# @commit should resolve
-# golang.org/x/text/language@commit should not resolve with -m,
-# because that's not a module path.
-! go get -d -m golang.org/x/text/language@14c0d48
-
-# ... but it should work without -m.
-# because of -d, the compiler should not run
+# golang.org/x/text/language@commit should resolve.
+# Because of -d, the compiler should not run.
go get -d -x golang.org/x/text/language@14c0d48
! stderr 'compile|cp|gccgo .*language\.a$'
# go get should skip build with no Go files in root
go get -d golang.org/x/text@14c0d48
-# ... and go get should skip build with -m
-go get -m golang.org/x/text@14c0d48
-
# dropping -d, we should see a build.
[short] skip
go get -x golang.org/x/text/language@14c0d48
diff --git a/src/cmd/go/testdata/script/mod_get_hash.txt b/src/cmd/go/testdata/script/mod_get_hash.txt
index d35ad362c0..3bb3ee7880 100644
--- a/src/cmd/go/testdata/script/mod_get_hash.txt
+++ b/src/cmd/go/testdata/script/mod_get_hash.txt
@@ -2,6 +2,7 @@ env GO111MODULE=on
env GOPROXY=direct
env GOSUMDB=off
[!net] skip
+[!exec:git] skip
# fetch commit hash reachable from refs/heads/* and refs/tags/* is OK
go list -m golang.org/x/time@8be79e1e0910c292df4e79c241bb7e8f7e725959 # on master branch
@@ -16,4 +17,3 @@ stderr 'unknown revision'
-- go.mod --
module m
-
diff --git a/src/cmd/go/testdata/script/mod_get_latest_pseudo.txt b/src/cmd/go/testdata/script/mod_get_latest_pseudo.txt
new file mode 100644
index 0000000000..825ee8cf89
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_get_latest_pseudo.txt
@@ -0,0 +1,10 @@
+# Check that we can build a module with no tagged versions by querying
+# "@latest" through a proxy.
+# Verifies golang.org/issue/32636
+
+env GO111MODULE=on
+
+go mod init m
+go list example.com/notags
+go list -m all
+stdout '^example.com/notags v0.0.0-20190507143103-cc8cbe209b64$'
diff --git a/src/cmd/go/testdata/script/mod_get_local.txt b/src/cmd/go/testdata/script/mod_get_local.txt
index 44a470ecfc..eb09da58b3 100644
--- a/src/cmd/go/testdata/script/mod_get_local.txt
+++ b/src/cmd/go/testdata/script/mod_get_local.txt
@@ -5,22 +5,22 @@ env GO111MODULE=on
go mod edit -fmt
cp go.mod go.mod.orig
-# 'go get -u -m' within the main module should work, even if it has a local-only name.
+# 'go get -u' within the main module should work, even if it has a local-only name.
cp go.mod.orig go.mod
-go get -u -m
+go get -d -u ./...
grep 'rsc.io/quote.*v1.5.2' go.mod
grep 'golang.org/x/text.*v0.3.0' go.mod
cp go.mod go.mod.implicitmod
-# 'go get -u -m' with the name of the main module should be equivalent to
-# 'go get -u -m' without any further arguments.
+# 'go get -u local/...' should be equivalent to 'go get -u ./...'
+# (assuming no nested modules)
cp go.mod.orig go.mod
-go get -u -m local
+go get -d -u local/...
cmp go.mod go.mod.implicitmod
# For the main module, @patch should be a no-op.
cp go.mod.orig go.mod
-go get -u -m local@patch
+go get -d -u local/...@patch
cmp go.mod go.mod.implicitmod
# 'go get -u -d' in the empty root of the main module should fail.
diff --git a/src/cmd/go/testdata/script/mod_get_main.txt b/src/cmd/go/testdata/script/mod_get_main.txt
index 14dcffeaad..8e06220f9e 100644
--- a/src/cmd/go/testdata/script/mod_get_main.txt
+++ b/src/cmd/go/testdata/script/mod_get_main.txt
@@ -4,22 +4,22 @@ env GO111MODULE=on
# @patch and @latest within the main module refer to the current version.
# The main module won't be upgraded, but missing dependencies will be added.
cp go.mod.orig go.mod
-go get -m rsc.io@latest
+go get -d rsc.io/x@latest
grep 'rsc.io/quote v1.5.2' go.mod
cp go.mod.orig go.mod
-go get -m rsc.io@patch
+go get -d rsc.io/x@patch
grep 'rsc.io/quote v1.5.2' go.mod
cp go.mod.orig go.mod
# The main module cannot be updated to a specific version.
-! go get -m rsc.io@v0.1.0
-stderr '^go get rsc.io@v0.1.0: can.t get a specific version of the main module$'
+! go get rsc.io/x@v0.1.0
+stderr '^go get rsc.io/x@v0.1.0: can.t request explicit version of path in main module$'
! go get -d rsc.io/x@v0.1.0
-stderr '^go get rsc.io/x@v0.1.0: can.t query specific version for package rsc.io/x in the main module \(rsc.io\)$'
+stderr '^go get rsc.io/x@v0.1.0: can.t request explicit version of path in main module$'
# Upgrading a package pattern not contained in the main module should not
# attempt to upgrade the main module.
-go get rsc.io/quote/...@v1.5.1
+go get -d rsc.io/quote/...@v1.5.1
grep 'rsc.io/quote v1.5.1' go.mod
-- go.mod.orig --
diff --git a/src/cmd/go/testdata/script/mod_get_patterns.txt b/src/cmd/go/testdata/script/mod_get_patterns.txt
index 9521c4f84a..b9931970e0 100644
--- a/src/cmd/go/testdata/script/mod_get_patterns.txt
+++ b/src/cmd/go/testdata/script/mod_get_patterns.txt
@@ -1,15 +1,9 @@
env GO111MODULE=on
[short] skip
-# If a pattern doesn't match any modules in the build list,
-# and -m is used, an error should be reported.
-cp go.mod.orig go.mod
-! go get -m rsc.io/quote/...
-stderr 'pattern matches no modules in build list'
-
-# If a pattern doesn't match any modules in the build list,
-# we assume the pattern matches a single module where the
-# part of the pattern before "..." is the module path.
+# If a pattern doesn't match any packages provided by modules
+# in the build list, we assume the pattern matches a single module
+# whose path is a prefix of the part of the pattern before "...".
cp go.mod.orig go.mod
go get -d rsc.io/quote/...
grep 'require rsc.io/quote' go.mod
@@ -27,7 +21,7 @@ stderr 'go get rsc.io/quote/x/...: module rsc.io/quote@latest \(v1.5.2\) found,
# be upgraded, even if the module path matches the pattern.
cp go.mod.orig go.mod
go mod edit -require example.com/nest@v1.0.0
-go get example.com/nest/sub/y...
+go get -d example.com/nest/sub/y...
grep 'example.com/nest/sub v1.0.0' go.mod
grep 'example.com/nest v1.0.0' go.mod
diff --git a/src/cmd/go/testdata/script/mod_get_private_vcs.txt b/src/cmd/go/testdata/script/mod_get_private_vcs.txt
index 1c73182206..514b0a7a53 100644
--- a/src/cmd/go/testdata/script/mod_get_private_vcs.txt
+++ b/src/cmd/go/testdata/script/mod_get_private_vcs.txt
@@ -3,7 +3,7 @@ env GO111MODULE=on
# Testing stderr for git ls-remote; turn off proxy.
[!net] skip
[!exec:git] skip
-env GOPROXY=
+env GOPROXY=direct
! go get github.com/golang/nonexist
stderr 'Confirm the import path was entered correctly.'
diff --git a/src/cmd/go/testdata/script/mod_get_pseudo.txt b/src/cmd/go/testdata/script/mod_get_pseudo.txt
index 5b1ec6e96b..582837a166 100644
--- a/src/cmd/go/testdata/script/mod_get_pseudo.txt
+++ b/src/cmd/go/testdata/script/mod_get_pseudo.txt
@@ -9,68 +9,69 @@ env GOSUMDB=off
# We can resolve the @master branch without unshallowing the local repository
# (even with older gits), so try that before we do anything else.
# (This replicates https://golang.org/issue/26713 with git 2.7.4.)
-go get -m github.com/rsc/legacytest@master
+go get -d github.com/rsc/legacytest@master
go list -m all
stdout '^github.com/rsc/legacytest v2\.0\.1-0\.\d{14}-7303f7796364\+incompatible$'
# get should include incompatible tags in "latest" calculation.
-go get -m github.com/rsc/legacytest@latest
+go mod edit -droprequire github.com/rsc/legacytest
+go get -d github.com/rsc/legacytest@latest
go list
go list -m all
stdout '^github.com/rsc/legacytest v2\.0\.0\+incompatible$'
# v2.0.1-0.pseudo+incompatible
-go get -m ...test@7303f77
+go get -d ...test@7303f77
go list -m all
stdout '^github.com/rsc/legacytest v2\.0\.1-0\.\d{14}-7303f7796364\+incompatible$'
# v2.0.0+incompatible by tag+incompatible
-go get -m ...test@v2.0.0+incompatible
+go get -d ...test@v2.0.0+incompatible
go list -m all
stdout '^github.com/rsc/legacytest v2\.0\.0\+incompatible$'
# v2.0.0+incompatible by tag
-go get -m ...test@v2.0.0
+go get -d ...test@v2.0.0
go list -m all
stdout '^github.com/rsc/legacytest v2\.0\.0\+incompatible$'
# v2.0.0+incompatible by hash (back on master)
-go get -m ...test@d7ae1e4
+go get -d ...test@d7ae1e4
go list -m all
stdout '^github.com/rsc/legacytest v2\.0\.0\+incompatible$'
# v1.2.1-0.pseudo
-go get -m ...test@d2d4c3e
+go get -d ...test@d2d4c3e
go list -m all
stdout '^github.com/rsc/legacytest v1\.2\.1-0\.\d{14}-d2d4c3ea6623$'
# v1.2.0
-go get -m ...test@9f6f860
+go get -d ...test@9f6f860
go list -m all
stdout '^github.com/rsc/legacytest v1\.2\.0$'
# v1.1.0-pre.0.pseudo
-go get -m ...test@fb3c628
+go get -d ...test@fb3c628
go list -m all
stdout '^github.com/rsc/legacytest v1\.1\.0-pre\.0\.\d{14}-fb3c628075e3$'
# v1.1.0-pre (no longer on master)
-go get -m ...test@731e3b1
+go get -d ...test@731e3b1
go list -m all
stdout '^github.com/rsc/legacytest v1\.1\.0-pre$'
# v1.0.1-0.pseudo
-go get -m ...test@fa4f5d6
+go get -d ...test@fa4f5d6
go list -m all
stdout '^github.com/rsc/legacytest v1\.0\.1-0\.\d{14}-fa4f5d6a71c6$'
# v1.0.0
-go get -m ...test@7fff7f3
+go get -d ...test@7fff7f3
go list -m all
stdout '^github.com/rsc/legacytest v1\.0\.0$'
# v0.0.0-pseudo
-go get -m ...test@52853eb
+go get -d ...test@52853eb
go list -m all
stdout '^github.com/rsc/legacytest v0\.0\.0-\d{14}-52853eb7b552$'
diff --git a/src/cmd/go/testdata/script/mod_get_pseudo_other_branch.txt b/src/cmd/go/testdata/script/mod_get_pseudo_other_branch.txt
index fcff9b1ea3..0fbd041f86 100644
--- a/src/cmd/go/testdata/script/mod_get_pseudo_other_branch.txt
+++ b/src/cmd/go/testdata/script/mod_get_pseudo_other_branch.txt
@@ -17,7 +17,7 @@ env GOSUMDB=off
# The pseudo-version hence sorts immediately after v0.2.2 rather
# than v0.2.1, even though the v0.2.2 tag is not on master.
-go get -m vcs-test.golang.org/git/tagtests.git@master
+go get -d vcs-test.golang.org/git/tagtests.git@master
go list -m all
stdout '^vcs-test.golang.org/git/tagtests.git v0.2.3-0\.'
diff --git a/src/cmd/go/testdata/script/mod_get_pseudo_prefix.txt b/src/cmd/go/testdata/script/mod_get_pseudo_prefix.txt
index 4d1a8b8632..b78e6e644f 100644
--- a/src/cmd/go/testdata/script/mod_get_pseudo_prefix.txt
+++ b/src/cmd/go/testdata/script/mod_get_pseudo_prefix.txt
@@ -16,11 +16,11 @@ env GOSUMDB=off
#
# The pseudo-version is based on sub/v0.0.10, since v0.2.0 doesn't
# contain the prefix.
-go get -m vcs-test.golang.org/git/prefixtagtests.git/sub
+go get -d vcs-test.golang.org/git/prefixtagtests.git/sub
go list -m all
stdout '^vcs-test.golang.org/git/prefixtagtests.git/sub v0.0.10$'
-go get -u -m vcs-test.golang.org/git/prefixtagtests.git/sub@master
+go get -d -u vcs-test.golang.org/git/prefixtagtests.git/sub@master
go list -m all
stdout '^vcs-test.golang.org/git/prefixtagtests.git/sub v0.0.11-0\.'
diff --git a/src/cmd/go/testdata/script/mod_get_tags.txt b/src/cmd/go/testdata/script/mod_get_tags.txt
new file mode 100644
index 0000000000..603c76983f
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_get_tags.txt
@@ -0,0 +1,44 @@
+env GO111MODULE=on
+
+[short] skip
+
+# get should add modules needed to build packages, even if those
+# dependencies are in sources excluded by build tags.
+# All build tags are considered true except "ignore".
+go mod init m
+go get -d .
+go list -m all
+stdout 'example.com/version v1.1.0'
+stdout 'rsc.io/quote v1.5.2'
+
+[short] skip
+
+# Packages that are only imported in excluded files should not be built.
+go get -x .
+stderr 'compile.* -p m '
+! stderr 'compile.* -p example.com/version '
+! stderr 'compile.* -p rsc.io/quote '
+
+-- empty.go --
+package m
+
+-- excluded.go --
+// +build windows,mips
+
+package m
+
+import _ "example.com/version"
+
+-- tools.go --
+// +build tools
+
+package tools
+
+import _ "rsc.io/quote"
+
+-- ignore.go --
+// +build ignore
+
+package ignore
+
+import _ "example.com/doesnotexist"
diff --git a/src/cmd/go/testdata/script/mod_get_upgrade.txt b/src/cmd/go/testdata/script/mod_get_upgrade.txt
index f6ba53381b..6a14dfdc45 100644
--- a/src/cmd/go/testdata/script/mod_get_upgrade.txt
+++ b/src/cmd/go/testdata/script/mod_get_upgrade.txt
@@ -5,8 +5,8 @@ go list -m all
stdout 'rsc.io/quote v1.5.1'
grep 'rsc.io/quote v1.5.1$' go.mod
-# get -m -u should update all dependencies
-go get -d -m -u
+# get -u should update dependencies of the package in the current directory
+go get -d -u
grep 'rsc.io/quote v1.5.2$' go.mod
grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod
@@ -17,19 +17,19 @@ grep 'rsc.io/quote v1.5.1$' go.mod
grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod
# move to a pseudo-version after any tags
-go get -d -m rsc.io/quote@dd9747d
+go get -d rsc.io/quote@dd9747d
grep 'rsc.io/quote v0.0.0-20180628003336-dd9747d19b04' go.mod
# get -u should not jump off newer pseudo-version to earlier tag
-go get -d -m -u
+go get -d -u
grep 'rsc.io/quote v0.0.0-20180628003336-dd9747d19b04' go.mod
# move to earlier pseudo-version
-go get -d -m rsc.io/quote@e7a685a342
+go get -d rsc.io/quote@e7a685a342
grep 'rsc.io/quote v0.0.0-20180214005133-e7a685a342c0' go.mod
# get -u should jump off earlier pseudo-version to newer tag
-go get -d -m -u
+go get -d -u
grep 'rsc.io/quote v1.5.2' go.mod
-- go.mod --
diff --git a/src/cmd/go/testdata/script/mod_get_upgrade_pseudo.txt b/src/cmd/go/testdata/script/mod_get_upgrade_pseudo.txt
index 80b240130f..9184d85f7f 100644
--- a/src/cmd/go/testdata/script/mod_get_upgrade_pseudo.txt
+++ b/src/cmd/go/testdata/script/mod_get_upgrade_pseudo.txt
@@ -3,17 +3,38 @@ env GO111MODULE=on
# For this test module there are three versions:
# * v0.1.1-0.20190429073117-b5426c86b553
# * v0.1.0
-# * v0.0.0-20190429073000-30950c05d534
+# * v0.0.0-20190430073000-30950c05d534
# Only v0.1.0 is tagged.
#
-# The latest pseudo-version is semantically higher than the latest tag.
-# 'get -u' should not downgrade to the (lower) tagged version.
+# The v0.1.1 pseudo-version is semantically higher than the latest tag.
+# The v0.0.0 pseudo-version is chronologically newer.
-go get -m example.com/pseudoupgrade@b5426c8
-go get -u
+# 'get -u' should not downgrade to the (lower) tagged version.
+go get -d example.com/pseudoupgrade@b5426c8
+go get -d -u
go list -m -u all
stdout '^example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553$'
+# 'get example.com/pseudoupgrade@latest' should not downgrade to
+# the (lower) tagged version.
+go get -d example.com/pseudoupgrade@latest
+go list -m all
+stdout '^example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553$'
+
+# We should observe the same behavior with the newer pseudo-version.
+go get -d example.com/pseudoupgrade@v0.0.0-20190430073000-30950c05d534
+
+# 'get -u' should not downgrade to the chronologically older tagged version.
+go get -d -u
+go list -m -u all
+stdout '^example.com/pseudoupgrade v0.0.0-20190430073000-30950c05d534$'
+
+# 'get example.com/pseudoupgrade@latest' should not downgrade to the
+# chronologically older tagged version.
+go get -d example.com/pseudoupgrade@latest
+go list -m -u all
+stdout '^example.com/pseudoupgrade v0.0.0-20190430073000-30950c05d534$'
+
-- go.mod --
module x
diff --git a/src/cmd/go/testdata/script/mod_getmode_vendor.txt b/src/cmd/go/testdata/script/mod_getmode_vendor.txt
index 3dd8d1b888..7e1f6aa323 100644
--- a/src/cmd/go/testdata/script/mod_getmode_vendor.txt
+++ b/src/cmd/go/testdata/script/mod_getmode_vendor.txt
@@ -1,6 +1,6 @@
env GO111MODULE=on
-go get -m rsc.io/quote@v1.5.1
+go get -d rsc.io/quote@v1.5.1
go mod vendor
env GOPATH=$WORK/empty
env GOPROXY=file:///nonexist
diff --git a/src/cmd/go/testdata/script/mod_git_export_subst.txt b/src/cmd/go/testdata/script/mod_git_export_subst.txt
index 2b8e2bc7bc..a28b4f2d67 100644
--- a/src/cmd/go/testdata/script/mod_git_export_subst.txt
+++ b/src/cmd/go/testdata/script/mod_git_export_subst.txt
@@ -1,5 +1,5 @@
env GO111MODULE=on
-env GOPROXY=
+env GOPROXY=direct
# Testing that git export-subst is disabled
[!net] skip
diff --git a/src/cmd/go/testdata/script/mod_gobuild_import.txt b/src/cmd/go/testdata/script/mod_gobuild_import.txt
index eb2284e561..a4eb5d6596 100644
--- a/src/cmd/go/testdata/script/mod_gobuild_import.txt
+++ b/src/cmd/go/testdata/script/mod_gobuild_import.txt
@@ -6,11 +6,11 @@ go build -o $WORK/testimport.exe ./testimport
# GO111MODULE=off
env GO111MODULE=off
-! exec $WORK/testimport.exe x/y/z/w .
+! exec $WORK/testimport.exe gobuild.example.com/x/y/z/w .
# GO111MODULE=auto in GOPATH/src
env GO111MODULE=auto
-exec $WORK/testimport.exe x/y/z/w .
+exec $WORK/testimport.exe gobuild.example.com/x/y/z/w .
# GO111MODULE=auto outside GOPATH/src
cd $GOPATH/other
@@ -18,8 +18,8 @@ env GO111MODULE=auto
exec $WORK/testimport.exe other/x/y/z/w .
stdout w2.go
-! exec $WORK/testimport.exe x/y/z/w .
-stderr 'cannot find module providing package x/y/z/w'
+! exec $WORK/testimport.exe gobuild.example.com/x/y/z/w .
+stderr 'cannot find module providing package gobuild.example.com/x/y/z/w'
cd z
exec $WORK/testimport.exe other/x/y/z/w .
@@ -36,17 +36,17 @@ stdout w2.go
# GO111MODULE=on in GOPATH/src
cd $GOPATH/src
env GO111MODULE=
-exec $WORK/testimport.exe x/y/z/w .
+exec $WORK/testimport.exe gobuild.example.com/x/y/z/w .
stdout w1.go
env GO111MODULE=on
-exec $WORK/testimport.exe x/y/z/w .
+exec $WORK/testimport.exe gobuild.example.com/x/y/z/w .
stdout w1.go
cd w
-exec $WORK/testimport.exe x/y/z/w ..
+exec $WORK/testimport.exe gobuild.example.com/x/y/z/w ..
stdout w1.go
-- go.mod --
-module x/y/z
+module gobuild.example.com/x/y/z
-- z.go --
package z
diff --git a/src/cmd/go/testdata/script/mod_gonoproxy.txt b/src/cmd/go/testdata/script/mod_gonoproxy.txt
index f038112bf1..2bd94cdee0 100644
--- a/src/cmd/go/testdata/script/mod_gonoproxy.txt
+++ b/src/cmd/go/testdata/script/mod_gonoproxy.txt
@@ -1,7 +1,7 @@
env GO111MODULE=on
env sumdb=$GOSUMDB
env proxy=$GOPROXY
-env GOPROXY GONOPROXY GOSUMDB GONOSUMDB
+env GOPRIVATE GOPROXY GONOPROXY GOSUMDB GONOSUMDB
env dbname=localhost.localdev/sumdb
# disagree with sumdb fails
@@ -13,19 +13,25 @@ stderr 'SECURITY ERROR'
# but GONOSUMDB bypasses sumdb, for rsc.io/quote, rsc.io/sampler, golang.org/x/text
env GONOSUMDB='*/quote,*/*mple*,golang.org/x'
go get rsc.io/quote
+rm go.sum
+env GOPRIVATE='*/quote,*/*mple*,golang.org/x'
+env GONOPROXY=none # that is, proxy all despite GOPRIVATE
+go get rsc.io/quote
# and GONOPROXY bypasses proxy
[!net] skip
+[!exec:git] skip
+env GOPRIVATE=none
env GONOPROXY='*/fortune'
! go get rsc.io/fortune # does not exist in real world, only on test proxy
stderr 'git ls-remote'
env GOSUMDB=
-env GONOPROXY='*/x'
+env GONOPROXY=
+env GOPRIVATE='*/x'
go get golang.org/x/text
go list -m all
! stdout 'text.*v0.0.0-2017' # should not have the version from the proxy
-
-- go.mod.orig --
module m
diff --git a/src/cmd/go/testdata/script/mod_gopkg_unstable.txt b/src/cmd/go/testdata/script/mod_gopkg_unstable.txt
index b39bdd18bb..9d288a64d4 100644
--- a/src/cmd/go/testdata/script/mod_gopkg_unstable.txt
+++ b/src/cmd/go/testdata/script/mod_gopkg_unstable.txt
@@ -8,6 +8,7 @@ cp go.mod.empty go.mod
go list
[!net] skip
+[!exec:git] skip
env GOPROXY=direct
env GOSUMDB=off
diff --git a/src/cmd/go/testdata/script/mod_import_v1suffix.txt b/src/cmd/go/testdata/script/mod_import_v1suffix.txt
index 82bb5e2a2f..a429450466 100644
--- a/src/cmd/go/testdata/script/mod_import_v1suffix.txt
+++ b/src/cmd/go/testdata/script/mod_import_v1suffix.txt
@@ -1,6 +1,6 @@
env GO111MODULE=on
-! go get -m example.com/invalidpath/v1
+! go get -d example.com/invalidpath/v1
! go install .
-- go.mod --
diff --git a/src/cmd/go/testdata/script/mod_init_glide.txt b/src/cmd/go/testdata/script/mod_init_glide.txt
new file mode 100644
index 0000000000..a351a6ae4b
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_init_glide.txt
@@ -0,0 +1,34 @@
+[!net] skip
+[!exec:git] skip
+
+env GO111MODULE=on
+env GOPROXY=direct
+
+# Regression test for golang.org/issue/32161:
+# 'go mod init' did not locate tags when resolving a commit to a pseudo-version.
+go mod init x
+cmpenv go.mod go.mod.out
+
+-- main.go --
+package main
+
+import (
+ _ "github.com/rsc/legacytest"
+)
+
+func main() {}
+
+-- glide.lock --
+imports:
+- name: github.com/rsc/legacytest
+ version: fb3c628075e32f7f3c248a3abbdafd69ad6e21e1
+
+-- glide.yaml --
+package: x
+
+-- go.mod.out --
+module x
+
+go $goversion
+
+require github.com/rsc/legacytest v1.1.0-pre.0.20180717164849-fb3c628075e3
diff --git a/src/cmd/go/testdata/script/mod_list_upgrade_pseudo.txt b/src/cmd/go/testdata/script/mod_list_upgrade_pseudo.txt
index 143e029e52..b983bec73d 100644
--- a/src/cmd/go/testdata/script/mod_list_upgrade_pseudo.txt
+++ b/src/cmd/go/testdata/script/mod_list_upgrade_pseudo.txt
@@ -3,16 +3,23 @@ env GO111MODULE=on
# For this test module there are three versions:
# * v0.1.1-0.20190429073117-b5426c86b553
# * v0.1.0
-# * v0.0.0-20190429073000-30950c05d534
+# * v0.0.0-20190430073000-30950c05d534
# Only v0.1.0 is tagged.
#
+# The v0.1.1 pseudo-version is semantically higher than the latest tag.
+# The v0.0.0 pseudo-version is chronologically newer.
+
# The latest pseudo-version is semantically higher than the latest tag.
# 'list -u' should not suggest a lower version as an upgrade.
-go get -m example.com/pseudoupgrade@b5426c8
+go get -d example.com/pseudoupgrade@b5426c8
go list -m -u all
stdout '^example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553$'
+go get -d example.com/pseudoupgrade@v0.0.0-20190430073000-30950c05d534
+go list -m -u all
+stdout '^example.com/pseudoupgrade v0.0.0-20190430073000-30950c05d534$'
+
-- go.mod --
module x
diff --git a/src/cmd/go/testdata/script/mod_load_badchain.txt b/src/cmd/go/testdata/script/mod_load_badchain.txt
index 7bde83963d..6fdf2c7b6b 100644
--- a/src/cmd/go/testdata/script/mod_load_badchain.txt
+++ b/src/cmd/go/testdata/script/mod_load_badchain.txt
@@ -10,13 +10,13 @@ go mod download example.com/badchain/b@v1.1.0
go mod download example.com/badchain/c@v1.1.0
# Try to update example.com/badchain/a (and its dependencies).
-! go get -u example.com/badchain/a
+! go get -d example.com/badchain/a
cmp stderr update-a-expected
cmp go.mod go.mod.orig
# Try to update the main module. This updates everything, including
# modules that aren't direct requirements, so the error stack is shorter.
-! go get -m -u
+! go get -d -u ./...
cmp stderr update-main-expected
cmp go.mod go.mod.orig
diff --git a/src/cmd/go/testdata/script/mod_off.txt b/src/cmd/go/testdata/script/mod_off.txt
new file mode 100644
index 0000000000..cada6deb1d
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_off.txt
@@ -0,0 +1,35 @@
+env GO111MODULE=off
+
+# This script tests that running go mod with
+# GO111MODULE=off when outside of GOPATH will fatal
+# with an error message, even with some source code in the directory and a go.mod.
+! go mod init
+stderr 'go mod init: modules disabled by GO111MODULE=off; see ''go help modules'''
+! go mod graph
+stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
+! go mod verify
+stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
+! go mod download
+stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
+
+# Same result in an empty directory
+mkdir z
+cd z
+! go mod init
+stderr 'go mod init: modules disabled by GO111MODULE=off; see ''go help modules'''
+! go mod graph
+stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
+! go mod verify
+stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
+! go mod download
+stderr 'go: modules disabled by GO111MODULE=off; see ''go help modules'''
+
+-- sample.go --
+package sample
+
+func main() {}
+
+-- go.mod --
+module sample
+
+go 1.12
diff --git a/src/cmd/go/testdata/script/mod_outside.txt b/src/cmd/go/testdata/script/mod_outside.txt
index c3d53e035b..4182e71dde 100644
--- a/src/cmd/go/testdata/script/mod_outside.txt
+++ b/src/cmd/go/testdata/script/mod_outside.txt
@@ -113,9 +113,9 @@ go get -u all
! stdout .
stderr 'warning: "all" matched no packages'
-# 'go get -m' should check the proposed module graph for consistency,
-# even though it will not be saved anywhere.
-! go get -m example.com/printversion@v1.0.0 example.com/version@none
+# 'go get' should check the proposed module graph for consistency,
+# even though we won't write it anywhere.
+! go get -d example.com/printversion@v1.0.0 example.com/version@none
stderr 'inconsistent versions'
# 'go get -d' should download and extract the source code needed to build the requested version.
diff --git a/src/cmd/go/testdata/script/mod_proxy_https.txt b/src/cmd/go/testdata/script/mod_proxy_https.txt
new file mode 100644
index 0000000000..a23090cd0a
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_proxy_https.txt
@@ -0,0 +1,19 @@
+env GO111MODULE=on
+
+# GOPROXY file paths must provide the "file://" prefix explicitly.
+env GOPROXY=$WORK/proxydir
+! go list -versions -m golang.org/x/text
+stderr 'invalid proxy URL.*proxydir'
+
+[!net] stop
+
+# GOPROXY HTTPS paths may elide the "https://" prefix.
+# (See golang.org/issue/32191.)
+env GOPROXY=proxy.golang.org
+go list -versions -m golang.org/x/text
+
+-- go.mod --
+module example.com
+go 1.13
+-- $WORK/proxydir/README.md --
+This proxy contains no data.
diff --git a/src/cmd/go/testdata/script/mod_pseudo_cache.txt b/src/cmd/go/testdata/script/mod_pseudo_cache.txt
new file mode 100644
index 0000000000..dd89614b9f
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_pseudo_cache.txt
@@ -0,0 +1,29 @@
+[!net] skip
+[!exec:git] skip
+
+env GO111MODULE=on
+env GOPROXY=direct
+env GOSUMDB=off
+
+# Regression test for golang.org/issue/27171: after resolving an older
+# pseudo-version of a commit, future resolution of that commit by hash should
+# choose the highest appropriate pseudo-version instead of the cached one.
+
+go mod download -json golang.org/x/text@v0.0.0-20171215141712-a1b916ed6726
+stdout '"Version": "v0.0.0-20171215141712-a1b916ed6726",'
+
+# If GOPROXY is 'off', lookups should use whatever pseudo-version is available.
+env GOPROXY=off
+go mod download -json golang.org/x/text@a1b916ed6726
+stdout '"Version": "v0.0.0-20171215141712-a1b916ed6726",'
+
+# If we can re-resolve the commit to a pseudo-version, fetching the commit by
+# hash should use the highest such pseudo-version appropriate to the commit.
+env GOPROXY=direct
+go mod download -json golang.org/x/text@a1b916ed6726
+stdout '"Version": "v0.3.1-0.20171215141712-a1b916ed6726",'
+
+# If GOPROXY is 'off', lookups should use the highest pseudo-version in the cache.
+env GOPROXY=off
+go mod download -json golang.org/x/text@a1b916ed6726
+stdout '"Version": "v0.3.1-0.20171215141712-a1b916ed6726",'
diff --git a/src/cmd/go/testdata/script/mod_sumdb.txt b/src/cmd/go/testdata/script/mod_sumdb.txt
index 2a322e25e6..8e1f3d7a7b 100644
--- a/src/cmd/go/testdata/script/mod_sumdb.txt
+++ b/src/cmd/go/testdata/script/mod_sumdb.txt
@@ -8,26 +8,26 @@ env dbname=localhost.localdev/sumdb
# (this also populates tiles on the sumdb server).
cp go.mod.orig go.mod
env GOSUMDB=$sumdb' '$proxy/sumdb-wrong
-! go get rsc.io/quote
+! go get -d rsc.io/quote
stderr 'verifying rsc.io/quote@v1.5.2/go.mod: checksum mismatch'
stderr 'downloaded: h1:LzX7'
stderr 'localhost.localdev/sumdb: h1:wrong'
stderr 'SECURITY ERROR\nThis download does NOT match the one reported by the checksum server.'
-! go get rsc.io/sampler
-! go get golang.org/x/text
+! go get -d rsc.io/sampler
+! go get -d golang.org/x/text
rm go.sum
# switching to truthful sumdb detects timeline inconsistency
cp go.mod.orig go.mod
env GOSUMDB=$sumdb
-! go get -m rsc.io/fortune
+! go get -d rsc.io/fortune
stderr 'SECURITY ERROR\ngo.sum database server misbehavior detected!'
stderr 'proof of misbehavior:'
# removing the cached wrong tree head and cached tiles clears the bad data
rm $GOPATH/pkg/sumdb/$dbname/latest
go clean -modcache
-go get -m rsc.io/fortune
+go get -d rsc.io/fortune
-- go.mod.orig --
module m
diff --git a/src/cmd/go/testdata/script/mod_sumdb_cache.txt b/src/cmd/go/testdata/script/mod_sumdb_cache.txt
index 748ec640d1..a44a87499a 100644
--- a/src/cmd/go/testdata/script/mod_sumdb_cache.txt
+++ b/src/cmd/go/testdata/script/mod_sumdb_cache.txt
@@ -7,41 +7,41 @@ env GOPROXY GONOPROXY GOSUMDB GONOSUMDB
cp go.mod.orig go.mod
rm go.sum
env GOPROXY=$proxy/sumdb-503
-! go get -m rsc.io/quote
+! go get -d rsc.io/quote
stderr 503
# fetch through working proxy is OK
cp go.mod.orig go.mod
rm go.sum
env GOPROXY=$proxy
-go get -m rsc.io/quote
+go get -d rsc.io/quote
# repeated fetch works entirely from cache, does not consult sumdb
cp go.mod.orig go.mod
rm go.sum
env GOPROXY=$proxy/sumdb-503
-go get -m rsc.io/quote
+go get -d rsc.io/quote
rm go.sum
# fetch specific module can work without proxy, using cache or go.sum
cp go.mod.orig go.mod
rm go.sum
env GOPROXY=off
-go get -m rsc.io/quote@v1.5.2 # using cache
+go get -d rsc.io/quote@v1.5.2 # using cache
rm $GOPATH/pkg/mod/download/cache/sumdb/localhost.localdev/sumdb/lookup/rsc.io/quote@v1.5.2
-go get -m rsc.io/quote@v1.5.2 # using go.sum
+go get -d rsc.io/quote@v1.5.2 # using go.sum
# fetch fails once we lose access to both cache and go.sum
rm go.sum
env GOPROXY=$proxy/sumdb-504
-! go get -m rsc.io/quote@v1.5.2
+! go get -d rsc.io/quote@v1.5.2
stderr 504
# but -insecure bypasses the checksum lookup entirely
-go get -m -insecure rsc.io/quote@v1.5.2
+go get -d -insecure rsc.io/quote@v1.5.2
# and then it is in go.sum again
-go get -m rsc.io/quote@v1.5.2
+go get -d rsc.io/quote@v1.5.2
-- go.mod.orig --
module m
diff --git a/src/cmd/go/testdata/script/mod_sumdb_file_path.txt b/src/cmd/go/testdata/script/mod_sumdb_file_path.txt
new file mode 100644
index 0000000000..744632ec90
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_sumdb_file_path.txt
@@ -0,0 +1,41 @@
+[!net] skip
+
+env GO111MODULE=on
+env GOSUMDB=
+
+# With a file-based proxy with an empty checksum directory,
+# downloading a new module should fail, even if a subsequent
+# proxy contains a more complete mirror of the sum database.
+[windows] env GOPROXY=file:///$WORK/sumproxy,https://proxy.golang.org
+[!windows] env GOPROXY=file://$WORK/sumproxy,https://proxy.golang.org
+! go get -d golang.org/x/text@v0.3.2
+stderr '^verifying golang.org/x/text.*: Not Found'
+
+# If the proxy does not claim to support the database,
+# checksum verification should fall through to the next proxy,
+# and downloading should succeed.
+[windows] env GOPROXY=file:///$WORK/emptyproxy,https://proxy.golang.org
+[!windows] env GOPROXY=file://$WORK/emptyproxy,https://proxy.golang.org
+go get -d golang.org/x/text@v0.3.2
+
+# Once the checksum is present in the go.sum file,
+# an empty file-based sumdb can be used in conjunction with
+# a fallback module mirror.
+grep golang.org/x/text go.sum
+go clean -modcache
+[windows] env GOPROXY=file:///$WORK/sumproxy
+[!windows] env GOPROXY=file://$WORK/sumproxy
+! go get -d golang.org/x/text@v0.3.2
+[windows] env GOPROXY=file:///$WORK/sumproxy,https://proxy.golang.org
+[!windows] env GOPROXY=file://$WORK/sumproxy,https://proxy.golang.org
+go get -d golang.org/x/text@v0.3.2
+
+-- go.mod --
+module example.com
+go 1.13
+-- $WORK/emptyproxy/README.md --
+This proxy contains no modules.
+-- $WORK/sumproxy/README.md --
+This proxy contains no modules.
+-- $WORK/sumproxy/sumdb/sum.golang.org/supported --
+This proxy blocks checksum downloads from sum.golang.org.
diff --git a/src/cmd/go/testdata/script/mod_sumdb_golang.txt b/src/cmd/go/testdata/script/mod_sumdb_golang.txt
index 0eb0fc84a7..964501f2ee 100644
--- a/src/cmd/go/testdata/script/mod_sumdb_golang.txt
+++ b/src/cmd/go/testdata/script/mod_sumdb_golang.txt
@@ -2,7 +2,7 @@
env GOPROXY=
env GOSUMDB=
go env GOPROXY
-stdout '^https://proxy.golang.org$'
+stdout '^https://proxy.golang.org,direct$'
go env GOSUMDB
stdout '^sum.golang.org$'
env GOPROXY=https://proxy.golang.org
@@ -11,15 +11,34 @@ stdout '^sum.golang.org$'
# download direct from github
[!net] skip
+[!exec:git] skip
env GOSUMDB=sum.golang.org
env GOPROXY=direct
-go get -m rsc.io/quote
+go get -d rsc.io/quote
-# download from proxy.golang.org
+# download from proxy.golang.org with go.sum entry already
go clean -modcache
-env GOSUMDB='sum.golang.org https://sum.golang.org' # TODO remove URL
-env GOPROXY=https://proxy.golang.org
-go get -m rsc.io/quote
+env GOSUMDB=
+env GOPROXY=
+go get -x -d rsc.io/quote
+! stderr github
+stderr proxy.golang.org/rsc.io/quote
+! stderr sum.golang.org/tile
+! stderr sum.golang.org/lookup/rsc.io/quote
+
+# download again, using checksum database to validate new go.sum lines
+rm go.sum
+go get -x -d rsc.io/quote
+! stderr github
+stderr proxy.golang.org/rsc.io/quote
+stderr sum.golang.org/tile
+stderr sum.golang.org/lookup/rsc.io/quote
+
+# test fallback to direct
+env TESTGOPROXY404=1
+go get -x -d rsc.io/quote
+stderr 'proxy.golang.org.*404 testing'
+stderr github.com/rsc
-- go.mod --
module m
diff --git a/src/cmd/go/testdata/script/mod_sumdb_proxy.txt b/src/cmd/go/testdata/script/mod_sumdb_proxy.txt
index 0702de2230..6fbf7aeb8a 100644
--- a/src/cmd/go/testdata/script/mod_sumdb_proxy.txt
+++ b/src/cmd/go/testdata/script/mod_sumdb_proxy.txt
@@ -5,23 +5,26 @@ env GOPROXY GONOPROXY GOSUMDB GONOSUMDB
# basic fetch (through proxy) works
cp go.mod.orig go.mod
-go get -m rsc.io/fortune@v1.0.0 # note: must use test proxy, does not exist in real world
+go get -d rsc.io/fortune@v1.0.0 # note: must use test proxy, does not exist in real world
rm $GOPATH/pkg/mod/download/cache/sumdb # rm sumdb cache but NOT package download cache
rm go.sum
# can fetch by explicit URL
cp go.mod.orig go.mod
env GOSUMDB=$sumdb' '$proxy/sumdb-direct
-go get -m rsc.io/fortune@v1.0.0
+go get -d rsc.io/fortune@v1.0.0
rm $GOPATH/pkg/mod/download/cache/sumdb
rm go.sum
# direct access fails (because localhost.localdev does not exist)
+# The text of the error message is hard to predict because some DNS servers
+# will resolve unknown domains like localhost.localdev to a real IP
+# to serve ads.
cp go.mod.orig go.mod
env GOSUMDB=$sumdb
env GOPROXY=direct
-! go get -m rsc.io/fortune@v1.0.0
-stderr 'verifying.*lookup.*localhost.localdev'
+! go get -d rsc.io/fortune@v1.0.0
+stderr 'verifying.*localhost.localdev'
rm $GOPATH/pkg/mod/download/cache/sumdb
rm go.sum
@@ -29,8 +32,8 @@ rm go.sum
cp go.mod.orig go.mod
env GOSUMDB=$sumdb
env GOPROXY=$proxy/sumdb-404
-! go get -m rsc.io/fortune@v1.0.0
-stderr 'verifying.*lookup.*localhost.localdev'
+! go get -d rsc.io/fortune@v1.0.0
+stderr 'verifying.*localhost.localdev'
rm $GOPATH/pkg/mod/download/cache/sumdb
rm go.sum
@@ -38,7 +41,7 @@ rm go.sum
cp go.mod.orig go.mod
env GOSUMDB=$sumdb
env GOPROXY=$proxy/sumdb-503
-! go get -m rsc.io/fortune@v1.0.0
+! go get -d rsc.io/fortune@v1.0.0
stderr '503 Service Unavailable'
rm $GOPATH/pkg/mod/download/cache/sumdb
rm go.sum
diff --git a/src/cmd/go/testdata/script/mod_upgrade_patch_pkg.txt b/src/cmd/go/testdata/script/mod_upgrade_patch.txt
similarity index 91%
rename from src/cmd/go/testdata/script/mod_upgrade_patch_pkg.txt
rename to src/cmd/go/testdata/script/mod_upgrade_patch.txt
index 9b6dd3795d..3939e54c1b 100644
--- a/src/cmd/go/testdata/script/mod_upgrade_patch_pkg.txt
+++ b/src/cmd/go/testdata/script/mod_upgrade_patch.txt
@@ -76,6 +76,13 @@ stderr 'cannot use pattern .* with explicit version'
# However, standard-library packages without explicit versions are fine.
go get -d -u=patch -d cmd/go
+# We can upgrade to a new version of a module with no root package.
+go get -d example.com/noroot@v1.0.0
+go list -m all
+stdout '^example.com/noroot v1.0.0$'
+go get -d example.com/noroot@patch
+go list -m all
+stdout '^example.com/noroot v1.0.1$'
-- go.mod --
module x
diff --git a/src/cmd/go/testdata/script/mod_upgrade_patch_mod.txt b/src/cmd/go/testdata/script/mod_upgrade_patch_mod.txt
deleted file mode 100644
index a539000964..0000000000
--- a/src/cmd/go/testdata/script/mod_upgrade_patch_mod.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-env GO111MODULE=on
-[short] skip
-
-# Initially, we are at v1.0.0 for all dependencies.
-cp go.mod go.mod.orig
-go list -m all
-stdout '^patch.example.com/direct v1.0.0'
-stdout '^patch.example.com/indirect v1.0.0'
-! stdout '^patch.example.com/depofdirectpatch'
-
-# get -m -u=patch, with no arguments, should patch-update all dependencies,
-# pulling in transitive dependencies and also patching those.
-cp go.mod.orig go.mod
-go get -m -u=patch
-go list -m all
-stdout '^patch.example.com/direct v1.0.1'
-stdout '^patch.example.com/indirect v1.0.1'
-stdout '^patch.example.com/depofdirectpatch v1.0.0'
-
-# 'get -m all@patch' should be equivalent to 'get -u=patch -m all'
-cp go.mod.orig go.mod
-go get -m all@patch
-go list -m all
-stdout '^patch.example.com/direct v1.0.1'
-stdout '^patch.example.com/indirect v1.0.1'
-stdout '^patch.example.com/depofdirectpatch v1.0.0'
-
-# Requesting the direct dependency with -u=patch but without an explicit version
-# should patch-update it and its dependencies.
-cp go.mod.orig go.mod
-go get -m -u=patch patch.example.com/direct
-go list -m all
-stdout '^patch.example.com/direct v1.0.1'
-stdout '^patch.example.com/indirect v1.0.1'
-stdout '^patch.example.com/depofdirectpatch v1.0.1'
-
-# Requesting only the indirect dependency should not update the direct one.
-cp go.mod.orig go.mod
-go get -m -u=patch patch.example.com/indirect
-go list -m all
-stdout '^patch.example.com/direct v1.0.0'
-stdout '^patch.example.com/indirect v1.0.1'
-! stdout '^patch.example.com/depofdirectpatch'
-
-# @patch should apply only to the specific module.
-# but the result must reflect its upgraded requirements.
-cp go.mod.orig go.mod
-go get -m patch.example.com/direct@patch
-go list -m all
-stdout '^patch.example.com/direct v1.0.1'
-stdout '^patch.example.com/indirect v1.0.0'
-stdout '^patch.example.com/depofdirectpatch v1.0.0'
-
-# An explicit @patch should override a general -u.
-cp go.mod.orig go.mod
-go get -m -u patch.example.com/direct@patch
-go list -m all
-stdout '^patch.example.com/direct v1.0.1'
-stdout '^patch.example.com/indirect v1.1.0'
-stdout '^patch.example.com/depofdirectpatch v1.0.1'
-
-# An explicit @latest should override a general -u=patch.
-cp go.mod.orig go.mod
-go get -m -u=patch patch.example.com/direct@latest
-go list -m all
-stdout '^patch.example.com/direct v1.1.0'
-stdout '^patch.example.com/indirect v1.0.1'
-! stdout '^patch.example.com/depofdirectpatch'
-
-# Standard-library modules cannot be upgraded explicitly.
-cp go.mod.orig go.mod
-! go get -m std@patch
-stderr 'explicit requirement on standard-library module std not allowed'
-
-
--- go.mod --
-module x
-
-require patch.example.com/direct v1.0.0
-
--- main.go --
-package x
-import _ "patch.example.com/direct"
diff --git a/src/cmd/go/testdata/script/mod_vcs_missing.txt b/src/cmd/go/testdata/script/mod_vcs_missing.txt
index 009bb91c3c..a755935b53 100644
--- a/src/cmd/go/testdata/script/mod_vcs_missing.txt
+++ b/src/cmd/go/testdata/script/mod_vcs_missing.txt
@@ -2,7 +2,7 @@
[!net] skip
env GO111MODULE=on
-env GOPROXY=
+env GOPROXY=direct
cd empty
! go list launchpad.net/gocheck
diff --git a/src/cmd/go/testdata/script/prevent_sys_unix_import.txt b/src/cmd/go/testdata/script/prevent_sys_unix_import.txt
new file mode 100644
index 0000000000..ea1ad78d71
--- /dev/null
+++ b/src/cmd/go/testdata/script/prevent_sys_unix_import.txt
@@ -0,0 +1,6 @@
+# Policy decision: we shouldn't vendor golang.org/x/sys/unix in std
+# See https://golang.org/issue/32102
+
+env GO111MODULE=on
+go list std
+! stdout vendor/golang.org/x/sys/unix
diff --git a/src/cmd/go/testdata/script/test_devnull.txt b/src/cmd/go/testdata/script/test_devnull.txt
index e7ebda33ee..33071679a2 100644
--- a/src/cmd/go/testdata/script/test_devnull.txt
+++ b/src/cmd/go/testdata/script/test_devnull.txt
@@ -4,7 +4,7 @@ env GO111MODULE=off
# should work (see golang.org/issue/28035).
cd x
go test -o=$devnull -c
-! exists x.test$exe
+! exists x.test$GOEXE
-- x/x_test.go --
package x_test
diff --git a/src/cmd/go/vendor_test.go b/src/cmd/go/vendor_test.go
index c302d7e9b5..8b67de06ca 100644
--- a/src/cmd/go/vendor_test.go
+++ b/src/cmd/go/vendor_test.go
@@ -181,6 +181,7 @@ func TestVendorGet(t *testing.T) {
func TestVendorGetUpdate(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -192,6 +193,7 @@ func TestVendorGetUpdate(t *testing.T) {
func TestVendorGetU(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -202,6 +204,7 @@ func TestVendorGetU(t *testing.T) {
func TestVendorGetTU(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -212,6 +215,7 @@ func TestVendorGetTU(t *testing.T) {
func TestVendorGetBadVendor(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
for _, suffix := range []string{"bad/imp", "bad/imp2", "bad/imp3", "..."} {
t.Run(suffix, func(t *testing.T) {
@@ -228,6 +232,7 @@ func TestVendorGetBadVendor(t *testing.T) {
func TestGetSubmodules(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -248,6 +253,7 @@ func TestVendorCache(t *testing.T) {
func TestVendorTest2(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -273,6 +279,7 @@ func TestVendorTest2(t *testing.T) {
func TestVendorTest3(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -299,6 +306,7 @@ func TestVendorTest3(t *testing.T) {
func TestVendorList(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
@@ -349,6 +357,7 @@ func TestLegacyMod(t *testing.T) {
func TestLegacyModGet(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
+ testenv.MustHaveExecPath(t, "git")
tg := testgo(t)
defer tg.cleanup()
diff --git a/src/cmd/internal/obj/wasm/a.out.go b/src/cmd/internal/obj/wasm/a.out.go
index c686f1d6f0..823777d4fb 100644
--- a/src/cmd/internal/obj/wasm/a.out.go
+++ b/src/cmd/internal/obj/wasm/a.out.go
@@ -250,9 +250,7 @@ const (
const (
// globals
- REG_PC_F = obj.RBaseWasm + iota
- REG_PC_B
- REG_SP // SP is currently 32-bit, until 64-bit memory operations are available
+ REG_SP = obj.RBaseWasm + iota // SP is currently 32-bit, until 64-bit memory operations are available
REG_CTXT
REG_g
// RET* are used by runtime.return0 and runtime.reflectcall. These functions pass return values in registers.
@@ -296,9 +294,11 @@ const (
REG_F14
REG_F15
+ REG_PC_B // also first parameter, i32
+
MAXREG
- MINREG = REG_PC_F
+ MINREG = REG_SP
REGSP = REG_SP
REGCTXT = REG_CTXT
REGG = REG_g
diff --git a/src/cmd/internal/obj/wasm/wasmobj.go b/src/cmd/internal/obj/wasm/wasmobj.go
index 0ad883470e..a6388b9ee7 100644
--- a/src/cmd/internal/obj/wasm/wasmobj.go
+++ b/src/cmd/internal/obj/wasm/wasmobj.go
@@ -16,8 +16,6 @@ import (
)
var Register = map[string]int16{
- "PC_F": REG_PC_F,
- "PC_B": REG_PC_B,
"SP": REG_SP,
"CTXT": REG_CTXT,
"g": REG_g,
@@ -60,6 +58,8 @@ var Register = map[string]int16{
"F13": REG_F13,
"F14": REG_F14,
"F15": REG_F15,
+
+ "PC_B": REG_PC_B,
}
var registerNames []string
@@ -368,20 +368,31 @@ func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
break
}
- // reset PC_B to function entry
- p = appendp(p, AI32Const, constAddr(0))
- p = appendp(p, ASet, regAddr(REG_PC_B))
-
// low-level WebAssembly call to function
switch jmp.To.Type {
case obj.TYPE_MEM:
+ if !notUsePC_B[jmp.To.Sym.Name] {
+ // Set PC_B parameter to function entry.
+ p = appendp(p, AI32Const, constAddr(0))
+ }
p = appendp(p, ACall, jmp.To)
+
case obj.TYPE_NONE:
// (target PC is on stack)
p = appendp(p, AI32WrapI64)
p = appendp(p, AI32Const, constAddr(16)) // only needs PC_F bits (16-31), PC_B bits (0-15) are zero
p = appendp(p, AI32ShrU)
+
+ // Set PC_B parameter to function entry.
+ // We need to push this before pushing the target PC_F,
+ // so temporarily pop PC_F, using our REG_PC_B as a
+ // scratch register, and push it back after pushing 0.
+ p = appendp(p, ASet, regAddr(REG_PC_B))
+ p = appendp(p, AI32Const, constAddr(0))
+ p = appendp(p, AGet, regAddr(REG_PC_B))
+
p = appendp(p, ACallIndirect)
+
default:
panic("bad target for JMP")
}
@@ -419,20 +430,31 @@ func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
})
p = appendp(p, AI64Store, constAddr(0))
- // reset PC_B to function entry
- p = appendp(p, AI32Const, constAddr(0))
- p = appendp(p, ASet, regAddr(REG_PC_B))
-
// low-level WebAssembly call to function
switch call.To.Type {
case obj.TYPE_MEM:
+ if !notUsePC_B[call.To.Sym.Name] {
+ // Set PC_B parameter to function entry.
+ p = appendp(p, AI32Const, constAddr(0))
+ }
p = appendp(p, ACall, call.To)
+
case obj.TYPE_NONE:
// (target PC is on stack)
p = appendp(p, AI32WrapI64)
p = appendp(p, AI32Const, constAddr(16)) // only needs PC_F bits (16-31), PC_B bits (0-15) are zero
p = appendp(p, AI32ShrU)
+
+ // Set PC_B parameter to function entry.
+ // We need to push this before pushing the target PC_F,
+ // so temporarily pop PC_F, using our PC_B as a
+ // scratch register, and push it back after pushing 0.
+ p = appendp(p, ASet, regAddr(REG_PC_B))
+ p = appendp(p, AI32Const, constAddr(0))
+ p = appendp(p, AGet, regAddr(REG_PC_B))
+
p = appendp(p, ACallIndirect)
+
default:
panic("bad target for CALL")
}
@@ -465,7 +487,13 @@ func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
// jump to before the call if jmpdefer has reset the return address to the call's PC
if call.To.Sym == deferreturn {
- p = appendp(p, AGet, regAddr(REG_PC_B))
+ // get PC_B from -8(SP)
+ p = appendp(p, AGet, regAddr(REG_SP))
+ p = appendp(p, AI32Const, constAddr(8))
+ p = appendp(p, AI32Sub)
+ p = appendp(p, AI32Load16U, constAddr(0))
+ p = appendp(p, ATee, regAddr(REG_PC_B))
+
p = appendp(p, AI32Const, constAddr(call.Pc))
p = appendp(p, AI32Eq)
p = appendp(p, ABrIf, constAddr(0))
@@ -487,9 +515,8 @@ func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
}
if ret.To.Type == obj.TYPE_MEM {
- // reset PC_B to function entry
+ // Set PC_B parameter to function entry.
p = appendp(p, AI32Const, constAddr(0))
- p = appendp(p, ASet, regAddr(REG_PC_B))
// low-level WebAssembly call to function
p = appendp(p, ACall, ret.To)
@@ -497,16 +524,6 @@ func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
break
}
- // read return PC_F from Go stack
- p = appendp(p, AGet, regAddr(REG_SP))
- p = appendp(p, AI32Load16U, constAddr(2))
- p = appendp(p, ASet, regAddr(REG_PC_F))
-
- // read return PC_B from Go stack
- p = appendp(p, AGet, regAddr(REG_SP))
- p = appendp(p, AI32Load16U, constAddr(0))
- p = appendp(p, ASet, regAddr(REG_PC_B))
-
// SP += 8
p = appendp(p, AGet, regAddr(REG_SP))
p = appendp(p, AI32Const, constAddr(8))
@@ -771,16 +788,38 @@ func countRegisters(s *obj.LSym) (numI, numF int16) {
return
}
+// Most of the Go functions has a single parameter (PC_B) in
+// Wasm ABI. This is a list of exceptions.
+var notUsePC_B = map[string]bool{
+ "_rt0_wasm_js": true,
+ "wasm_export_run": true,
+ "wasm_export_resume": true,
+ "wasm_export_getsp": true,
+ "wasm_pc_f_loop": true,
+ "runtime.wasmMove": true,
+ "runtime.wasmZero": true,
+ "runtime.wasmDiv": true,
+ "runtime.wasmTruncS": true,
+ "runtime.wasmTruncU": true,
+ "runtime.gcWriteBarrier": true,
+ "cmpbody": true,
+ "memeqbody": true,
+ "memcmp": true,
+ "memchr": true,
+}
+
func assemble(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
w := new(bytes.Buffer)
hasLocalSP := false
+ hasPC_B := false
var r0, f0 int16
// Function starts with declaration of locals: numbers and types.
// Some functions use a special calling convention.
switch s.Name {
- case "wasm_export_run", "runtime.wasmMove", "runtime.wasmZero", "runtime.wasmDiv", "runtime.wasmTruncS", "runtime.wasmTruncU", "memeqbody":
+ case "_rt0_wasm_js", "wasm_export_run", "wasm_export_resume", "wasm_export_getsp", "wasm_pc_f_loop",
+ "runtime.wasmMove", "runtime.wasmZero", "runtime.wasmDiv", "runtime.wasmTruncS", "runtime.wasmTruncU", "memeqbody":
writeUleb128(w, 0) // number of sets of locals
case "memchr", "memcmp":
writeUleb128(w, 1) // number of sets of locals
@@ -797,9 +836,10 @@ func assemble(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
default:
// Normal calling convention: No WebAssembly parameters. First local variable is local SP cache.
hasLocalSP = true
+ hasPC_B = true
numI, numF := countRegisters(s)
- r0 = 1
- f0 = 1 + numI
+ r0 = 2
+ f0 = 2 + numI
numTypes := 1
if numI > 0 {
@@ -826,6 +866,7 @@ func assemble(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
// Copy SP from its global variable into a local variable. Accessing a local variable is more efficient.
updateLocalSP(w)
}
+
for p := s.Func.Text; p != nil; p = p.Link {
switch p.As {
case AGet:
@@ -836,10 +877,16 @@ func assemble(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
switch {
case reg == REG_SP && hasLocalSP:
w.WriteByte(0x20) // local.get
- writeUleb128(w, 0) // local SP
- case reg >= REG_PC_F && reg <= REG_PAUSE:
+ writeUleb128(w, 1) // local SP
+ case reg >= REG_SP && reg <= REG_PAUSE:
w.WriteByte(0x23) // global.get
- writeUleb128(w, uint64(reg-REG_PC_F))
+ writeUleb128(w, uint64(reg-REG_SP))
+ case reg == REG_PC_B:
+ if !hasPC_B {
+ panic(fmt.Sprintf("PC_B is not used in %s", s.Name))
+ }
+ w.WriteByte(0x20) // local.get (i32)
+ writeUleb128(w, 0) // local PC_B
case reg >= REG_R0 && reg <= REG_R15:
w.WriteByte(0x20) // local.get (i64)
writeUleb128(w, uint64(r0+(reg-REG_R0)))
@@ -857,21 +904,26 @@ func assemble(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
}
reg := p.To.Reg
switch {
- case reg >= REG_PC_F && reg <= REG_PAUSE:
+ case reg >= REG_SP && reg <= REG_PAUSE:
if reg == REG_SP && hasLocalSP {
w.WriteByte(0x22) // local.tee
- writeUleb128(w, 0) // local SP
+ writeUleb128(w, 1) // local SP
}
w.WriteByte(0x24) // global.set
- writeUleb128(w, uint64(reg-REG_PC_F))
- case reg >= REG_R0 && reg <= REG_F15:
+ writeUleb128(w, uint64(reg-REG_SP))
+ case reg >= REG_R0 && reg <= REG_PC_B:
if p.Link.As == AGet && p.Link.From.Reg == reg {
w.WriteByte(0x22) // local.tee
p = p.Link
} else {
w.WriteByte(0x21) // local.set
}
- if reg <= REG_R15 {
+ if reg == REG_PC_B {
+ if !hasPC_B {
+ panic(fmt.Sprintf("PC_B is not used in %s", s.Name))
+ }
+ writeUleb128(w, 0) // local PC_B
+ } else if reg <= REG_R15 {
writeUleb128(w, uint64(r0+(reg-REG_R0)))
} else {
writeUleb128(w, uint64(f0+(reg-REG_F0)))
@@ -887,6 +939,12 @@ func assemble(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
}
reg := p.To.Reg
switch {
+ case reg == REG_PC_B:
+ if !hasPC_B {
+ panic(fmt.Sprintf("PC_B is not used in %s", s.Name))
+ }
+ w.WriteByte(0x22) // local.tee (i32)
+ writeUleb128(w, 0) // local PC_B
case reg >= REG_R0 && reg <= REG_R15:
w.WriteByte(0x22) // local.tee (i64)
writeUleb128(w, uint64(r0+(reg-REG_R0)))
@@ -1036,10 +1094,10 @@ func assemble(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
}
func updateLocalSP(w *bytes.Buffer) {
- w.WriteByte(0x23) // global.get
- writeUleb128(w, uint64(REG_SP-REG_PC_F)) // SP
- w.WriteByte(0x21) // local.set
- writeUleb128(w, 0) // local SP
+ w.WriteByte(0x23) // global.get
+ writeUleb128(w, 0) // global SP
+ w.WriteByte(0x21) // local.set
+ writeUleb128(w, 1) // local SP
}
func align(as obj.As) uint64 {
diff --git a/src/cmd/link/dwarf_test.go b/src/cmd/link/dwarf_test.go
index e52e26af49..897b2fc881 100644
--- a/src/cmd/link/dwarf_test.go
+++ b/src/cmd/link/dwarf_test.go
@@ -93,11 +93,13 @@ func testDWARF(t *testing.T, buildmode string, expectDWARF bool, env ...string)
// Ensure Apple's tooling can parse our object for symbols.
out, err = exec.Command("symbols", exe).CombinedOutput()
if err != nil {
- t.Fatal(err)
+ t.Fatalf("symbols %v: %v: %s", filepath.Base(exe), err, out)
} else {
if bytes.HasPrefix(out, []byte("Unable to find file")) {
// This failure will cause the App Store to reject our binaries.
- t.Fatalf("/usr/bin/symbols %v: failed to parse file", filepath.Base(exe))
+ t.Fatalf("symbols %v: failed to parse file", filepath.Base(exe))
+ } else if bytes.Contains(out, []byte(", Empty]")) {
+ t.Fatalf("symbols %v: parsed as empty", filepath.Base(exe))
}
}
}
diff --git a/src/cmd/link/internal/ld/dwarf_test.go b/src/cmd/link/internal/ld/dwarf_test.go
index 190a54c4c3..df193e5d3d 100644
--- a/src/cmd/link/internal/ld/dwarf_test.go
+++ b/src/cmd/link/internal/ld/dwarf_test.go
@@ -1195,3 +1195,26 @@ func TestPackageNameAttr(t *testing.T) {
}
}
}
+
+func TestMachoIssue32233(t *testing.T) {
+ testenv.MustHaveGoBuild(t)
+ testenv.MustHaveCGO(t)
+
+ if runtime.GOOS != "darwin" {
+ t.Skip("skipping; test only interesting on darwin")
+ }
+
+ tmpdir, err := ioutil.TempDir("", "TestMachoIssue32233")
+ if err != nil {
+ t.Fatalf("could not create directory: %v", err)
+ }
+ defer os.RemoveAll(tmpdir)
+
+ wd, err2 := os.Getwd()
+ if err2 != nil {
+ t.Fatalf("where am I? %v", err)
+ }
+ pdir := filepath.Join(wd, "testdata", "issue32233", "main")
+ f := gobuildTestdata(t, tmpdir, pdir, DefaultOpt)
+ f.Close()
+}
diff --git a/src/cmd/link/internal/ld/macho.go b/src/cmd/link/internal/ld/macho.go
index cbf88e43d2..02e133e31d 100644
--- a/src/cmd/link/internal/ld/macho.go
+++ b/src/cmd/link/internal/ld/macho.go
@@ -141,7 +141,7 @@ const (
LC_SUB_LIBRARY = 0x15
LC_TWOLEVEL_HINTS = 0x16
LC_PREBIND_CKSUM = 0x17
- LC_LOAD_WEAK_DYLIB = 0x18
+ LC_LOAD_WEAK_DYLIB = 0x80000018
LC_SEGMENT_64 = 0x19
LC_ROUTINES_64 = 0x1a
LC_UUID = 0x1b
diff --git a/src/cmd/link/internal/ld/macho_combine_dwarf.go b/src/cmd/link/internal/ld/macho_combine_dwarf.go
index dd2ab4c5b0..3c123a092f 100644
--- a/src/cmd/link/internal/ld/macho_combine_dwarf.go
+++ b/src/cmd/link/internal/ld/macho_combine_dwarf.go
@@ -409,6 +409,7 @@ func machoUpdateDwarfHeader(r *loadCmdReader, buildmode BuildMode, compressedSec
segv := reflect.ValueOf(seg).Elem()
segv.FieldByName("Offset").SetUint(uint64(dwarfstart))
segv.FieldByName("Addr").SetUint(uint64(dwarfaddr))
+ segv.FieldByName("Prot").SetUint(0)
if compressedSects != nil {
var segSize uint64
diff --git a/src/cmd/link/internal/ld/pcln.go b/src/cmd/link/internal/ld/pcln.go
index 6c0a9e9ebc..cd8151022a 100644
--- a/src/cmd/link/internal/ld/pcln.go
+++ b/src/cmd/link/internal/ld/pcln.go
@@ -318,7 +318,7 @@ func (ctxt *Link) pclntab() {
// set the resumption point to PC_B.
lastWasmAddr = uint32(r.Add)
}
- if r.Sym != nil && r.Sym.Name == "runtime.deferreturn" && r.Add == 0 {
+ if r.Type.IsDirectJump() && r.Sym != nil && r.Sym.Name == "runtime.deferreturn" {
if ctxt.Arch.Family == sys.Wasm {
deferreturn = lastWasmAddr
} else {
diff --git a/src/cmd/link/internal/ld/pe.go b/src/cmd/link/internal/ld/pe.go
index ca29da4f01..032968f983 100644
--- a/src/cmd/link/internal/ld/pe.go
+++ b/src/cmd/link/internal/ld/pe.go
@@ -833,18 +833,18 @@ func (f *peFile) writeOptionalHeader(ctxt *Link) {
oh.SectionAlignment = uint32(PESECTALIGN)
oh64.FileAlignment = uint32(PEFILEALIGN)
oh.FileAlignment = uint32(PEFILEALIGN)
- oh64.MajorOperatingSystemVersion = 4
- oh.MajorOperatingSystemVersion = 4
- oh64.MinorOperatingSystemVersion = 0
- oh.MinorOperatingSystemVersion = 0
+ oh64.MajorOperatingSystemVersion = 6
+ oh.MajorOperatingSystemVersion = 6
+ oh64.MinorOperatingSystemVersion = 1
+ oh.MinorOperatingSystemVersion = 1
oh64.MajorImageVersion = 1
oh.MajorImageVersion = 1
oh64.MinorImageVersion = 0
oh.MinorImageVersion = 0
- oh64.MajorSubsystemVersion = 4
- oh.MajorSubsystemVersion = 4
- oh64.MinorSubsystemVersion = 0
- oh.MinorSubsystemVersion = 0
+ oh64.MajorSubsystemVersion = 6
+ oh.MajorSubsystemVersion = 6
+ oh64.MinorSubsystemVersion = 1
+ oh.MinorSubsystemVersion = 1
oh64.SizeOfImage = f.nextSectOffset
oh.SizeOfImage = f.nextSectOffset
oh64.SizeOfHeaders = uint32(PEFILEHEADR)
diff --git a/src/cmd/link/internal/ld/testdata/issue32233/lib/ObjC.m b/src/cmd/link/internal/ld/testdata/issue32233/lib/ObjC.m
new file mode 100644
index 0000000000..946278803e
--- /dev/null
+++ b/src/cmd/link/internal/ld/testdata/issue32233/lib/ObjC.m
@@ -0,0 +1,16 @@
+// Copyright 2019 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.
+
+#import
+#import
+
+BOOL function(void) {
+#if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && (MAC_OS_X_VERSION_MIN_REQUIRED > 101300)
+ NSAppearance *darkAppearance;
+ if (@available(macOS 10.14, *)) {
+ darkAppearance = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
+ }
+#endif
+ return NO;
+}
diff --git a/src/cmd/link/internal/ld/testdata/issue32233/lib/lib.go b/src/cmd/link/internal/ld/testdata/issue32233/lib/lib.go
new file mode 100644
index 0000000000..514b9b9a4a
--- /dev/null
+++ b/src/cmd/link/internal/ld/testdata/issue32233/lib/lib.go
@@ -0,0 +1,19 @@
+// Copyright 2019 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 lib
+
+/*
+#cgo darwin CFLAGS: -D__MAC_OS_X_VERSION_MAX_ALLOWED=101450
+#cgo darwin LDFLAGS: -framework Foundation -framework AppKit
+#include "stdlib.h"
+int function(void);
+*/
+import "C"
+import "fmt"
+
+func DoC() {
+ C.function()
+ fmt.Println("called c function")
+}
diff --git a/src/cmd/go/internal/renameio/error.go b/src/cmd/link/internal/ld/testdata/issue32233/main/main.go
similarity index 51%
rename from src/cmd/go/internal/renameio/error.go
rename to src/cmd/link/internal/ld/testdata/issue32233/main/main.go
index 14943e3e6e..ed0838afab 100644
--- a/src/cmd/go/internal/renameio/error.go
+++ b/src/cmd/link/internal/ld/testdata/issue32233/main/main.go
@@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !windows
+package main
-package renameio
+import "cmd/link/internal/ld/testdata/issue32233/lib"
-// isAccessDeniedError always returns false on non-windows.
-func isAccessDeniedError(err error) bool {
- return false
+func main() {
+ lib.DoC()
}
diff --git a/src/cmd/link/internal/sym/symkind_string.go b/src/cmd/link/internal/sym/symkind_string.go
index 9c8e1569f6..0e854c334e 100644
--- a/src/cmd/link/internal/sym/symkind_string.go
+++ b/src/cmd/link/internal/sym/symkind_string.go
@@ -4,9 +4,67 @@ package sym
import "strconv"
-const _SymKind_name = "SxxxSTEXTSELFRXSECTSTYPESSTRINGSGOSTRINGSGOFUNCSGCBITSSRODATASFUNCTABSELFROSECTSMACHOPLTSTYPERELROSSTRINGRELROSGOSTRINGRELROSGOFUNCRELROSGCBITSRELROSRODATARELROSFUNCTABRELROSTYPELINKSITABLINKSSYMTABSPCLNTABSELFSECTSMACHOSMACHOGOTSWINDOWSSELFGOTSNOPTRDATASINITARRSDATASXCOFFTOCSBSSSNOPTRBSSSTLSBSSSXREFSMACHOSYMSTRSMACHOSYMTABSMACHOINDIRECTPLTSMACHOINDIRECTGOTSFILEPATHSCONSTSDYNIMPORTSHOSTOBJSDWARFSECTSDWARFINFOSDWARFRANGESDWARFLOCSDWARFMISCSABIALIAS"
+func _() {
+ // An "invalid array index" compiler error signifies that the constant values have changed.
+ // Re-run the stringer command to generate them again.
+ var x [1]struct{}
+ _ = x[Sxxx-0]
+ _ = x[STEXT-1]
+ _ = x[SELFRXSECT-2]
+ _ = x[STYPE-3]
+ _ = x[SSTRING-4]
+ _ = x[SGOSTRING-5]
+ _ = x[SGOFUNC-6]
+ _ = x[SGCBITS-7]
+ _ = x[SRODATA-8]
+ _ = x[SFUNCTAB-9]
+ _ = x[SELFROSECT-10]
+ _ = x[SMACHOPLT-11]
+ _ = x[STYPERELRO-12]
+ _ = x[SSTRINGRELRO-13]
+ _ = x[SGOSTRINGRELRO-14]
+ _ = x[SGOFUNCRELRO-15]
+ _ = x[SGCBITSRELRO-16]
+ _ = x[SRODATARELRO-17]
+ _ = x[SFUNCTABRELRO-18]
+ _ = x[STYPELINK-19]
+ _ = x[SITABLINK-20]
+ _ = x[SSYMTAB-21]
+ _ = x[SPCLNTAB-22]
+ _ = x[SFirstWritable-23]
+ _ = x[SBUILDINFO-24]
+ _ = x[SELFSECT-25]
+ _ = x[SMACHO-26]
+ _ = x[SMACHOGOT-27]
+ _ = x[SWINDOWS-28]
+ _ = x[SELFGOT-29]
+ _ = x[SNOPTRDATA-30]
+ _ = x[SINITARR-31]
+ _ = x[SDATA-32]
+ _ = x[SXCOFFTOC-33]
+ _ = x[SBSS-34]
+ _ = x[SNOPTRBSS-35]
+ _ = x[STLSBSS-36]
+ _ = x[SXREF-37]
+ _ = x[SMACHOSYMSTR-38]
+ _ = x[SMACHOSYMTAB-39]
+ _ = x[SMACHOINDIRECTPLT-40]
+ _ = x[SMACHOINDIRECTGOT-41]
+ _ = x[SFILEPATH-42]
+ _ = x[SCONST-43]
+ _ = x[SDYNIMPORT-44]
+ _ = x[SHOSTOBJ-45]
+ _ = x[SDWARFSECT-46]
+ _ = x[SDWARFINFO-47]
+ _ = x[SDWARFRANGE-48]
+ _ = x[SDWARFLOC-49]
+ _ = x[SDWARFMISC-50]
+ _ = x[SABIALIAS-51]
+}
-var _SymKind_index = [...]uint16{0, 4, 9, 19, 24, 31, 40, 47, 54, 61, 69, 79, 88, 98, 110, 124, 136, 148, 160, 173, 182, 191, 198, 206, 214, 220, 229, 237, 244, 254, 262, 267, 276, 280, 289, 296, 301, 313, 325, 342, 359, 368, 374, 384, 392, 402, 412, 423, 432, 442, 451}
+const _SymKind_name = "SxxxSTEXTSELFRXSECTSTYPESSTRINGSGOSTRINGSGOFUNCSGCBITSSRODATASFUNCTABSELFROSECTSMACHOPLTSTYPERELROSSTRINGRELROSGOSTRINGRELROSGOFUNCRELROSGCBITSRELROSRODATARELROSFUNCTABRELROSTYPELINKSITABLINKSSYMTABSPCLNTABSFirstWritableSBUILDINFOSELFSECTSMACHOSMACHOGOTSWINDOWSSELFGOTSNOPTRDATASINITARRSDATASXCOFFTOCSBSSSNOPTRBSSSTLSBSSSXREFSMACHOSYMSTRSMACHOSYMTABSMACHOINDIRECTPLTSMACHOINDIRECTGOTSFILEPATHSCONSTSDYNIMPORTSHOSTOBJSDWARFSECTSDWARFINFOSDWARFRANGESDWARFLOCSDWARFMISCSABIALIAS"
+
+var _SymKind_index = [...]uint16{0, 4, 9, 19, 24, 31, 40, 47, 54, 61, 69, 79, 88, 98, 110, 124, 136, 148, 160, 173, 182, 191, 198, 206, 220, 230, 238, 244, 253, 261, 268, 278, 286, 291, 300, 304, 313, 320, 325, 337, 349, 366, 383, 392, 398, 408, 416, 426, 436, 447, 456, 466, 475}
func (i SymKind) String() string {
if i >= SymKind(len(_SymKind_index)-1) {
diff --git a/src/cmd/link/internal/wasm/asm.go b/src/cmd/link/internal/wasm/asm.go
index c80e81e5b3..54b265cb19 100644
--- a/src/cmd/link/internal/wasm/asm.go
+++ b/src/cmd/link/internal/wasm/asm.go
@@ -102,10 +102,11 @@ func asmb2(ctxt *ld.Link) {
}
types := []*wasmFuncType{
- // For normal Go functions the return value is
+ // For normal Go functions, the single parameter is PC_B,
+ // the return value is
// 0 if the function returned normally or
// 1 if the stack needs to be unwound.
- {Results: []byte{I32}},
+ {Params: []byte{I32}, Results: []byte{I32}},
}
// collect host imports (functions that get imported from the WebAssembly host, usually JavaScript)
@@ -320,16 +321,14 @@ func writeGlobalSec(ctxt *ld.Link) {
sizeOffset := writeSecHeader(ctxt, sectionGlobal)
globalRegs := []byte{
- I32, // 0: PC_F
- I32, // 1: PC_B
- I32, // 2: SP
- I64, // 3: CTXT
- I64, // 4: g
- I64, // 5: RET0
- I64, // 6: RET1
- I64, // 7: RET2
- I64, // 8: RET3
- I32, // 9: PAUSE
+ I32, // 0: SP
+ I64, // 1: CTXT
+ I64, // 2: g
+ I64, // 3: RET0
+ I64, // 4: RET1
+ I64, // 5: RET2
+ I64, // 6: RET3
+ I32, // 7: PAUSE
}
writeUleb128(ctxt.Out, uint64(len(globalRegs))) // number of globals
diff --git a/src/cmd/vendor/github.com/google/pprof/CONTRIBUTORS b/src/cmd/vendor/github.com/google/pprof/CONTRIBUTORS
index 0ef5e2f240..8c8c37d2c8 100644
--- a/src/cmd/vendor/github.com/google/pprof/CONTRIBUTORS
+++ b/src/cmd/vendor/github.com/google/pprof/CONTRIBUTORS
@@ -13,3 +13,4 @@ Tipp Moseley
Hyoun Kyu Cho
Martin Spier
Taco de Wolff
+Andrew Hunter
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go b/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go
index 309561112c..967726d1fa 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go
@@ -322,7 +322,7 @@ func (b *binrep) openELF(name string, start, limit, offset uint64) (plugin.ObjFi
// someone passes a kernel path that doesn't contain "vmlinux" AND
// (2) _stext is page-aligned AND (3) _stext is not at Vaddr
symbols, err := ef.Symbols()
- if err != nil {
+ if err != nil && err != elf.ErrNoSymbols {
return nil, err
}
for _, s := range symbols {
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/cli.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/cli.go
index dfedf9d849..9fc1eea1f0 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/cli.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/cli.go
@@ -32,14 +32,15 @@ type source struct {
DiffBase bool
Normalize bool
- Seconds int
- Timeout int
- Symbolize string
- HTTPHostport string
- Comment string
+ Seconds int
+ Timeout int
+ Symbolize string
+ HTTPHostport string
+ HTTPDisableBrowser bool
+ Comment string
}
-// Parse parses the command lines through the specified flags package
+// parseFlags parses the command lines through the specified flags package
// and returns the source of the profile and optionally the command
// for the kind of report to generate (nil for interactive use).
func parseFlags(o *plugin.Options) (*source, []string, error) {
@@ -65,7 +66,8 @@ func parseFlags(o *plugin.Options) (*source, []string, error) {
flagMeanDelay := flag.Bool("mean_delay", false, "Display mean delay at each region")
flagTools := flag.String("tools", os.Getenv("PPROF_TOOLS"), "Path for object tool pathnames")
- flagHTTP := flag.String("http", "", "Present interactive web based UI at the specified http host:port")
+ flagHTTP := flag.String("http", "", "Present interactive web UI at the specified http host:port")
+ flagNoBrowser := flag.Bool("no_browser", false, "Skip opening a browswer for the interactive web UI")
// Flags used during command processing
installedFlags := installFlags(flag)
@@ -118,6 +120,10 @@ func parseFlags(o *plugin.Options) (*source, []string, error) {
return nil, nil, errors.New("-http is not compatible with an output format on the command line")
}
+ if *flagNoBrowser && *flagHTTP == "" {
+ return nil, nil, errors.New("-no_browser only makes sense with -http")
+ }
+
si := pprofVariables["sample_index"].value
si = sampleIndex(flagTotalDelay, si, "delay", "-total_delay", o.UI)
si = sampleIndex(flagMeanDelay, si, "delay", "-mean_delay", o.UI)
@@ -133,14 +139,15 @@ func parseFlags(o *plugin.Options) (*source, []string, error) {
}
source := &source{
- Sources: args,
- ExecName: execName,
- BuildID: *flagBuildID,
- Seconds: *flagSeconds,
- Timeout: *flagTimeout,
- Symbolize: *flagSymbolize,
- HTTPHostport: *flagHTTP,
- Comment: *flagAddComment,
+ Sources: args,
+ ExecName: execName,
+ BuildID: *flagBuildID,
+ Seconds: *flagSeconds,
+ Timeout: *flagTimeout,
+ Symbolize: *flagSymbolize,
+ HTTPHostport: *flagHTTP,
+ HTTPDisableBrowser: *flagNoBrowser,
+ Comment: *flagAddComment,
}
if err := source.addBaseProfiles(*flagBase, *flagDiffBase); err != nil {
@@ -327,9 +334,10 @@ var usageMsgSrc = "\n\n" +
var usageMsgVars = "\n\n" +
" Misc options:\n" +
- " -http Provide web based interface at host:port.\n" +
+ " -http Provide web interface at host:port.\n" +
" Host is optional and 'localhost' by default.\n" +
" Port is optional and a randomly available port by default.\n" +
+ " -no_browser Skip opening a browser for the interactive web UI.\n" +
" -tools Search path for object tools\n" +
"\n" +
" Legacy convenience options:\n" +
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/commands.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/commands.go
index ab073d878d..f52471490a 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/commands.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/commands.go
@@ -385,7 +385,7 @@ func invokeDot(format string) PostProcessor {
cmd := exec.Command("dot", "-T"+format)
cmd.Stdin, cmd.Stdout, cmd.Stderr = input, output, os.Stderr
if err := cmd.Run(); err != nil {
- return fmt.Errorf("Failed to execute dot. Is Graphviz installed? Error: %v", err)
+ return fmt.Errorf("failed to execute dot. Is Graphviz installed? Error: %v", err)
}
return nil
}
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go
index 45f1846749..1be749aa32 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go
@@ -54,7 +54,7 @@ func PProf(eo *plugin.Options) error {
}
if src.HTTPHostport != "" {
- return serveWebInterface(src.HTTPHostport, p, o)
+ return serveWebInterface(src.HTTPHostport, p, o, src.HTTPDisableBrowser)
}
return interactive(p, o)
}
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go
index bea9cfaf98..551965e776 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go
@@ -173,7 +173,7 @@ func parseTagFilterRange(filter string) func(int64, string) bool {
}
v, err := strconv.ParseInt(ranges[0][1], 10, 64)
if err != nil {
- panic(fmt.Errorf("Failed to parse int %s: %v", ranges[0][1], err))
+ panic(fmt.Errorf("failed to parse int %s: %v", ranges[0][1], err))
}
scaledValue, unit := measurement.Scale(v, ranges[0][2], ranges[0][2])
if len(ranges) == 1 {
@@ -200,7 +200,7 @@ func parseTagFilterRange(filter string) func(int64, string) bool {
return nil
}
if v, err = strconv.ParseInt(ranges[1][1], 10, 64); err != nil {
- panic(fmt.Errorf("Failed to parse int %s: %v", ranges[1][1], err))
+ panic(fmt.Errorf("failed to parse int %s: %v", ranges[1][1], err))
}
scaledValue2, unit2 := measurement.Scale(v, ranges[1][2], unit)
if unit != unit2 {
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go
index bebfbbec1e..3a458b0b77 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go
@@ -91,7 +91,7 @@ func interactive(p *profile.Profile, o *plugin.Options) error {
}
continue
} else if okValues := groups[name]; okValues != nil {
- o.UI.PrintErr(fmt.Errorf("Unrecognized value for %s: %q. Use one of %s", name, value, strings.Join(okValues, ", ")))
+ o.UI.PrintErr(fmt.Errorf("unrecognized value for %s: %q. Use one of %s", name, value, strings.Join(okValues, ", ")))
continue
}
}
@@ -267,7 +267,7 @@ func parseCommandLine(input []string) ([]string, variables, error) {
}
}
if c == nil {
- return nil, nil, fmt.Errorf("Unrecognized command: %q", name)
+ return nil, nil, fmt.Errorf("unrecognized command: %q", name)
}
if c.hasParam {
@@ -294,7 +294,7 @@ func parseCommandLine(input []string) ([]string, variables, error) {
if outputFile == "" {
i++
if i >= len(args) {
- return nil, nil, fmt.Errorf("Unexpected end of line after >")
+ return nil, nil, fmt.Errorf("unexpected end of line after >")
}
outputFile = args[i]
}
@@ -407,7 +407,7 @@ func newCompleter(fns []string) func(string) string {
}
}
-// matchCommand attempts to match a string token to the prefix of a Command.
+// matchVariableOrCommand attempts to match a string token to the prefix of a Command.
func matchVariableOrCommand(v variables, token string) string {
token = strings.ToLower(token)
found := ""
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
index 74104899ca..f1077dd044 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
@@ -853,7 +853,7 @@ function viewer(baseUrl, nodes) {
toptable.addEventListener('touchstart', handleTopClick);
}
- const ids = ['topbtn', 'graphbtn', 'peek', 'list', 'disasm',
+ const ids = ['topbtn', 'graphbtn', 'flamegraph', 'peek', 'list', 'disasm',
'focus', 'ignore', 'hide', 'show', 'show-from'];
ids.forEach(makeSearchLinkDynamic);
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go
index 9bf1d70f16..5c7f449e4b 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/webui.go
@@ -82,7 +82,7 @@ type webArgs struct {
FlameGraph template.JS
}
-func serveWebInterface(hostport string, p *profile.Profile, o *plugin.Options) error {
+func serveWebInterface(hostport string, p *profile.Profile, o *plugin.Options, disableBrowser bool) error {
host, port, err := getHostAndPort(hostport)
if err != nil {
return err
@@ -117,8 +117,12 @@ func serveWebInterface(hostport string, p *profile.Profile, o *plugin.Options) e
},
}
- if o.UI.WantBrowser() {
- go openBrowser("http://"+args.Hostport, o)
+ url := "http://" + args.Hostport
+
+ o.UI.Print("Serving web UI on ", url)
+
+ if o.UI.WantBrowser() && !disableBrowser {
+ go openBrowser(url, o)
}
return server(args)
}
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go b/src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go
index 03083baf12..d520765cc9 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go
@@ -241,10 +241,10 @@ func GetBase(fh *elf.FileHeader, loadSegment *elf.ProgHeader, stextOffset *uint6
return start - *stextOffset, nil
}
- return 0, fmt.Errorf("Don't know how to handle EXEC segment: %v start=0x%x limit=0x%x offset=0x%x", *loadSegment, start, limit, offset)
+ return 0, fmt.Errorf("don't know how to handle EXEC segment: %v start=0x%x limit=0x%x offset=0x%x", *loadSegment, start, limit, offset)
case elf.ET_REL:
if offset != 0 {
- return 0, fmt.Errorf("Don't know how to handle mapping.Offset")
+ return 0, fmt.Errorf("don't know how to handle mapping.Offset")
}
return start, nil
case elf.ET_DYN:
@@ -265,7 +265,7 @@ func GetBase(fh *elf.FileHeader, loadSegment *elf.ProgHeader, stextOffset *uint6
// sx = x - start + offset - loadSegment.Off + loadSegment.Vaddr.
return start - offset + loadSegment.Off - loadSegment.Vaddr, nil
}
- return 0, fmt.Errorf("Don't know how to handle FileHeader.Type %v", fh.Type)
+ return 0, fmt.Errorf("don't know how to handle FileHeader.Type %v", fh.Type)
}
// FindTextProgHeader finds the program segment header containing the .text
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go b/src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go
index 3e3bcb8c25..e95b261bc2 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go
@@ -321,8 +321,7 @@ func timeLabel(value int64, fromUnit, toUnit string) (v float64, u string, ok bo
case "year", "yr":
output, toUnit = dd/float64(365*24*time.Hour), "yrs"
default:
- fallthrough
- case "sec", "second", "s":
+ // "sec", "second", "s" handled by default case.
output, toUnit = dd/float64(time.Second), "s"
}
return output, toUnit, true
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/report/source.go b/src/cmd/vendor/github.com/google/pprof/internal/report/source.go
index 835badfcae..ab8b64cbab 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/report/source.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/report/source.go
@@ -59,7 +59,7 @@ func printSource(w io.Writer, rpt *Report) error {
if sourcePath == "" {
wd, err := os.Getwd()
if err != nil {
- return fmt.Errorf("Could not stat current dir: %v", err)
+ return fmt.Errorf("could not stat current dir: %v", err)
}
sourcePath = wd
}
@@ -142,7 +142,7 @@ func PrintWebList(w io.Writer, rpt *Report, obj plugin.ObjTool, maxFiles int) er
if sourcePath == "" {
wd, err := os.Getwd()
if err != nil {
- return fmt.Errorf("Could not stat current dir: %v", err)
+ return fmt.Errorf("could not stat current dir: %v", err)
}
sourcePath = wd
}
@@ -180,7 +180,7 @@ func PrintWebList(w io.Writer, rpt *Report, obj plugin.ObjTool, maxFiles int) er
}
if len(fileNodes) == 0 {
- return fmt.Errorf("No source information for %s", o.Symbol.String())
+ return fmt.Errorf("no source information for %s", o.Symbol.String())
}
sourceFiles := make(graph.Nodes, 0, len(fileNodes))
@@ -598,7 +598,7 @@ func openSourceFile(path, searchPath, trim string) (*os.File, error) {
}
}
- return nil, fmt.Errorf("Could not find file %s on path %s", path, searchPath)
+ return nil, fmt.Errorf("could not find file %s on path %s", path, searchPath)
}
// trimPath cleans up a path by removing prefixes that are commonly
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/symbolz/symbolz.go b/src/cmd/vendor/github.com/google/pprof/internal/symbolz/symbolz.go
index 711d1d5303..7be304866f 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/symbolz/symbolz.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/symbolz/symbolz.go
@@ -68,7 +68,7 @@ func Symbolize(p *profile.Profile, force bool, sources plugin.MappingSources, sy
return nil
}
-// Check whether path ends with one of the suffixes listed in
+// hasGperftoolsSuffix checks whether path ends with one of the suffixes listed in
// pprof_remote_servers.html from the gperftools distribution
func hasGperftoolsSuffix(path string) bool {
suffixes := []string{
diff --git a/src/cmd/vendor/github.com/google/pprof/profile/profile.go b/src/cmd/vendor/github.com/google/pprof/profile/profile.go
index 5eb1cc1614..c950d8dc7f 100644
--- a/src/cmd/vendor/github.com/google/pprof/profile/profile.go
+++ b/src/cmd/vendor/github.com/google/pprof/profile/profile.go
@@ -652,7 +652,7 @@ func labelsToString(labels map[string][]string) string {
return strings.Join(ls, " ")
}
-// numLablesToString returns a string representation of a map
+// numLabelsToString returns a string representation of a map
// representing numeric labels.
func numLabelsToString(numLabels map[string][]int64, numUnits map[string][]string) string {
ls := []string{}
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/analysis.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/analysis.go
index 8eb7316259..19e1e421a3 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/analysis.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/analysis.go
@@ -161,6 +161,15 @@ func (pass *Pass) Reportf(pos token.Pos, format string, args ...interface{}) {
pass.Report(Diagnostic{Pos: pos, Message: msg})
}
+// reportNodef is a helper function that reports a Diagnostic using the
+// range denoted by the AST node.
+//
+// WARNING: This is an experimental API and may change in the future.
+func (pass *Pass) reportNodef(node ast.Node, format string, args ...interface{}) {
+ msg := fmt.Sprintf(format, args...)
+ pass.Report(Diagnostic{Pos: node.Pos(), End: node.End(), Message: msg})
+}
+
func (pass *Pass) String() string {
return fmt.Sprintf("%s@%s", pass.Analyzer.Name, pass.Pkg.Path())
}
@@ -203,13 +212,17 @@ type Fact interface {
AFact() // dummy method to avoid type errors
}
-// A Diagnostic is a message associated with a source location.
+// A Diagnostic is a message associated with a source location or range.
//
// An Analyzer may return a variety of diagnostics; the optional Category,
// which should be a constant, may be used to classify them.
// It is primarily intended to make it easy to look up documentation.
+//
+// If End is provided, the diagnostic is specified to apply to the range between
+// Pos and End.
type Diagnostic struct {
Pos token.Pos
- Category string // optional
+ End token.Pos // optional
+ Category string // optional
Message string
}
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/internal/analysisflags/flags.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/internal/analysisflags/flags.go
index 062d062487..a3c2f09630 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/internal/analysisflags/flags.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/internal/analysisflags/flags.go
@@ -323,9 +323,14 @@ func PrintPlain(fset *token.FileSet, diag analysis.Diagnostic) {
// -c=N: show offending line plus N lines of context.
if Context >= 0 {
+ posn := fset.Position(diag.Pos)
+ end := fset.Position(diag.End)
+ if !end.IsValid() {
+ end = posn
+ }
data, _ := ioutil.ReadFile(posn.Filename)
lines := strings.Split(string(data), "\n")
- for i := posn.Line - Context; i <= posn.Line+Context; i++ {
+ for i := posn.Line - Context; i <= end.Line+Context; i++ {
if 1 <= i && i <= len(lines) {
fmt.Fprintf(os.Stderr, "%d\t%s\n", i, lines[i-1])
}
@@ -353,6 +358,8 @@ func (tree JSONTree) Add(fset *token.FileSet, id, name string, diags []analysis.
Message string `json:"message"`
}
var diagnostics []jsonDiagnostic
+ // TODO(matloob): Should the JSON diagnostics contain ranges?
+ // If so, how should they be formatted?
for _, f := range diags {
diagnostics = append(diagnostics, jsonDiagnostic{
Category: f.Category,
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/errorsas/errorsas.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/errorsas/errorsas.go
new file mode 100644
index 0000000000..c411466c28
--- /dev/null
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/errorsas/errorsas.go
@@ -0,0 +1,75 @@
+// Copyright 2018 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.
+
+// The errorsas package defines an Analyzer that checks that the second arugment to
+// errors.As is a pointer to a type implementing error.
+package errorsas
+
+import (
+ "go/ast"
+ "go/types"
+
+ "golang.org/x/tools/go/analysis"
+ "golang.org/x/tools/go/analysis/passes/inspect"
+ "golang.org/x/tools/go/ast/inspector"
+ "golang.org/x/tools/go/types/typeutil"
+)
+
+const doc = `report passing non-pointer or non-error values to errors.As
+
+The errorsas analysis reports calls to errors.As where the type
+of the second argument is not a pointer to a type implementing error.`
+
+var Analyzer = &analysis.Analyzer{
+ Name: "errorsas",
+ Doc: doc,
+ Requires: []*analysis.Analyzer{inspect.Analyzer},
+ Run: run,
+}
+
+func run(pass *analysis.Pass) (interface{}, error) {
+ switch pass.Pkg.Path() {
+ case "errors", "errors_test":
+ // These packages know how to use their own APIs.
+ // Sometimes they are testing what happens to incorrect programs.
+ return nil, nil
+ }
+
+ inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
+
+ nodeFilter := []ast.Node{
+ (*ast.CallExpr)(nil),
+ }
+ inspect.Preorder(nodeFilter, func(n ast.Node) {
+ call := n.(*ast.CallExpr)
+ fn := typeutil.StaticCallee(pass.TypesInfo, call)
+ if fn == nil {
+ return // not a static call
+ }
+ if len(call.Args) < 2 {
+ return // not enough arguments, e.g. called with return values of another function
+ }
+ if fn.FullName() == "errors.As" && !pointerToInterfaceOrError(pass, call.Args[1]) {
+ pass.Reportf(call.Pos(), "second argument to errors.As must be a pointer to an interface or a type implementing error")
+ }
+ })
+ return nil, nil
+}
+
+var errorType = types.Universe.Lookup("error").Type().Underlying().(*types.Interface)
+
+// pointerToInterfaceOrError reports whether the type of e is a pointer to an interface or a type implementing error,
+// or is the empty interface.
+func pointerToInterfaceOrError(pass *analysis.Pass, e ast.Expr) bool {
+ t := pass.TypesInfo.Types[e].Type
+ if it, ok := t.Underlying().(*types.Interface); ok && it.NumMethods() == 0 {
+ return true
+ }
+ pt, ok := t.Underlying().(*types.Pointer)
+ if !ok {
+ return false
+ }
+ _, ok = pt.Elem().Underlying().(*types.Interface)
+ return ok || types.Implements(pt.Elem(), errorType)
+}
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go
index bcdb042920..acc6e6c770 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go
@@ -41,7 +41,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
}
inspect.Preorder(nodeFilter, func(n ast.Node) {
styp := pass.TypesInfo.Types[n.(*ast.StructType)].Type.(*types.Struct)
- var seen map[[2]string]token.Pos
+ var seen namesSeen
for i := 0; i < styp.NumFields(); i++ {
field := styp.Field(i)
tag := styp.Tag(i)
@@ -51,11 +51,38 @@ func run(pass *analysis.Pass) (interface{}, error) {
return nil, nil
}
+// namesSeen keeps track of encoding tags by their key, name, and nested level
+// from the initial struct. The level is taken into account because equal
+// encoding key names only conflict when at the same level; otherwise, the lower
+// level shadows the higher level.
+type namesSeen map[uniqueName]token.Pos
+
+type uniqueName struct {
+ key string // "xml" or "json"
+ name string // the encoding name
+ level int // anonymous struct nesting level
+}
+
+func (s *namesSeen) Get(key, name string, level int) (token.Pos, bool) {
+ if *s == nil {
+ *s = make(map[uniqueName]token.Pos)
+ }
+ pos, ok := (*s)[uniqueName{key, name, level}]
+ return pos, ok
+}
+
+func (s *namesSeen) Set(key, name string, level int, pos token.Pos) {
+ if *s == nil {
+ *s = make(map[uniqueName]token.Pos)
+ }
+ (*s)[uniqueName{key, name, level}] = pos
+}
+
var checkTagDups = []string{"json", "xml"}
var checkTagSpaces = map[string]bool{"json": true, "xml": true, "asn1": true}
// checkCanonicalFieldTag checks a single struct field tag.
-func checkCanonicalFieldTag(pass *analysis.Pass, field *types.Var, tag string, seen *map[[2]string]token.Pos) {
+func checkCanonicalFieldTag(pass *analysis.Pass, field *types.Var, tag string, seen *namesSeen) {
switch pass.Pkg.Path() {
case "encoding/json", "encoding/xml":
// These packages know how to use their own APIs.
@@ -64,7 +91,7 @@ func checkCanonicalFieldTag(pass *analysis.Pass, field *types.Var, tag string, s
}
for _, key := range checkTagDups {
- checkTagDuplicates(pass, tag, key, field, field, seen)
+ checkTagDuplicates(pass, tag, key, field, field, seen, 1)
}
if err := validateStructTag(tag); err != nil {
@@ -95,28 +122,29 @@ func checkCanonicalFieldTag(pass *analysis.Pass, field *types.Var, tag string, s
// checkTagDuplicates checks a single struct field tag to see if any tags are
// duplicated. nearest is the field that's closest to the field being checked,
// while still being part of the top-level struct type.
-func checkTagDuplicates(pass *analysis.Pass, tag, key string, nearest, field *types.Var, seen *map[[2]string]token.Pos) {
+func checkTagDuplicates(pass *analysis.Pass, tag, key string, nearest, field *types.Var, seen *namesSeen, level int) {
val := reflect.StructTag(tag).Get(key)
if val == "-" {
// Ignored, even if the field is anonymous.
return
}
if val == "" || val[0] == ',' {
- if field.Anonymous() {
- typ, ok := field.Type().Underlying().(*types.Struct)
- if !ok {
- return
- }
- for i := 0; i < typ.NumFields(); i++ {
- field := typ.Field(i)
- if !field.Exported() {
- continue
- }
- tag := typ.Tag(i)
- checkTagDuplicates(pass, tag, key, nearest, field, seen)
- }
+ if !field.Anonymous() {
+ // Ignored if the field isn't anonymous.
+ return
+ }
+ typ, ok := field.Type().Underlying().(*types.Struct)
+ if !ok {
+ return
+ }
+ for i := 0; i < typ.NumFields(); i++ {
+ field := typ.Field(i)
+ if !field.Exported() {
+ continue
+ }
+ tag := typ.Tag(i)
+ checkTagDuplicates(pass, tag, key, nearest, field, seen, level+1)
}
- // Ignored if the field isn't anonymous.
return
}
if key == "xml" && field.Name() == "XMLName" {
@@ -139,10 +167,7 @@ func checkTagDuplicates(pass *analysis.Pass, tag, key string, nearest, field *ty
}
val = val[:i]
}
- if *seen == nil {
- *seen = map[[2]string]token.Pos{}
- }
- if pos, ok := (*seen)[[2]string{key, val}]; ok {
+ if pos, ok := seen.Get(key, val, level); ok {
alsoPos := pass.Fset.Position(pos)
alsoPos.Column = 0
@@ -161,7 +186,7 @@ func checkTagDuplicates(pass *analysis.Pass, tag, key string, nearest, field *ty
pass.Reportf(nearest.Pos(), "struct field %s repeats %s tag %q also at %s", field.Name(), key, val, alsoPos)
} else {
- (*seen)[[2]string{key, val}] = field.Pos()
+ seen.Set(key, val, level, field.Pos())
}
}
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/tests/tests.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/tests/tests.go
index 5dd060800c..8232276186 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/tests/tests.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/tests/tests.go
@@ -20,7 +20,10 @@ const Doc = `check for common mistaken usages of tests and examples
The tests checker walks Test, Benchmark and Example functions checking
malformed names, wrong signatures and examples documenting non-existent
-identifiers.`
+identifiers.
+
+Please see the documentation for package testing in golang.org/pkg/testing
+for the conventions that are enforced for Tests, Benchmarks, and Examples.`
var Analyzer = &analysis.Analyzer{
Name: "tests",
diff --git a/src/cmd/vendor/modules.txt b/src/cmd/vendor/modules.txt
index ef8408cd51..caf340a752 100644
--- a/src/cmd/vendor/modules.txt
+++ b/src/cmd/vendor/modules.txt
@@ -1,4 +1,4 @@
-# github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57
+# github.com/google/pprof v0.0.0-20190515194954-54271f7e092f
github.com/google/pprof/driver
github.com/google/pprof/internal/binutils
github.com/google/pprof/internal/driver
@@ -26,7 +26,7 @@ golang.org/x/crypto/ssh/terminal
# golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82
golang.org/x/sys/unix
golang.org/x/sys/windows
-# golang.org/x/tools v0.0.0-20190514135123-4789ca9922f0
+# golang.org/x/tools v0.0.0-20190611154301-25a4f137592f
golang.org/x/tools/go/analysis
golang.org/x/tools/go/analysis/internal/analysisflags
golang.org/x/tools/go/analysis/internal/facts
@@ -39,6 +39,7 @@ golang.org/x/tools/go/analysis/passes/cgocall
golang.org/x/tools/go/analysis/passes/composite
golang.org/x/tools/go/analysis/passes/copylock
golang.org/x/tools/go/analysis/passes/ctrlflow
+golang.org/x/tools/go/analysis/passes/errorsas
golang.org/x/tools/go/analysis/passes/httpresponse
golang.org/x/tools/go/analysis/passes/inspect
golang.org/x/tools/go/analysis/passes/internal/analysisutil
diff --git a/src/cmd/vet/main.go b/src/cmd/vet/main.go
index b845d95040..2a4f929d60 100644
--- a/src/cmd/vet/main.go
+++ b/src/cmd/vet/main.go
@@ -13,6 +13,7 @@ import (
"golang.org/x/tools/go/analysis/passes/cgocall"
"golang.org/x/tools/go/analysis/passes/composite"
"golang.org/x/tools/go/analysis/passes/copylock"
+ "golang.org/x/tools/go/analysis/passes/errorsas"
"golang.org/x/tools/go/analysis/passes/httpresponse"
"golang.org/x/tools/go/analysis/passes/loopclosure"
"golang.org/x/tools/go/analysis/passes/lostcancel"
@@ -40,6 +41,7 @@ func main() {
cgocall.Analyzer,
composite.Analyzer,
copylock.Analyzer,
+ errorsas.Analyzer,
httpresponse.Analyzer,
loopclosure.Analyzer,
lostcancel.Analyzer,
diff --git a/src/compress/gzip/gzip_test.go b/src/compress/gzip/gzip_test.go
index e16aba1572..f18c5cb454 100644
--- a/src/compress/gzip/gzip_test.go
+++ b/src/compress/gzip/gzip_test.go
@@ -214,6 +214,9 @@ func TestConcat(t *testing.T) {
w.Close()
r, err := NewReader(&buf)
+ if err != nil {
+ t.Fatal(err)
+ }
data, err := ioutil.ReadAll(r)
if string(data) != "hello world\n" || err != nil {
t.Fatalf("ReadAll = %q, %v, want %q, nil", data, err, "hello world")
diff --git a/src/crypto/cipher/xor_test.go b/src/crypto/cipher/xor_test.go
index 40d4e5afa3..4f829e9461 100644
--- a/src/crypto/cipher/xor_test.go
+++ b/src/crypto/cipher/xor_test.go
@@ -9,16 +9,11 @@ import (
"crypto/cipher"
"crypto/rand"
"fmt"
- "internal/testenv"
"io"
- "runtime"
"testing"
)
func TestXOR(t *testing.T) {
- if runtime.GOOS == "js" {
- testenv.SkipFlaky(t, 31812)
- }
for j := 1; j <= 1024; j++ {
if testing.Short() && j > 16 {
break
diff --git a/src/crypto/ecdsa/ecdsa.go b/src/crypto/ecdsa/ecdsa.go
index 0e6bb8b23f..be01a29606 100644
--- a/src/crypto/ecdsa/ecdsa.go
+++ b/src/crypto/ecdsa/ecdsa.go
@@ -21,13 +21,12 @@ import (
"crypto/aes"
"crypto/cipher"
"crypto/elliptic"
+ "crypto/internal/randutil"
"crypto/sha512"
"encoding/asn1"
"errors"
"io"
"math/big"
-
- "crypto/internal/randutil"
)
import (
@@ -226,14 +225,21 @@ func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err err
// See [NSA] 3.4.1
c := priv.PublicKey.Curve
+ e := hashToInt(hash, c)
+ r, s, err = sign(priv, &csprng, c, e)
+ return
+}
+
+func signGeneric(priv *PrivateKey, csprng *cipher.StreamReader, c elliptic.Curve, e *big.Int) (r, s *big.Int, err error) {
N := c.Params().N
if N.Sign() == 0 {
return nil, nil, errZeroParam
}
+
var k, kInv *big.Int
for {
for {
- k, err = randFieldElement(c, csprng)
+ k, err = randFieldElement(c, *csprng)
if err != nil {
r = nil
return
@@ -251,8 +257,6 @@ func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err err
break
}
}
-
- e := hashToInt(hash, c)
s = new(big.Int).Mul(priv.D, r)
s.Add(s, e)
s.Mul(s, kInv)
@@ -261,7 +265,6 @@ func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err err
break
}
}
-
return
}
@@ -288,8 +291,12 @@ func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool {
return false
}
e := hashToInt(hash, c)
+ return verify(pub, c, e, r, s)
+}
+func verifyGeneric(pub *PublicKey, c elliptic.Curve, e, r, s *big.Int) bool {
var w *big.Int
+ N := c.Params().N
if in, ok := c.(invertible); ok {
w = in.Inverse(s)
} else {
diff --git a/src/crypto/ecdsa/ecdsa_noasm.go b/src/crypto/ecdsa/ecdsa_noasm.go
new file mode 100644
index 0000000000..2dfdb866d6
--- /dev/null
+++ b/src/crypto/ecdsa/ecdsa_noasm.go
@@ -0,0 +1,22 @@
+// Copyright 2019 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.
+
+// +build !s390x
+
+package ecdsa
+
+import (
+ "crypto/cipher"
+ "crypto/elliptic"
+ "math/big"
+)
+
+func sign(priv *PrivateKey, csprng *cipher.StreamReader, c elliptic.Curve, e *big.Int) (r, s *big.Int, err error) {
+ r, s, err = signGeneric(priv, csprng, c, e)
+ return
+}
+
+func verify(pub *PublicKey, c elliptic.Curve, e, r, s *big.Int) bool {
+ return verifyGeneric(pub, c, e, r, s)
+}
diff --git a/src/crypto/ecdsa/ecdsa_s390x.go b/src/crypto/ecdsa/ecdsa_s390x.go
new file mode 100644
index 0000000000..f07c3bf50c
--- /dev/null
+++ b/src/crypto/ecdsa/ecdsa_s390x.go
@@ -0,0 +1,153 @@
+// Copyright 2019 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.
+
+// +build s390x,!gccgo
+
+package ecdsa
+
+import (
+ "crypto/cipher"
+ "crypto/elliptic"
+ "internal/cpu"
+ "math/big"
+)
+
+// s390x accelerated signatures
+//go:noescape
+func kdsaSig(fc uint64, block *[1720]byte) (errn uint64)
+
+type signverify int
+
+const (
+ signing signverify = iota
+ verifying
+)
+
+// bufferOffsets represents the offset of a particular parameter in
+// the buffer passed to the KDSA instruction.
+type bufferOffsets struct {
+ baseSize int
+ hashSize int
+ offsetHash int
+ offsetKey1 int
+ offsetRNorKey2 int
+ offsetR int
+ offsetS int
+ functionCode uint64
+}
+
+func canUseKDSA(sv signverify, c elliptic.Curve, bo *bufferOffsets) bool {
+ if !cpu.S390X.HasECDSA {
+ return false
+ }
+
+ switch c.Params().Name {
+ case "P-256":
+ bo.baseSize = 32
+ bo.hashSize = 32
+ bo.offsetHash = 64
+ bo.offsetKey1 = 96
+ bo.offsetRNorKey2 = 128
+ bo.offsetR = 0
+ bo.offsetS = 32
+ if sv == signing {
+ bo.functionCode = 137
+ } else {
+ bo.functionCode = 1
+ }
+ return true
+ case "P-384":
+ bo.baseSize = 48
+ bo.hashSize = 48
+ bo.offsetHash = 96
+ bo.offsetKey1 = 144
+ bo.offsetRNorKey2 = 192
+ bo.offsetR = 0
+ bo.offsetS = 48
+ if sv == signing {
+ bo.functionCode = 138
+ } else {
+ bo.functionCode = 2
+ }
+ return true
+ case "P-521":
+ bo.baseSize = 66
+ bo.hashSize = 80
+ bo.offsetHash = 160
+ bo.offsetKey1 = 254
+ bo.offsetRNorKey2 = 334
+ bo.offsetR = 14
+ bo.offsetS = 94
+ if sv == signing {
+ bo.functionCode = 139
+ } else {
+ bo.functionCode = 3
+ }
+ return true
+ }
+ return false
+}
+
+// zeroExtendAndCopy pads src with leading zeros until it has the size given.
+// It then copies the padded src into the dst. Bytes beyond size in dst are
+// not modified.
+func zeroExtendAndCopy(dst, src []byte, size int) {
+ nz := size - len(src)
+ if nz < 0 {
+ panic("src is too long")
+ }
+ // the compiler should replace this loop with a memclr call
+ z := dst[:nz]
+ for i := range z {
+ z[i] = 0
+ }
+ copy(dst[nz:size], src[:size-nz])
+ return
+}
+
+func sign(priv *PrivateKey, csprng *cipher.StreamReader, c elliptic.Curve, e *big.Int) (r, s *big.Int, err error) {
+ var bo bufferOffsets
+ if canUseKDSA(signing, c, &bo) && e.Sign() != 0 {
+ var buffer [1720]byte
+ for {
+ var k *big.Int
+ k, err = randFieldElement(c, csprng)
+ if err != nil {
+ return nil, nil, err
+ }
+ zeroExtendAndCopy(buffer[bo.offsetHash:], e.Bytes(), bo.hashSize)
+ zeroExtendAndCopy(buffer[bo.offsetKey1:], priv.D.Bytes(), bo.baseSize)
+ zeroExtendAndCopy(buffer[bo.offsetRNorKey2:], k.Bytes(), bo.baseSize)
+ errn := kdsaSig(bo.functionCode, &buffer)
+ if errn == 2 {
+ return nil, nil, errZeroParam
+ }
+ if errn == 0 { // success == 0 means successful signing
+ r = new(big.Int)
+ r.SetBytes(buffer[bo.offsetR : bo.offsetR+bo.baseSize])
+ s = new(big.Int)
+ s.SetBytes(buffer[bo.offsetS : bo.offsetS+bo.baseSize])
+ return
+ }
+ //at this point, it must be that errn == 1: retry
+ }
+ }
+ r, s, err = signGeneric(priv, csprng, c, e)
+ return
+}
+
+func verify(pub *PublicKey, c elliptic.Curve, e, r, s *big.Int) bool {
+ var bo bufferOffsets
+ if canUseKDSA(verifying, c, &bo) && e.Sign() != 0 {
+ var buffer [1720]byte
+ zeroExtendAndCopy(buffer[bo.offsetR:], r.Bytes(), bo.baseSize)
+ zeroExtendAndCopy(buffer[bo.offsetS:], s.Bytes(), bo.baseSize)
+ zeroExtendAndCopy(buffer[bo.offsetHash:], e.Bytes(), bo.hashSize)
+ zeroExtendAndCopy(buffer[bo.offsetKey1:], pub.X.Bytes(), bo.baseSize)
+ zeroExtendAndCopy(buffer[bo.offsetRNorKey2:], pub.Y.Bytes(), bo.baseSize)
+ errn := kdsaSig(bo.functionCode, &buffer)
+ return errn == 0
+ }
+ return verifyGeneric(pub, c, e, r, s)
+}
diff --git a/src/crypto/ecdsa/ecdsa_s390x.s b/src/crypto/ecdsa/ecdsa_s390x.s
new file mode 100644
index 0000000000..6ee00ce79c
--- /dev/null
+++ b/src/crypto/ecdsa/ecdsa_s390x.s
@@ -0,0 +1,31 @@
+// Copyright 2019 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.
+
+#include "textflag.h"
+
+// func kdsaSig(fc uint64, block *[1720]byte) (errn uint64)
+TEXT ·kdsaSig(SB), NOSPLIT|NOFRAME, $0-24
+ MOVD fc+0(FP), R0 // function code
+ MOVD block+8(FP), R1 // address parameter block
+
+loop:
+ WORD $0xB93A0008 // compute digital signature authentication
+ BVS loop // branch back if interrupted
+ BEQ success // signature creation successful
+ BGT retry // signing unsuccessful, but retry with new CSPRN
+
+error:
+ MOVD $2, R2 // fallthrough indicates fatal error
+ MOVD R2, errn+16(FP) // return 2 - sign/verify abort
+ RET
+
+retry:
+ MOVD $1, R2
+ MOVD R2, errn+16(FP) // return 1 - sign/verify was unsuccessful -- if sign, retry with new RN
+ RET
+
+success:
+ MOVD $0, R2
+ MOVD R2, errn+16(FP) // return 0 - sign/verify was successful
+ RET
diff --git a/src/crypto/ecdsa/ecdsa_s390x_test.go b/src/crypto/ecdsa/ecdsa_s390x_test.go
new file mode 100644
index 0000000000..80babc9cb4
--- /dev/null
+++ b/src/crypto/ecdsa/ecdsa_s390x_test.go
@@ -0,0 +1,33 @@
+// Copyright 2019 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.
+
+// +build s390x,!gccgo
+
+package ecdsa
+
+import (
+ "crypto/elliptic"
+ "testing"
+)
+
+func TestNoAsm(t *testing.T) {
+ curves := [...]elliptic.Curve{
+ elliptic.P256(),
+ elliptic.P384(),
+ elliptic.P521(),
+ }
+
+ for _, curve := range curves {
+ // override the name of the curve to stop the assembly path being taken
+ params := *curve.Params()
+ name := params.Name
+ params.Name = name + "_GENERIC_OVERRIDE"
+
+ testKeyGeneration(t, ¶ms, name)
+ testSignAndVerify(t, ¶ms, name)
+ testNonceSafety(t, ¶ms, name)
+ testINDCCA(t, ¶ms, name)
+ testNegativeInputs(t, ¶ms, name)
+ }
+}
diff --git a/src/crypto/rand/rand_js.go b/src/crypto/rand/rand_js.go
index bb213963fd..7e939742ac 100644
--- a/src/crypto/rand/rand_js.go
+++ b/src/crypto/rand/rand_js.go
@@ -13,6 +13,7 @@ func init() {
}
var jsCrypto = js.Global().Get("crypto")
+var uint8Array = js.Global().Get("Uint8Array")
// reader implements a pseudorandom generator
// using JavaScript crypto.getRandomValues method.
@@ -20,8 +21,8 @@ var jsCrypto = js.Global().Get("crypto")
type reader struct{}
func (r *reader) Read(b []byte) (int, error) {
- a := js.TypedArrayOf(b)
+ a := uint8Array.New(len(b))
jsCrypto.Call("getRandomValues", a)
- a.Release()
+ js.CopyBytesToGo(b, a)
return len(b), nil
}
diff --git a/src/crypto/tls/auth.go b/src/crypto/tls/auth.go
index 9fa0f452fd..c62c9af76b 100644
--- a/src/crypto/tls/auth.go
+++ b/src/crypto/tls/auth.go
@@ -166,9 +166,11 @@ func signedMessage(sigHash crypto.Hash, context string, transcript hash.Hash) []
}
// signatureSchemesForCertificate returns the list of supported SignatureSchemes
-// for a given certificate, based on the public key and the protocol version. It
-// does not support the crypto.Decrypter interface, so shouldn't be used on the
-// server side in TLS 1.2 and earlier.
+// for a given certificate, based on the public key and the protocol version.
+//
+// It does not support the crypto.Decrypter interface, so shouldn't be used for
+// server certificates in TLS 1.2 and earlier, and it must be kept in sync with
+// supportedSignatureAlgorithms.
func signatureSchemesForCertificate(version uint16, cert *Certificate) []SignatureScheme {
priv, ok := cert.PrivateKey.(crypto.Signer)
if !ok {
@@ -200,16 +202,12 @@ func signatureSchemesForCertificate(version uint16, cert *Certificate) []Signatu
case *rsa.PublicKey:
if version != VersionTLS13 {
return []SignatureScheme{
- PSSWithSHA256,
- PSSWithSHA384,
- PSSWithSHA512,
PKCS1WithSHA256,
PKCS1WithSHA384,
PKCS1WithSHA512,
PKCS1WithSHA1,
}
}
- // RSA keys with RSA-PSS OID are not supported by crypto/x509.
return []SignatureScheme{
PSSWithSHA256,
PSSWithSHA384,
diff --git a/src/crypto/tls/boring.go b/src/crypto/tls/boring.go
index 95256b19f7..5b5c20ce1f 100644
--- a/src/crypto/tls/boring.go
+++ b/src/crypto/tls/boring.go
@@ -125,4 +125,13 @@ func supportedSignatureAlgorithms() []SignatureScheme {
return fipsSupportedSignatureAlgorithms
}
+// supportedSignatureAlgorithmsTLS12 returns the supported signature algorithms
+// for TLS 1.2. Issue 32425.
+func supportedSignatureAlgorithmsTLS12() []SignatureScheme {
+ if !needFIPS() {
+ return defaultSupportedSignatureAlgorithmsTLS12
+ }
+ return fipsSupportedSignatureAlgorithms[3:]
+}
+
var testingOnlyForceClientHelloSignatureAlgorithms []SignatureScheme
diff --git a/src/crypto/tls/boring_test.go b/src/crypto/tls/boring_test.go
index c785c01fcc..74c2636a87 100644
--- a/src/crypto/tls/boring_test.go
+++ b/src/crypto/tls/boring_test.go
@@ -193,28 +193,27 @@ func boringHandshake(t *testing.T, clientConfig, serverConfig *Config) (clientEr
}
func TestBoringServerSignatureAndHash(t *testing.T) {
- serverConfig := testConfig.Clone()
- serverConfig.Certificates = make([]Certificate, 1)
-
defer func() {
testingOnlyForceClientHelloSignatureAlgorithms = nil
}()
for _, sigHash := range defaultSupportedSignatureAlgorithms {
- testingOnlyForceClientHelloSignatureAlgorithms = []SignatureScheme{sigHash}
-
t.Run(fmt.Sprintf("%#x", sigHash), func(t *testing.T) {
- switch sigHash {
- case PKCS1WithSHA1, PKCS1WithSHA256, PKCS1WithSHA384, PKCS1WithSHA512,
- PSSWithSHA256, PSSWithSHA384, PSSWithSHA512:
+ serverConfig := testConfig.Clone()
+ serverConfig.Certificates = make([]Certificate, 1)
+
+ testingOnlyForceClientHelloSignatureAlgorithms = []SignatureScheme{sigHash}
+
+ switch signatureFromSignatureScheme(sigHash) {
+ case signaturePKCS1v15, signatureRSAPSS:
serverConfig.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}
serverConfig.Certificates[0].Certificate = [][]byte{testRSA2048Certificate}
serverConfig.Certificates[0].PrivateKey = testRSA2048PrivateKey
- case Ed25519:
+ case signatureEd25519:
serverConfig.CipherSuites = []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}
serverConfig.Certificates[0].Certificate = [][]byte{testEd25519Certificate}
serverConfig.Certificates[0].PrivateKey = testEd25519PrivateKey
- default:
+ case signatureECDSA:
serverConfig.CipherSuites = []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}
serverConfig.Certificates[0].Certificate = [][]byte{testECDSACertificate}
serverConfig.Certificates[0].PrivateKey = testECDSAPrivateKey
@@ -222,7 +221,10 @@ func TestBoringServerSignatureAndHash(t *testing.T) {
serverConfig.BuildNameToCertificate()
// PKCS#1 v1.5 signature algorithms can't be used standalone in TLS
// 1.3, and the ECDSA ones bind to the curve used.
- serverConfig.MaxVersion = VersionTLS12
+ // RSA-PSS signatures are not supported in TLS 1.2. Issue 32425.
+ if signatureFromSignatureScheme(sigHash) != signatureRSAPSS {
+ serverConfig.MaxVersion = VersionTLS12
+ }
clientErr, serverErr := boringHandshake(t, testConfig, serverConfig)
if clientErr != nil {
@@ -234,7 +236,8 @@ func TestBoringServerSignatureAndHash(t *testing.T) {
fipstls.Force()
defer fipstls.Abandon()
clientErr, _ := boringHandshake(t, testConfig, serverConfig)
- if isBoringSignatureScheme(sigHash) {
+ // RSA-PSS is only supported in TLS 1.3, prohibited by forcing fipstls. Issue 32425.
+ if isBoringSignatureScheme(sigHash) && signatureFromSignatureScheme(sigHash) != signatureRSAPSS {
if clientErr != nil {
t.Fatalf("expected handshake with %#x to succeed; err=%v", sigHash, clientErr)
}
diff --git a/src/crypto/tls/common.go b/src/crypto/tls/common.go
index 396676328a..f7e0f8e164 100644
--- a/src/crypto/tls/common.go
+++ b/src/crypto/tls/common.go
@@ -187,6 +187,21 @@ var defaultSupportedSignatureAlgorithms = []SignatureScheme{
ECDSAWithSHA1,
}
+// defaultSupportedSignatureAlgorithmsTLS12 contains the signature and hash algorithms
+// that are supported in TLS 1.2, where it is possible to distinguish the
+// protocol version. This is temporary, see Issue 32425.
+var defaultSupportedSignatureAlgorithmsTLS12 = []SignatureScheme{
+ PKCS1WithSHA256,
+ ECDSAWithP256AndSHA256,
+ Ed25519,
+ PKCS1WithSHA384,
+ PKCS1WithSHA512,
+ ECDSAWithP384AndSHA384,
+ ECDSAWithP521AndSHA512,
+ PKCS1WithSHA1,
+ ECDSAWithSHA1,
+}
+
// helloRetryRequestRandom is set as the Random value of a ServerHello
// to signal that the message is actually a HelloRetryRequest.
var helloRetryRequestRandom = []byte{ // See RFC 8446, Section 4.1.3.
diff --git a/src/crypto/tls/handshake_client.go b/src/crypto/tls/handshake_client.go
index e8f327e23f..1ff3422148 100644
--- a/src/crypto/tls/handshake_client.go
+++ b/src/crypto/tls/handshake_client.go
@@ -576,7 +576,7 @@ func (hs *clientHandshakeState) doFullHandshake() error {
return fmt.Errorf("tls: client certificate private key of type %T does not implement crypto.Signer", chainToSend.PrivateKey)
}
- signatureAlgorithm, sigType, hashFunc, err := pickSignatureAlgorithm(key.Public(), certReq.supportedSignatureAlgorithms, hs.hello.supportedSignatureAlgorithms, c.vers)
+ signatureAlgorithm, sigType, hashFunc, err := pickSignatureAlgorithm(key.Public(), certReq.supportedSignatureAlgorithms, supportedSignatureAlgorithmsTLS12(), c.vers)
if err != nil {
c.sendAlert(alertInternalError)
return err
@@ -904,10 +904,8 @@ func certificateRequestInfoFromMsg(certReq *certificateRequestMsg) *CertificateR
return cri
}
- // In TLS 1.2, the signature schemes apply to both the certificate chain and
- // the leaf key, while the certificate types only apply to the leaf key.
+ // Filter the signature schemes based on the certificate types.
// See RFC 5246, Section 7.4.4 (where it calls this "somewhat complicated").
- // Filter the signature schemes based on the certificate type.
cri.SignatureSchemes = make([]SignatureScheme, 0, len(certReq.supportedSignatureAlgorithms))
for _, sigScheme := range certReq.supportedSignatureAlgorithms {
switch signatureFromSignatureScheme(sigScheme) {
diff --git a/src/crypto/tls/handshake_client_test.go b/src/crypto/tls/handshake_client_test.go
index a27f107ba7..da17fdfa4f 100644
--- a/src/crypto/tls/handshake_client_test.go
+++ b/src/crypto/tls/handshake_client_test.go
@@ -450,12 +450,20 @@ func (test *clientTest) run(t *testing.T, write bool) {
}
for i, b := range flows {
if i%2 == 1 {
- serverConn.SetWriteDeadline(time.Now().Add(1 * time.Minute))
+ if *fast {
+ serverConn.SetWriteDeadline(time.Now().Add(1 * time.Second))
+ } else {
+ serverConn.SetWriteDeadline(time.Now().Add(1 * time.Minute))
+ }
serverConn.Write(b)
continue
}
bb := make([]byte, len(b))
- serverConn.SetReadDeadline(time.Now().Add(1 * time.Minute))
+ if *fast {
+ serverConn.SetReadDeadline(time.Now().Add(1 * time.Second))
+ } else {
+ serverConn.SetReadDeadline(time.Now().Add(1 * time.Minute))
+ }
_, err := io.ReadFull(serverConn, bb)
if err != nil {
t.Fatalf("%s, flow %d: %s", test.name, i+1, err)
@@ -819,22 +827,26 @@ func TestHandshakeClientCertECDSA(t *testing.T) {
runClientTestTLS12(t, test)
}
-// TestHandshakeClientCertRSAPSS tests a few separate things:
-// * that our client can serve a PSS-signed certificate
-// * that our client can validate a PSS-signed certificate
-// * that our client can use rsa_pss_rsae_sha256 in its CertificateVerify
-// * that our client can accpet rsa_pss_rsae_sha256 in the server CertificateVerify
+// TestHandshakeClientCertRSAPSS tests rsa_pss_rsae_sha256 signatures from both
+// client and server certificates. It also serves from both sides a certificate
+// signed itself with RSA-PSS, mostly to check that crypto/x509 chain validation
+// works.
func TestHandshakeClientCertRSAPSS(t *testing.T) {
- issuer, err := x509.ParseCertificate(testRSAPSSCertificate)
+ cert, err := x509.ParseCertificate(testRSAPSSCertificate)
if err != nil {
panic(err)
}
rootCAs := x509.NewCertPool()
- rootCAs.AddCert(issuer)
+ rootCAs.AddCert(cert)
config := testConfig.Clone()
- cert, _ := X509KeyPair([]byte(clientCertificatePEM), []byte(clientKeyPEM))
- config.Certificates = []Certificate{cert}
+ // Use GetClientCertificate to bypass the client certificate selection logic.
+ config.GetClientCertificate = func(*CertificateRequestInfo) (*Certificate, error) {
+ return &Certificate{
+ Certificate: [][]byte{testRSAPSSCertificate},
+ PrivateKey: testRSAPrivateKey,
+ }, nil
+ }
config.RootCAs = rootCAs
test := &clientTest{
@@ -845,9 +857,19 @@ func TestHandshakeClientCertRSAPSS(t *testing.T) {
cert: testRSAPSSCertificate,
key: testRSAPrivateKey,
}
-
- runClientTestTLS12(t, test)
runClientTestTLS13(t, test)
+
+ // In our TLS 1.2 client, RSA-PSS is only supported for server certificates.
+ // See Issue 32425.
+ test = &clientTest{
+ name: "ClientCert-RSA-RSAPSS",
+ args: []string{"-cipher", "AES128", "-Verify", "1", "-client_sigalgs",
+ "rsa_pkcs1_sha256", "-sigalgs", "rsa_pss_rsae_sha256"},
+ config: config,
+ cert: testRSAPSSCertificate,
+ key: testRSAPrivateKey,
+ }
+ runClientTestTLS12(t, test)
}
func TestHandshakeClientCertRSAPKCS1v15(t *testing.T) {
diff --git a/src/crypto/tls/handshake_server.go b/src/crypto/tls/handshake_server.go
index 969c4babef..366c19a0f5 100644
--- a/src/crypto/tls/handshake_server.go
+++ b/src/crypto/tls/handshake_server.go
@@ -457,16 +457,17 @@ func (hs *serverHandshakeState) doFullHandshake() error {
}
}
+ var certReq *certificateRequestMsg
if c.config.ClientAuth >= RequestClientCert {
// Request a client certificate
- certReq := new(certificateRequestMsg)
+ certReq = new(certificateRequestMsg)
certReq.certificateTypes = []byte{
byte(certTypeRSASign),
byte(certTypeECDSASign),
}
if c.vers >= VersionTLS12 {
certReq.hasSignatureAlgorithm = true
- certReq.supportedSignatureAlgorithms = supportedSignatureAlgorithms()
+ certReq.supportedSignatureAlgorithms = supportedSignatureAlgorithmsTLS12()
}
// An empty list of certificateAuthorities signals to
@@ -562,7 +563,7 @@ func (hs *serverHandshakeState) doFullHandshake() error {
}
// Determine the signature type.
- _, sigType, hashFunc, err := pickSignatureAlgorithm(pub, []SignatureScheme{certVerify.signatureAlgorithm}, supportedSignatureAlgorithms(), c.vers)
+ _, sigType, hashFunc, err := pickSignatureAlgorithm(pub, []SignatureScheme{certVerify.signatureAlgorithm}, certReq.supportedSignatureAlgorithms, c.vers)
if err != nil {
c.sendAlert(alertIllegalParameter)
return err
diff --git a/src/crypto/tls/handshake_server_test.go b/src/crypto/tls/handshake_server_test.go
index 843a0a70f0..6884dff154 100644
--- a/src/crypto/tls/handshake_server_test.go
+++ b/src/crypto/tls/handshake_server_test.go
@@ -685,12 +685,20 @@ func (test *serverTest) run(t *testing.T, write bool) {
}
for i, b := range flows {
if i%2 == 0 {
- clientConn.SetWriteDeadline(time.Now().Add(1 * time.Minute))
+ if *fast {
+ clientConn.SetWriteDeadline(time.Now().Add(1 * time.Second))
+ } else {
+ clientConn.SetWriteDeadline(time.Now().Add(1 * time.Minute))
+ }
clientConn.Write(b)
continue
}
bb := make([]byte, len(b))
- clientConn.SetReadDeadline(time.Now().Add(1 * time.Minute))
+ if *fast {
+ clientConn.SetReadDeadline(time.Now().Add(1 * time.Second))
+ } else {
+ clientConn.SetReadDeadline(time.Now().Add(1 * time.Minute))
+ }
n, err := io.ReadFull(clientConn, bb)
if err != nil {
t.Fatalf("%s #%d: %s\nRead %d, wanted %d, got %x, wanted %x\n", test.name, i+1, err, n, len(bb), bb[:n], b)
@@ -1205,10 +1213,16 @@ func TestHandshakeServerRSAPKCS1v15(t *testing.T) {
func TestHandshakeServerRSAPSS(t *testing.T) {
test := &serverTest{
+ name: "RSA-RSAPSS",
+ command: []string{"openssl", "s_client", "-no_ticket", "-sigalgs", "rsa_pss_rsae_sha256"},
+ expectHandshakeErrorIncluding: "peer doesn't support any common signature algorithms", // See Issue 32425.
+ }
+ runServerTestTLS12(t, test)
+
+ test = &serverTest{
name: "RSA-RSAPSS",
command: []string{"openssl", "s_client", "-no_ticket", "-sigalgs", "rsa_pss_rsae_sha256"},
}
- runServerTestTLS12(t, test)
runServerTestTLS13(t, test)
}
@@ -1445,11 +1459,18 @@ func TestClientAuth(t *testing.T) {
test = &serverTest{
name: "ClientAuthRequestedAndGiven",
command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA",
- "-cert", certPath, "-key", keyPath, "-sigalgs", "rsa_pss_rsae_sha256"},
+ "-cert", certPath, "-key", keyPath, "-client_sigalgs", "rsa_pss_rsae_sha256"},
+ config: config,
+ expectedPeerCerts: []string{}, // See Issue 32425.
+ }
+ runServerTestTLS12(t, test)
+ test = &serverTest{
+ name: "ClientAuthRequestedAndGiven",
+ command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA",
+ "-cert", certPath, "-key", keyPath, "-client_sigalgs", "rsa_pss_rsae_sha256"},
config: config,
expectedPeerCerts: []string{clientCertificatePEM},
}
- runServerTestTLS12(t, test)
runServerTestTLS13(t, test)
test = &serverTest{
@@ -1475,7 +1496,7 @@ func TestClientAuth(t *testing.T) {
test = &serverTest{
name: "ClientAuthRequestedAndPKCS1v15Given",
command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA",
- "-cert", certPath, "-key", keyPath, "-sigalgs", "rsa_pkcs1_sha256"},
+ "-cert", certPath, "-key", keyPath, "-client_sigalgs", "rsa_pkcs1_sha256"},
config: config,
expectedPeerCerts: []string{clientCertificatePEM},
}
@@ -1682,7 +1703,7 @@ var testRSACertificate = fromHex("3082024b308201b4a003020102020900e8f09d3fe25bea
var testRSACertificateIssuer = fromHex("3082021930820182a003020102020900ca5e4e811a965964300d06092a864886f70d01010b0500301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f74301e170d3136303130313030303030305a170d3235303130313030303030305a301f310b3009060355040a1302476f3110300e06035504031307476f20526f6f7430819f300d06092a864886f70d010101050003818d0030818902818100d667b378bb22f34143b6cd2008236abefaf2852adf3ab05e01329e2c14834f5105df3f3073f99dab5442d45ee5f8f57b0111c8cb682fbb719a86944eebfffef3406206d898b8c1b1887797c9c5006547bb8f00e694b7a063f10839f269f2c34fff7a1f4b21fbcd6bfdfb13ac792d1d11f277b5c5b48600992203059f2a8f8cc50203010001a35d305b300e0603551d0f0101ff040403020204301d0603551d250416301406082b0601050507030106082b06010505070302300f0603551d130101ff040530030101ff30190603551d0e041204104813494d137e1631bba301d5acab6e7b300d06092a864886f70d01010b050003818100c1154b4bab5266221f293766ae4138899bd4c5e36b13cee670ceeaa4cbdf4f6679017e2fe649765af545749fe4249418a56bd38a04b81e261f5ce86b8d5c65413156a50d12449554748c59a30c515bc36a59d38bddf51173e899820b282e40aa78c806526fd184fb6b4cf186ec728edffa585440d2b3225325f7ab580e87dd76")
-// testRSAPSSCertificate has signatureAlgorithm rsassaPss, and subjectPublicKeyInfo
+// testRSAPSSCertificate has signatureAlgorithm rsassaPss, but subjectPublicKeyInfo
// algorithm rsaEncryption, for use with the rsa_pss_rsae_* SignatureSchemes.
// See also TestRSAPSSKeyError. testRSAPSSCertificate is self-signed.
var testRSAPSSCertificate = fromHex("308202583082018da003020102021100f29926eb87ea8a0db9fcc247347c11b0304106092a864886f70d01010a3034a00f300d06096086480165030402010500a11c301a06092a864886f70d010108300d06096086480165030402010500a20302012030123110300e060355040a130741636d6520436f301e170d3137313132333136313631305a170d3138313132333136313631305a30123110300e060355040a130741636d6520436f30819f300d06092a864886f70d010101050003818d0030818902818100db467d932e12270648bc062821ab7ec4b6a25dfe1e5245887a3647a5080d92425bc281c0be97799840fb4f6d14fd2b138bc2a52e67d8d4099ed62238b74a0b74732bc234f1d193e596d9747bf3589f6c613cc0b041d4d92b2b2423775b1c3bbd755dce2054cfa163871d1e24c4f31d1a508baab61443ed97a77562f414c852d70203010001a3463044300e0603551d0f0101ff0404030205a030130603551d25040c300a06082b06010505070301300c0603551d130101ff04023000300f0603551d110408300687047f000001304106092a864886f70d01010a3034a00f300d06096086480165030402010500a11c301a06092a864886f70d010108300d06096086480165030402010500a20302012003818100cdac4ef2ce5f8d79881042707f7cbf1b5a8a00ef19154b40151771006cd41626e5496d56da0c1a139fd84695593cb67f87765e18aa03ea067522dd78d2a589b8c92364e12838ce346c6e067b51f1a7e6f4b37ffab13f1411896679d18e880e0ba09e302ac067efca460288e9538122692297ad8093d4f7dd701424d7700a46a1")
@@ -1749,9 +1770,15 @@ func TestCloneHash(t *testing.T) {
}
}
+func expectError(t *testing.T, err error, sub string) {
+ if err == nil {
+ t.Errorf(`expected error %q, got nil`, sub)
+ } else if !strings.Contains(err.Error(), sub) {
+ t.Errorf(`expected error %q, got %q`, sub, err)
+ }
+}
+
func TestKeyTooSmallForRSAPSS(t *testing.T) {
- clientConn, serverConn := localPipe(t)
- client := Client(clientConn, testConfig)
cert, err := X509KeyPair([]byte(`-----BEGIN CERTIFICATE-----
MIIBcTCCARugAwIBAgIQGjQnkCFlUqaFlt6ixyz/tDANBgkqhkiG9w0BAQsFADAS
MRAwDgYDVQQKEwdBY21lIENvMB4XDTE5MDExODIzMjMyOFoXDTIwMDExODIzMjMy
@@ -1773,6 +1800,9 @@ T+E0J8wlH24pgwQHzy7Ko2qLwn1b5PW8ecrlvP1g
if err != nil {
t.Fatal(err)
}
+
+ clientConn, serverConn := localPipe(t)
+ client := Client(clientConn, testConfig)
done := make(chan struct{})
go func() {
config := testConfig.Clone()
@@ -1780,14 +1810,16 @@ T+E0J8wlH24pgwQHzy7Ko2qLwn1b5PW8ecrlvP1g
config.MinVersion = VersionTLS13
server := Server(serverConn, config)
err := server.Handshake()
- if !strings.Contains(err.Error(), "key size too small for PSS signature") {
- t.Errorf(`expected "key size too small for PSS signature", got %q`, err)
- }
+ expectError(t, err, "key size too small for PSS signature")
close(done)
}()
err = client.Handshake()
- if !strings.Contains(err.Error(), "handshake failure") {
- t.Errorf(`expected "handshake failure", got %q`, err)
- }
+ expectError(t, err, "handshake failure")
<-done
+
+ // In TLS 1.2 RSA-PSS is not used, so this should succeed. See Issue 32425.
+ serverConfig := testConfig.Clone()
+ serverConfig.Certificates = []Certificate{cert}
+ serverConfig.MaxVersion = VersionTLS12
+ testHandshake(t, testConfig, serverConfig)
}
diff --git a/src/crypto/tls/handshake_test.go b/src/crypto/tls/handshake_test.go
index aa072cef05..718e30a5d8 100644
--- a/src/crypto/tls/handshake_test.go
+++ b/src/crypto/tls/handshake_test.go
@@ -40,6 +40,7 @@ import (
var (
update = flag.Bool("update", false, "update golden files on disk")
+ fast = flag.Bool("fast", false, "impose a quick, possibly flaky timeout on recorded tests")
opensslVersionTestOnce sync.Once
opensslVersionTestErr error
diff --git a/src/crypto/tls/key_agreement.go b/src/crypto/tls/key_agreement.go
index fdf8f803a0..c92dd2e5b5 100644
--- a/src/crypto/tls/key_agreement.go
+++ b/src/crypto/tls/key_agreement.go
@@ -185,7 +185,7 @@ NextCandidate:
return nil, errors.New("tls: certificate private key does not implement crypto.Signer")
}
- signatureAlgorithm, sigType, hashFunc, err := pickSignatureAlgorithm(priv.Public(), clientHello.supportedSignatureAlgorithms, supportedSignatureAlgorithms(), ka.version)
+ signatureAlgorithm, sigType, hashFunc, err := pickSignatureAlgorithm(priv.Public(), clientHello.supportedSignatureAlgorithms, supportedSignatureAlgorithmsTLS12(), ka.version)
if err != nil {
return nil, err
}
diff --git a/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384 b/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384
index 9408527297..22115d5565 100644
--- a/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384
+++ b/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384
@@ -16,11 +16,11 @@
000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0|
000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t|
>>> Flow 2 (server to client)
-00000000 16 03 03 00 59 02 00 00 55 03 03 44 13 0c ac b2 |....Y...U..D....|
-00000010 4f 77 03 bb 69 b5 db 3f f5 c3 14 20 6f 8b c7 e1 |Ow..i..?... o...|
-00000020 28 40 01 a0 04 f7 29 76 42 65 b0 20 91 89 84 74 |(@....)vBe. ...t|
-00000030 8e ed c8 c3 48 67 a5 75 93 ec d3 3e 26 e4 aa c6 |....Hg.u...>&...|
-00000040 39 e7 9f 78 d3 ab 3c c0 6a 05 32 7e c0 30 00 00 |9..x..<.j.2~.0..|
+00000000 16 03 03 00 59 02 00 00 55 03 03 41 6b 69 65 47 |....Y...U..AkieG|
+00000010 8c 15 2f d5 6d 1a 3d 0c ff 56 ad 42 31 6c 1f 86 |../.m.=..V.B1l..|
+00000020 06 62 e3 e4 18 9c 5c 47 9e 8c 66 20 af ba 7c 62 |.b....\G..f ..|b|
+00000030 c2 32 f4 49 f1 8d f4 ba 7a 51 23 32 46 96 7e b8 |.2.I....zQ#2F.~.|
+00000040 f0 2c ae 0a d4 04 49 16 4a 64 79 c8 c0 30 00 00 |.,....I.Jdy..0..|
00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................|
00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..|
00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............|
@@ -60,17 +60,17 @@
00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.|
000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..|
000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......|
-000002c0 ac 0c 00 00 a8 03 00 1d 20 f7 1b 54 ea 8f 34 2c |........ ..T..4,|
-000002d0 09 c5 a1 63 17 9c be f5 3d 6d 58 97 63 13 db 67 |...c....=mX.c..g|
-000002e0 fb 96 ef 45 c2 8c 30 12 02 08 04 00 80 d7 1a 46 |...E..0........F|
-000002f0 a1 90 80 71 eb 2d 27 60 a1 aa 7c 06 79 0a e7 78 |...q.-'`..|.y..x|
-00000300 47 18 95 de 90 a0 cf b4 ff 0e 35 24 43 05 18 9a |G.........5$C...|
-00000310 e4 1d 23 af cb cd e1 09 81 3b a8 18 7e 30 50 3d |..#......;..~0P=|
-00000320 dd be 91 3c ec 79 3c 83 aa 78 6a d0 75 70 cf 53 |...<.y<..xj.up.S|
-00000330 07 b7 8a f1 8c 4d 03 27 d5 0e 40 57 5d c3 0f 4e |.....M.'..@W]..N|
-00000340 63 44 84 11 47 8e 5d fd 66 75 4d ce 1d 91 6f bb |cD..G.].fuM...o.|
-00000350 f5 ae 3b b2 88 5f bb d0 55 73 74 c4 8e a8 70 44 |..;.._..Ust...pD|
-00000360 0f 08 10 7a f0 34 fc c8 4d 65 3d ed a1 16 03 03 |...z.4..Me=.....|
+000002c0 ac 0c 00 00 a8 03 00 1d 20 9e 80 b0 95 af 3b 4c |........ .....;L|
+000002d0 e7 fb 97 65 d0 36 8f 97 88 0d 3b 5d a0 21 a8 78 |...e.6....;].!.x|
+000002e0 81 39 4c 80 5c 58 52 6e 68 08 04 00 80 41 c6 e7 |.9L.\XRnh....A..|
+000002f0 c9 48 c1 be 17 a6 a3 3c 3a de c8 c8 86 6e 70 37 |.H.....<:....np7|
+00000300 2f d3 ed 8a dd 3a 73 5c b5 23 49 a8 4a fe e9 2b |/....:s\.#I.J..+|
+00000310 4e 99 43 b8 e8 05 f9 fe 90 bf 74 be 92 3d d8 a3 |N.C.......t..=..|
+00000320 c2 b2 38 80 1c 82 1f 35 e1 2e 04 bf a6 0a ec 3f |..8....5.......?|
+00000330 81 4c a2 2b 19 8f 91 4c 51 b5 0d 52 1e 69 84 0a |.L.+...LQ..R.i..|
+00000340 b0 cb de 41 1a bd a6 3d 50 9a ca d2 c0 26 11 3f |...A...=P....&.?|
+00000350 cd 80 b4 2d 6e 03 f2 c5 2b cd 9c b6 a4 d8 e6 cf |...-n...+.......|
+00000360 ec 1d 7a a9 17 59 6c 89 17 2f 64 0a 7c 16 03 03 |..z..Yl../d.|...|
00000370 00 3a 0d 00 00 36 03 01 02 40 00 2e 04 03 05 03 |.:...6...@......|
00000380 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................|
00000390 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................|
@@ -112,26 +112,26 @@
00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.|
00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...|
00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....|
-00000230 88 0f 00 00 84 08 04 00 80 6d 3c 47 cb 26 af e0 |.........m|
+00000280 92 af 5a a6 0c 8a e0 e3 d3 b9 9b 47 ea 67 61 69 |..Z........G.gai|
+00000290 d8 c1 86 1d fd 43 d4 1f 5c f5 48 d8 4a 97 a7 0f |.....C..\.H.J...|
+000002a0 57 59 b0 5f e8 24 3f 9e 1d 96 3d 4b be 9c fa e3 |WY._.$?...=K....|
+000002b0 3b 34 7e aa 67 d7 cc ea 78 14 03 03 00 01 01 16 |;4~.g...x.......|
+000002c0 03 03 00 28 00 00 00 00 00 00 00 00 33 b3 7b c9 |...(........3.{.|
+000002d0 3f e8 7d 08 3d 65 a3 22 fa e3 04 79 d9 9f 54 a3 |?.}.=e."...y..T.|
+000002e0 45 e7 64 b2 5d 95 cf dd 88 cc ba 0b |E.d.].......|
>>> Flow 4 (server to client)
-00000000 14 03 03 00 01 01 16 03 03 00 28 cf 58 0e 80 3b |..........(.X..;|
-00000010 f9 c1 03 02 1f e3 c9 d0 24 5d 0d 7b 6d 45 f7 1a |........$].{mE..|
-00000020 22 a7 94 82 a5 c1 f3 cd df 0f e0 66 0e 6f 62 7b |"..........f.ob{|
-00000030 d6 fb 07 |...|
+00000000 14 03 03 00 01 01 16 03 03 00 28 7e 38 ab 82 0c |..........(~8...|
+00000010 fd fa b9 83 3e 77 ed 22 b5 9d d3 c1 ca cd 18 c5 |....>w."........|
+00000020 1c 01 a0 b8 8b 96 20 92 7b bd 0a 33 ee fe be 75 |...... .{..3...u|
+00000030 95 6e 0c |.n.|
>>> Flow 5 (client to server)
-00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 66 26 3d |.............f&=|
-00000010 31 f1 eb ae 19 79 c5 97 5d 70 b6 2f fc b9 7e c8 |1....y..]p./..~.|
-00000020 2f c7 70 15 03 03 00 1a 00 00 00 00 00 00 00 02 |/.p.............|
-00000030 30 7b dd 4c f2 3d aa 01 c5 55 07 ed 7a bb ff b6 |0{.L.=...U..z...|
-00000040 91 25 |.%|
+00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 9d f0 cd |................|
+00000010 53 8d 1a 45 ae 4a e4 01 97 dd ac f1 00 d3 aa b6 |S..E.J..........|
+00000020 bf c9 bc 15 03 03 00 1a 00 00 00 00 00 00 00 02 |................|
+00000030 aa 1b 41 d5 f5 68 41 b8 32 94 9b 23 f8 60 7b 60 |..A..hA.2..#.`{`|
+00000040 2c 8a |,.|
diff --git a/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-ECDSA b/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-ECDSA
index c9d74439f0..db82b3837e 100644
--- a/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-ECDSA
+++ b/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-ECDSA
@@ -16,11 +16,11 @@
000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0|
000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t|
>>> Flow 2 (server to client)
-00000000 16 03 03 00 59 02 00 00 55 03 03 61 3f 7c 9a 87 |....Y...U..a?|..|
-00000010 de 3b 63 d2 7e 08 97 8a 84 d1 78 f0 25 0e d6 cd |.;c.~.....x.%...|
-00000020 a0 e0 0c 90 e2 63 70 54 5b 3b 11 20 ef dc d6 32 |.....cpT[;. ...2|
-00000030 f4 4f 37 07 e9 75 89 a1 2f 8b ca 8a dd 5c 3d 6c |.O7..u../....\=l|
-00000040 9c 8b 89 07 38 ac d2 7e ab 98 b9 e5 c0 09 00 00 |....8..~........|
+00000000 16 03 03 00 59 02 00 00 55 03 03 59 e6 a5 3d 5a |....Y...U..Y..=Z|
+00000010 bf 25 a3 16 e7 e3 da cb ac b7 11 09 0a 1a 8a c5 |.%..............|
+00000020 33 a2 a6 58 12 27 cd 52 15 28 c9 20 23 9a f5 d3 |3..X.'.R.(. #...|
+00000030 d4 df 49 1d 01 87 12 36 03 c6 36 17 39 d0 db 62 |..I....6..6.9..b|
+00000040 22 48 7e 57 20 ab a3 7c b0 53 7e f1 c0 09 00 00 |"H~W ..|.S~.....|
00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................|
00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..|
00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....|
@@ -55,23 +55,23 @@
00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....|
00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.|
00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....|
-00000270 2a 16 03 03 00 b7 0c 00 00 b3 03 00 1d 20 9e 1c |*............ ..|
-00000280 a9 0f 8a 83 fb 33 a7 a4 0e 75 9a 96 ba 14 59 26 |.....3...u....Y&|
-00000290 48 ad 94 ad 79 d0 81 f1 b6 39 eb c8 6b 45 04 03 |H...y....9..kE..|
-000002a0 00 8b 30 81 88 02 42 01 49 b1 7a 06 09 c7 41 16 |..0...B.I.z...A.|
-000002b0 65 2f 0b 89 47 2e 53 10 0a 9e 18 c4 c6 39 f8 74 |e/..G.S......9.t|
-000002c0 79 49 e8 45 76 88 78 d7 2b 93 61 4a 78 93 e4 32 |yI.Ev.x.+.aJx..2|
-000002d0 74 57 5f 77 d6 65 de b6 13 50 d5 06 43 40 c3 98 |tW_w.e...P..C@..|
-000002e0 87 7a 8b 90 54 3d 62 fa 7e 02 42 00 aa 6c 3b 6b |.z..T=b.~.B..l;k|
-000002f0 3f 15 1d 23 ef 50 bf 09 18 65 4b b0 5f 67 ba d9 |?..#.P...eK._g..|
-00000300 c7 dd 1d 26 30 9c 5b 14 50 61 93 da e0 8f 77 82 |...&0.[.Pa....w.|
-00000310 43 6b d0 81 75 96 ac 0e 24 96 54 bf e2 22 a9 4e |Ck..u...$.T..".N|
-00000320 90 07 de 61 86 f0 a4 09 59 5e d3 e5 3d 16 03 03 |...a....Y^..=...|
-00000330 00 3a 0d 00 00 36 03 01 02 40 00 2e 04 03 05 03 |.:...6...@......|
-00000340 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................|
-00000350 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................|
-00000360 03 02 02 02 04 02 05 02 06 02 00 00 16 03 03 00 |................|
-00000370 04 0e 00 00 00 |.....|
+00000270 2a 16 03 03 00 b6 0c 00 00 b2 03 00 1d 20 a7 6b |*............ .k|
+00000280 75 97 e7 04 a7 19 99 af c7 73 72 82 59 7d 16 46 |u........sr.Y}.F|
+00000290 de 80 c2 d3 36 c7 e8 42 89 ca 8d db 11 39 04 03 |....6..B.....9..|
+000002a0 00 8a 30 81 87 02 41 73 4f fe e2 00 9d bf 60 0a |..0...AsO.....`.|
+000002b0 36 0b 97 8a fc 3e 8c 1d ac ff a2 0b 7a dc 8d 2f |6....>......z../|
+000002c0 d7 90 da 18 a0 14 8a 7c 51 4c a6 ae ec 13 ee 5e |.......|QL.....^|
+000002d0 1a 60 aa 2f 5a d2 05 48 fb bb bb 3a 1a dc fa 21 |.`./Z..H...:...!|
+000002e0 df 7b 6d 83 23 d6 62 0f 02 42 01 7f 5a 36 6d f4 |.{m.#.b..B..Z6m.|
+000002f0 0d f5 d0 6f d9 71 52 f8 eb e3 ed 7c 40 fd 64 14 |...o.qR....|@.d.|
+00000300 c1 31 4d 4b 78 70 5d 9f 61 18 3b 87 01 10 94 e5 |.1MKxp].a.;.....|
+00000310 7b 83 34 2d cd 90 50 db 10 62 8d 36 40 45 20 c0 |{.4-..P..b.6@E .|
+00000320 db ce de 5e b3 63 de 60 db bb fe be 16 03 03 00 |...^.c.`........|
+00000330 3a 0d 00 00 36 03 01 02 40 00 2e 04 03 05 03 06 |:...6...@.......|
+00000340 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 08 |................|
+00000350 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 03 |................|
+00000360 02 02 02 04 02 05 02 06 02 00 00 16 03 03 00 04 |................|
+00000370 0e 00 00 00 |....|
>>> Flow 3 (client to server)
00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0|
00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.|
@@ -108,31 +108,31 @@
00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.|
00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...|
00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....|
-00000230 88 0f 00 00 84 08 04 00 80 1f 32 e0 7a 18 d4 63 |..........2.z..c|
-00000240 9b a3 30 16 57 2d 0e 13 78 b6 a9 07 90 04 34 7d |..0.W-..x.....4}|
-00000250 2d e8 db b6 bb 95 07 80 6c 4b 59 d7 47 34 b2 d5 |-.......lKY.G4..|
-00000260 3a 91 87 80 a4 7d bb 9f f2 dc dc 9e 7c cb cc 53 |:....}......|..S|
-00000270 b2 46 60 3e 27 ab 46 94 03 d2 a8 f6 b3 66 81 b8 |.F`>'.F......f..|
-00000280 13 2d e2 78 c7 1c ad 51 05 77 79 c1 87 b4 0d 1d |.-.x...Q.wy.....|
-00000290 95 8d 3f 4d a2 61 94 f8 bf 30 84 b4 42 6e 42 b0 |..?M.a...0..BnB.|
-000002a0 aa 73 57 65 86 1e b2 af c8 4b 03 84 1e 2a 3a f4 |.sWe.....K...*:.|
-000002b0 6e 45 73 9e 65 0a ca 3f 8a 14 03 03 00 01 01 16 |nEs.e..?........|
+00000230 88 0f 00 00 84 04 01 00 80 88 59 ec 09 a4 c9 5e |..........Y....^|
+00000240 37 b4 e3 04 71 52 1a 5a 6d d6 9b f6 09 14 01 c2 |7...qR.Zm.......|
+00000250 3e 07 19 2f ec 15 d9 5b 12 6a 6e de 78 a3 ac 58 |>../...[.jn.x..X|
+00000260 40 44 f2 66 0a 12 a5 62 37 8b af 5a 3a 20 be f2 |@D.f...b7..Z: ..|
+00000270 6f 43 c8 00 69 21 c8 fd b0 cf 00 74 c3 96 a0 8b |oC..i!.....t....|
+00000280 6f ce c1 09 e6 90 1d 8e 53 40 b8 44 83 b9 46 9c |o.......S@.D..F.|
+00000290 78 3b c1 0a 36 68 a5 04 e8 b5 ed 6d 7d 09 21 8c |x;..6h.....m}.!.|
+000002a0 0e 00 0c 5e d0 2b 47 c9 f6 31 f6 8f 7b b6 2d 8d |...^.+G..1..{.-.|
+000002b0 ec 4e c2 0d 08 c5 1b 26 b6 14 03 03 00 01 01 16 |.N.....&........|
000002c0 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 00 |...@............|
-000002d0 00 00 00 00 ae b6 dd 09 5d ec ff 1c 09 88 eb a4 |........].......|
-000002e0 be c2 76 48 0c f0 7b 6f 50 f8 52 f9 81 97 28 aa |..vH..{oP.R...(.|
-000002f0 31 31 91 ea 98 80 50 55 e0 71 9b 82 9b e8 48 ec |11....PU.q....H.|
-00000300 3d 45 c3 f2 |=E..|
+000002d0 00 00 00 00 e7 64 7d 04 bb bf dd 2a ac fd 96 81 |.....d}....*....|
+000002e0 25 d8 3e 6c 1d 53 c7 79 31 4d 13 c3 71 d3 da c0 |%.>l.S.y1M..q...|
+000002f0 f8 74 11 bb 6b 9d 62 66 ed f0 97 ab 43 fe 12 cb |.t..k.bf....C...|
+00000300 da 8d c2 4b |...K|
>>> Flow 4 (server to client)
-00000000 14 03 03 00 01 01 16 03 03 00 40 ca 5e 0f 47 25 |..........@.^.G%|
-00000010 5c a6 64 4d 90 74 ba d2 0b e8 df 3b cf 43 9a a7 |\.dM.t.....;.C..|
-00000020 95 28 d2 a6 0c 27 0f a9 d0 bf 11 c1 52 52 04 32 |.(...'......RR.2|
-00000030 14 9d 4a a1 35 3b 1d 5c 84 b5 72 79 5a fc 4c c9 |..J.5;.\..ryZ.L.|
-00000040 68 ca 64 9f b1 d9 ed 0b 98 66 53 |h.d......fS|
+00000000 14 03 03 00 01 01 16 03 03 00 40 35 ee 36 65 9a |..........@5.6e.|
+00000010 e5 ac c7 30 18 b6 ff f9 fd fa 66 88 a7 73 be ba |...0......f..s..|
+00000020 d5 89 59 26 cf 2d 8d 31 48 f0 fb 09 c1 66 ef eb |..Y&.-.1H....f..|
+00000030 94 30 b7 47 71 a1 cb 03 34 37 14 f5 76 14 13 a9 |.0.Gq...47..v...|
+00000040 6f d7 4d 59 c1 63 f8 db 8b 74 36 |o.MY.c...t6|
>>> Flow 5 (client to server)
00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........|
-00000010 00 00 00 00 00 b8 30 3e 37 f6 8f 50 8b 97 78 81 |......0>7..P..x.|
-00000020 aa 53 ab 4d 44 a4 0a d7 3c 49 7f 59 33 b5 0e 22 |.S.MD...DZ>.|
diff --git a/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSA b/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSA
index c962841760..02b11a6933 100644
--- a/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSA
+++ b/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSA
@@ -16,11 +16,11 @@
000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0|
000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t|
>>> Flow 2 (server to client)
-00000000 16 03 03 00 59 02 00 00 55 03 03 34 d6 64 e9 90 |....Y...U..4.d..|
-00000010 47 32 62 4a 36 f9 2f 2b c9 04 24 8d 9d 71 e1 ec |G2bJ6./+..$..q..|
-00000020 63 c3 14 73 e6 db 33 53 6e 79 3b 20 10 6c f9 58 |c..s..3Sny; .l.X|
-00000030 c2 2a c8 26 39 1c 33 75 f7 7b ab e0 82 ab e1 f1 |.*.&9.3u.{......|
-00000040 11 8b d3 58 18 39 11 4f b8 08 12 6b c0 2f 00 00 |...X.9.O...k./..|
+00000000 16 03 03 00 59 02 00 00 55 03 03 43 a0 10 ae 54 |....Y...U..C...T|
+00000010 09 23 be 14 d7 1d b3 64 66 5e 39 4e 42 ed 58 3a |.#.....df^9NB.X:|
+00000020 1b de 35 eb ee 9b 86 44 fe 2b a8 20 e7 f1 4a 47 |..5....D.+. ..JG|
+00000030 b1 6b f0 fb d7 ed 3c 33 4a 52 bc 9b 39 c0 16 d3 |.k....<3JR..9...|
+00000040 f4 0a 7c 38 7e b3 95 31 7a c7 c8 f4 c0 2f 00 00 |..|8~..1z..../..|
00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................|
00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..|
00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............|
@@ -60,17 +60,17 @@
00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.|
000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..|
000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......|
-000002c0 ac 0c 00 00 a8 03 00 1d 20 7e 32 3b e9 c4 9d 93 |........ ~2;....|
-000002d0 d9 b1 b3 fc 04 33 a6 1b b9 e8 1a 24 79 5e 0d bc |.....3.....$y^..|
-000002e0 e2 f9 ba cc 18 15 64 0a 69 08 04 00 80 73 c1 81 |......d.i....s..|
-000002f0 fe 44 26 be 95 56 d6 89 59 3d 5f 84 69 31 50 ed |.D&..V..Y=_.i1P.|
-00000300 77 a2 67 4a 16 3c dc f2 28 14 4e 3a 90 15 b3 db |w.gJ.<..(.N:....|
-00000310 f1 d8 e1 75 7d 61 a6 a0 33 28 72 62 3a 09 93 75 |...u}a..3(rb:..u|
-00000320 16 63 a2 8b 89 5d 83 e4 e4 d8 89 4b 82 b5 66 b6 |.c...].....K..f.|
-00000330 09 2f 30 3f 66 36 bb ae a1 67 c9 de 40 8d c3 6a |./0?f6...g..@..j|
-00000340 5c 96 74 c4 29 c1 3e 6d a0 84 f8 8d d3 0d a5 70 |\.t.).>m.......p|
-00000350 fe 38 dc 01 f0 75 64 be bf 38 ab 70 28 e2 06 b0 |.8...ud..8.p(...|
-00000360 ea 27 14 3f 0f 4e 4f fc 01 29 b0 40 64 16 03 03 |.'.?.NO..).@d...|
+000002c0 ac 0c 00 00 a8 03 00 1d 20 e7 c6 c3 84 0a b7 55 |........ ......U|
+000002d0 ff fb ae 43 10 da 03 0d 7d 91 77 90 cd 05 6a ab |...C....}.w...j.|
+000002e0 08 35 5a 38 23 79 45 9f 54 08 04 00 80 d8 b8 a1 |.5Z8#yE.T.......|
+000002f0 67 15 39 93 cc d0 ac e7 55 85 3e 62 f3 a6 d8 35 |g.9.....U.>b...5|
+00000300 5e bb 60 4e 33 70 05 47 b8 9e 8c e6 85 65 09 e2 |^.`N3p.G.....e..|
+00000310 95 4f 8a d9 4b cb 60 62 3c ef 57 81 ed b4 20 cf |.O..K.`b<.W... .|
+00000320 b1 71 d9 62 57 60 fa 07 89 12 a1 90 8f 8f 06 4a |.q.bW`.........J|
+00000330 56 c3 81 e0 b6 11 9e ce 33 fe 0f 4e b2 84 cc 4b |V.......3..N...K|
+00000340 dc d4 71 e4 43 04 61 11 a9 a6 8a 20 43 a7 0e b6 |..q.C.a.... C...|
+00000350 a8 97 43 1b e0 a9 b1 0f e8 19 68 0a 5d 38 d9 69 |..C.......h.]8.i|
+00000360 22 65 16 aa 05 16 11 cd 66 4a 4f be 90 16 03 03 |"e......fJO.....|
00000370 00 3a 0d 00 00 36 03 01 02 40 00 2e 04 03 05 03 |.:...6...@......|
00000380 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................|
00000390 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................|
@@ -112,26 +112,26 @@
00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.|
00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...|
00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....|
-00000230 88 0f 00 00 84 08 04 00 80 5f d8 fc 5f fb e6 09 |........._.._...|
-00000240 b6 2f ff 22 c5 4c bd 42 99 cb e7 ff 86 95 11 99 |./.".L.B........|
-00000250 8f 3e 4a b3 72 78 26 02 2f af 03 a2 39 e7 e2 29 |.>J.rx&./...9..)|
-00000260 ce 66 9a 72 1d bf fc 27 87 75 bf f1 ee 18 62 bd |.f.r...'.u....b.|
-00000270 47 bc ee 39 fa 9c c2 c5 59 f6 f5 59 09 34 48 a9 |G..9....Y..Y.4H.|
-00000280 02 25 e9 66 a8 d5 a6 a6 e2 67 8e a9 53 c1 2e 66 |.%.f.....g..S..f|
-00000290 a8 64 3e 5e a7 63 c0 10 36 5e 77 47 23 8f 6f 14 |.d>^.c..6^wG#.o.|
-000002a0 59 08 36 e4 2a 47 4d ff 12 b4 be bb 76 8c 21 5e |Y.6.*GM.....v.!^|
-000002b0 08 36 34 6d 9e 01 0c 7c 85 14 03 03 00 01 01 16 |.64m...|........|
-000002c0 03 03 00 28 00 00 00 00 00 00 00 00 e4 36 4e c9 |...(.........6N.|
-000002d0 5c ea e3 59 ae a1 45 74 17 b1 1e fe e4 a9 b8 da |\..Y..Et........|
-000002e0 b5 ce 4a 24 39 93 d7 ac 8f fb 74 a0 |..J$9.....t.|
+00000230 88 0f 00 00 84 04 01 00 80 2e af 25 b4 ff 00 08 |...........%....|
+00000240 c8 dc 24 49 d5 9b d0 fe b5 81 8d 4e 15 d4 63 bf |..$I.......N..c.|
+00000250 8e 4c a4 7d 96 58 a2 4b f4 25 a8 e3 39 fc df 2d |.L.}.X.K.%..9..-|
+00000260 7c a0 20 61 86 35 8e 7e ba a5 2c f3 07 ad 84 36 ||. a.5.~..,....6|
+00000270 df ef 66 e9 78 d8 5f b3 17 45 31 d4 4a 38 5c 6c |..f.x._..E1.J8\l|
+00000280 03 73 3b 74 60 c9 00 d1 64 59 c9 a5 39 00 fc bf |.s;t`...dY..9...|
+00000290 9c 3a 99 46 4b 71 90 64 8a 24 2e 37 cf 8a 42 c2 |.:.FKq.d.$.7..B.|
+000002a0 56 a6 94 97 60 c5 56 ba de 71 78 6c f2 be ce 16 |V...`.V..qxl....|
+000002b0 47 ca 0d 95 3c cc b8 6f b2 14 03 03 00 01 01 16 |G...<..o........|
+000002c0 03 03 00 28 00 00 00 00 00 00 00 00 8e 0e 3b 43 |...(..........;C|
+000002d0 63 52 24 16 91 bc 50 85 ef 34 ad b9 f0 45 e7 4c |cR$...P..4...E.L|
+000002e0 9a 07 1d 46 53 2c 89 79 0f 27 dc 9d |...FS,.y.'..|
>>> Flow 4 (server to client)
-00000000 14 03 03 00 01 01 16 03 03 00 28 8c 03 68 37 28 |..........(..h7(|
-00000010 47 c5 6c d6 33 ef 18 7e f0 5e 93 fe a5 8a 2e 2a |G.l.3..~.^.....*|
-00000020 72 e3 20 4d 98 d5 c5 a1 e2 55 a4 81 2b 0b b1 75 |r. M.....U..+..u|
-00000030 6c 02 20 |l. |
+00000000 14 03 03 00 01 01 16 03 03 00 28 2f 40 03 cf 5a |..........(/@..Z|
+00000010 76 6c 87 87 8d 99 4c e8 76 73 6a 62 1d a5 31 bc |vl....L.vsjb..1.|
+00000020 2e 7e 23 8c 50 bf 07 b9 13 53 4a 59 a0 9b 74 b7 |.~#.P....SJY..t.|
+00000030 53 21 2d |S!-|
>>> Flow 5 (client to server)
-00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 1c 99 25 |...............%|
-00000010 ba ae 73 88 34 3e 85 49 d3 b9 00 77 6e c4 fc 67 |..s.4>.I...wn..g|
-00000020 9d c8 e2 15 03 03 00 1a 00 00 00 00 00 00 00 02 |................|
-00000030 34 5f 22 7e 6f ee e7 03 fd 9e 30 9d 0f 63 85 d7 |4_"~o.....0..c..|
-00000040 c5 b7 |..|
+00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 83 69 b1 |..............i.|
+00000010 20 19 eb db d4 58 e7 f1 5a 95 b0 d3 9d 3b 74 ad | ....X..Z....;t.|
+00000020 bc 94 c4 15 03 03 00 1a 00 00 00 00 00 00 00 02 |................|
+00000030 7d 89 89 25 40 be 0d fc 24 d0 ff 5a 0f 24 5d f2 |}..%@...$..Z.$].|
+00000040 a3 ab |..|
diff --git a/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSAPKCS1v15 b/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSAPKCS1v15
index 0d05500264..26308fc9df 100644
--- a/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSAPKCS1v15
+++ b/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSAPKCS1v15
@@ -16,11 +16,11 @@
000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0|
000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t|
>>> Flow 2 (server to client)
-00000000 16 03 03 00 59 02 00 00 55 03 03 57 1c f0 38 28 |....Y...U..W..8(|
-00000010 4d 98 4e 9f 99 d8 d7 4d 7d c9 d9 bb 9d 80 b8 a5 |M.N....M}.......|
-00000020 ab 06 b4 55 9f 3e 9c ab bb 6a e4 20 40 56 d1 8a |...U.>...j. @V..|
-00000030 95 41 5a e0 3b 23 b7 c7 b9 b1 7b 3f b8 7a 02 c3 |.AZ.;#....{?.z..|
-00000040 f5 4b 20 b9 1b 42 7a df 81 99 c0 be c0 2f 00 00 |.K ..Bz....../..|
+00000000 16 03 03 00 59 02 00 00 55 03 03 97 f2 cb de f1 |....Y...U.......|
+00000010 bb cf 9a 6c 6d 7e e2 94 af 9d 0b ed 02 cf fc b2 |...lm~..........|
+00000020 80 b2 7b 41 2c a6 83 e7 52 62 93 20 63 23 7f 48 |..{A,...Rb. c#.H|
+00000030 be c1 7f d3 75 34 fe 3a ad 27 f5 99 b0 73 91 df |....u4.:.'...s..|
+00000040 b3 e9 82 95 cd 1b f9 08 b6 3d 4f 9b c0 2f 00 00 |.........=O../..|
00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................|
00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..|
00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............|
@@ -60,17 +60,17 @@
00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.|
000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..|
000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......|
-000002c0 ac 0c 00 00 a8 03 00 1d 20 ea fc 3d 92 b1 b7 a9 |........ ..=....|
-000002d0 28 d1 cf d8 03 d7 91 8f c6 12 01 d8 ba cf fa 9f |(...............|
-000002e0 cf 4b bc 8a 29 89 c0 54 4e 04 01 00 80 7d 62 b4 |.K..)..TN....}b.|
-000002f0 35 a9 dd 44 4a 31 44 e0 a8 e4 47 86 1b 69 62 87 |5..DJ1D...G..ib.|
-00000300 e5 a8 06 e3 6e f1 ef b9 46 bc d8 db c0 75 81 d1 |....n...F....u..|
-00000310 4c a2 0d 30 18 cd 89 4b 7b 26 bb 0b 44 2c 56 41 |L..0...K{&..D,VA|
-00000320 97 8d be 5e 86 e9 36 e5 d0 04 c8 c3 0c d3 f3 ce |...^..6.........|
-00000330 9b 56 6a 6d bc 05 2b 5a 2b fb 26 bd 82 b1 1e 09 |.Vjm..+Z+.&.....|
-00000340 8c c5 4c a5 e7 c0 d2 12 77 3e 31 df 19 5e 20 82 |..L.....w>1..^ .|
-00000350 4a a3 6d fe 7f ec 4e eb 01 73 e0 6f 6d 9f 77 7a |J.m...N..s.om.wz|
-00000360 6d 6b 9c 39 00 45 e2 d8 d9 f2 42 b9 6f 16 03 03 |mk.9.E....B.o...|
+000002c0 ac 0c 00 00 a8 03 00 1d 20 f8 3a 6c 5b 6f 88 48 |........ .:l[o.H|
+000002d0 19 c5 a2 e7 4a d9 6d 21 56 23 63 1b 1f 95 aa bc |....J.m!V#c.....|
+000002e0 33 ac aa 3b bb f8 35 ba 1a 04 01 00 80 98 6d 7b |3..;..5.......m{|
+000002f0 7d 40 13 81 6b 70 ec ac 60 ee 1d 3e 37 36 bc f4 |}@..kp..`..>76..|
+00000300 c1 9f 3c 13 b7 06 3d 38 be 4f 8c 3e e2 2e f2 b5 |..<...=8.O.>....|
+00000310 de 16 ec a0 5b 64 00 5c c3 50 cc 79 a2 f7 e0 8d |....[d.\.P.y....|
+00000320 68 e6 6b 1b b8 57 a4 15 d0 2c d7 4a be 97 26 26 |h.k..W...,.J..&&|
+00000330 8c 5c 4e 26 36 96 48 b5 0f 88 7b 37 43 e4 d1 24 |.\N&6.H...{7C..$|
+00000340 01 3c 70 38 99 c6 e2 2f 66 e7 db 57 30 f2 72 d0 |.>> Flow 3 (client to server)
@@ -109,26 +109,26 @@
00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.|
00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...|
00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....|
-00000230 88 0f 00 00 84 04 01 00 80 3d 2d 03 f9 c8 89 09 |.........=-.....|
-00000240 5a e2 08 62 f5 9e 8c 38 be 74 6c 17 6d b6 58 b1 |Z..b...8.tl.m.X.|
-00000250 17 6c 47 1a 66 83 a9 78 35 1b 3d 8e 2c 38 71 b3 |.lG.f..x5.=.,8q.|
-00000260 f3 4d 7d 8a fe 3b ef 19 5a 46 20 5a 38 61 42 dd |.M}..;..ZF Z8aB.|
-00000270 d3 21 1b aa 4f 6f 2f 58 ff c0 17 a2 a3 ea f2 d3 |.!..Oo/X........|
-00000280 f4 88 c0 d6 a2 99 38 b1 6e 71 fe f8 07 ba 50 7e |......8.nq....P~|
-00000290 54 a5 b4 9a 5d 0a 2e 48 d4 f2 c9 89 79 1a ba 8e |T...]..H....y...|
-000002a0 10 44 3f 50 f6 7b 27 f1 a0 b2 63 80 42 d4 be 7b |.D?P.{'...c.B..{|
-000002b0 0c 91 bf 49 3b 4d 94 04 ec 14 03 03 00 01 01 16 |...I;M..........|
-000002c0 03 03 00 28 00 00 00 00 00 00 00 00 6f d2 48 9d |...(........o.H.|
-000002d0 1d 53 c5 a4 db b0 ef f9 17 ef 64 4b fd 11 84 ee |.S........dK....|
-000002e0 e0 fe 42 30 43 16 a8 dc 11 30 29 b7 |..B0C....0).|
+00000230 88 0f 00 00 84 04 01 00 80 a8 12 9d 84 c2 17 0a |................|
+00000240 03 ae bd 87 9a b6 6f 65 2f 7a 04 1f 69 2a 41 f4 |......oe/z..i*A.|
+00000250 d0 9a 4d a4 5b 6e d2 d3 42 c3 77 4f 04 28 ce e6 |..M.[n..B.wO.(..|
+00000260 d4 25 c5 81 1b 78 91 e9 1e 93 90 57 b2 58 6f 26 |.%...x.....W.Xo&|
+00000270 ed 20 15 62 ff e9 c6 c1 52 4a 9a 05 a6 cd 17 22 |. .b....RJ....."|
+00000280 75 c8 81 da a4 96 af c6 83 b5 5c 81 93 59 44 26 |u.........\..YD&|
+00000290 5b 03 59 9d ab 93 ee c7 37 61 74 e7 4a 22 1c ec |[.Y.....7at.J"..|
+000002a0 96 fb a2 c9 ea 2d 4b 8d d3 a7 e4 60 57 10 be b7 |.....-K....`W...|
+000002b0 60 80 4f ee 8e 21 6b a2 13 14 03 03 00 01 01 16 |`.O..!k.........|
+000002c0 03 03 00 28 00 00 00 00 00 00 00 00 16 82 4a c0 |...(..........J.|
+000002d0 98 7b 62 3e 9b da a9 ac 31 f2 32 a9 23 13 2f e3 |.{b>....1.2.#./.|
+000002e0 77 c9 1e ca 39 9f 4c 8a 10 58 33 67 |w...9.L..X3g|
>>> Flow 4 (server to client)
-00000000 14 03 03 00 01 01 16 03 03 00 28 94 ad 3c 46 c1 |..........(..>> Flow 5 (client to server)
-00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 6b 76 96 |.............kv.|
-00000010 5d 39 75 c4 e6 6c 94 f7 ab 20 75 d3 9d 90 1d 50 |]9u..l... u....P|
-00000020 4a de 73 15 03 03 00 1a 00 00 00 00 00 00 00 02 |J.s.............|
-00000030 a0 62 20 d2 d8 2f e8 9f 93 97 9e 3b b9 e8 47 69 |.b ../.....;..Gi|
-00000040 3f ee |?.|
+00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 1c 19 9e |................|
+00000010 a5 40 f6 d7 8b 80 23 8a 0b fa 14 65 08 6a 3c 66 |.@....#....e.j>> Flow 2 (server to client)
-00000000 16 03 03 00 59 02 00 00 55 03 03 e5 8a 69 16 37 |....Y...U....i.7|
-00000010 65 58 a7 2b 85 d8 ff 46 bb 32 af b3 10 ef ee 84 |eX.+...F.2......|
-00000020 d4 a7 72 d0 5d 8e 59 7a a4 07 fe 20 19 76 75 fd |..r.].Yz... .vu.|
-00000030 19 e5 64 98 83 fc 3d 59 4b 8a 39 fc 66 61 c5 5d |..d...=YK.9.fa.]|
-00000040 58 09 7d 04 69 3c 30 9c e8 e8 33 6a c0 2f 00 00 |X.}.i<0...3j./..|
+00000000 16 03 03 00 59 02 00 00 55 03 03 be 63 44 bb 7e |....Y...U...cD.~|
+00000010 0d 88 88 15 b1 ed 7e 75 03 57 25 1a 0c 52 42 31 |......~u.W%..RB1|
+00000020 f8 e1 46 e3 11 27 ff 05 5e 26 2e 20 e6 31 d0 a6 |..F..'..^&. .1..|
+00000030 d9 7c 69 a6 57 09 ee 50 c5 3c 5e 1d a0 a7 2b 7a |.|i.W..P.<^...+z|
+00000040 7c dd 04 b4 38 45 c9 90 a0 98 33 68 c0 2f 00 00 ||...8E....3h./..|
00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................|
00000060 03 02 66 0b 00 02 62 00 02 5f 00 02 5c 30 82 02 |..f...b.._..\0..|
00000070 58 30 82 01 8d a0 03 02 01 02 02 11 00 f2 99 26 |X0.............&|
@@ -61,75 +61,82 @@
000002a0 11 89 66 79 d1 8e 88 0e 0b a0 9e 30 2a c0 67 ef |..fy.......0*.g.|
000002b0 ca 46 02 88 e9 53 81 22 69 22 97 ad 80 93 d4 f7 |.F...S."i"......|
000002c0 dd 70 14 24 d7 70 0a 46 a1 16 03 03 00 ac 0c 00 |.p.$.p.F........|
-000002d0 00 a8 03 00 1d 20 12 58 2b bb a1 46 a0 0c 3b 58 |..... .X+..F..;X|
-000002e0 1e 57 93 c2 b2 7f 58 ec d1 ed 91 a1 6d e9 4f 8b |.W....X.....m.O.|
-000002f0 cb 81 c4 73 a5 04 08 04 00 80 cd 29 91 fc 9b 6c |...s.......)...l|
-00000300 58 f7 34 95 41 87 90 f6 47 7d 26 5f 9c 0e ec 1c |X.4.A...G}&_....|
-00000310 90 f0 16 ad 44 9f 4f a9 90 0c f0 b1 d3 39 c8 ab |....D.O......9..|
-00000320 87 35 72 71 db d0 4a 05 78 f8 c3 2e 23 2a 57 59 |.5rq..J.x...#*WY|
-00000330 ac d4 7f c5 97 7d 0b 1e 12 71 0b cc c7 81 32 0a |.....}...q....2.|
-00000340 9f 6e 5d 63 4a 6d e1 f1 b5 17 65 3b 49 3f 11 3a |.n]cJm....e;I?.:|
-00000350 ac 05 e3 4b f0 12 c0 b0 ee 51 fb e5 0e 2f 30 3d |...K.....Q.../0=|
-00000360 a9 bd 4b de 30 0b bd 41 94 39 92 51 6b ea 89 97 |..K.0..A.9.Qk...|
-00000370 36 04 ea ed 01 d9 d4 79 80 61 16 03 03 00 0c 0d |6......y.a......|
-00000380 00 00 08 01 01 00 02 08 04 00 00 16 03 03 00 04 |................|
+000002d0 00 a8 03 00 1d 20 60 8e 8a 17 8a fc b4 4f 01 ad |..... `......O..|
+000002e0 f8 ef 44 f3 fc af 2a 90 57 7d ba 1d dd a6 17 cc |..D...*.W}......|
+000002f0 c6 4a 5f a2 fb 47 08 04 00 80 46 d8 62 04 19 4a |.J_..G....F.b..J|
+00000300 29 9b cc 3c 2c 0d 7e 67 3d 97 c0 32 65 90 28 e2 |)..<,.~g=..2e.(.|
+00000310 e9 df 7d 9b e1 62 82 a9 0b 22 99 a0 ae b9 7a 31 |..}..b..."....z1|
+00000320 75 c2 6e 61 e7 a5 64 b9 72 ce b8 04 b2 ca 14 78 |u.na..d.r......x|
+00000330 d4 b4 c2 b4 57 b4 a4 70 f9 d1 bf d0 77 e3 f5 66 |....W..p....w..f|
+00000340 c0 3f dd b2 40 30 3d d5 e9 a6 d1 49 79 ac ea b9 |.?..@0=....Iy...|
+00000350 38 43 52 3c a0 1c be 0d 18 a2 fc c0 a6 43 80 91 |8CR<.........C..|
+00000360 3f c5 c2 3a 43 31 92 ff 58 a8 40 52 b3 99 0f c4 |?..:C1..X.@R....|
+00000370 c6 00 89 0b b9 f4 9e 28 cd bf 16 03 03 00 0c 0d |.......(........|
+00000380 00 00 08 01 01 00 02 04 01 00 00 16 03 03 00 04 |................|
00000390 0e 00 00 00 |....|
>>> Flow 3 (client to server)
-00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0|
-00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.|
-00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.|
-00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1|
-00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C|
-00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523|
-00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231|
-00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac|
-00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.|
-00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....|
-000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x|
-000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.|
-000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4|
-000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..|
-000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#|
-000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....|
-00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......|
-00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..|
-00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U|
-00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U|
-00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......|
-00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.|
-00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0|
-00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........|
-00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..|
-00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]|
-000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A|
-000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...|
-000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...|
-000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......|
-000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{|
-000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....|
-00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.|
-00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...|
-00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....|
-00000230 88 0f 00 00 84 08 04 00 80 5a e9 85 d9 20 4b f7 |.........Z... K.|
-00000240 3e 70 ad 9b e9 8b 92 28 0f 8e 10 de bf 62 9e 34 |>p.....(.....b.4|
-00000250 5b b4 5e be 1e d4 59 18 e2 0b 46 b1 88 10 8f 19 |[.^...Y...F.....|
-00000260 3b 34 aa 4b fa 35 c4 f2 b5 09 75 af 7b 62 4f b7 |;4.K.5....u.{bO.|
-00000270 e5 6b a5 76 c4 c9 62 f3 36 aa 55 31 a0 6e 71 f1 |.k.v..b.6.U1.nq.|
-00000280 3c 40 e4 46 88 1c 96 cf 04 85 cc 92 32 65 49 be |<@.F........2eI.|
-00000290 a7 72 c7 2b b1 71 c6 6b a0 87 67 26 8f 5c 14 f7 |.r.+.q.k..g&.\..|
-000002a0 18 27 f3 13 f5 b5 31 a0 7e 6a b3 a9 ac b8 06 d5 |.'....1.~j......|
-000002b0 e5 9c ec 87 51 1c f6 aa 57 14 03 03 00 01 01 16 |....Q...W.......|
-000002c0 03 03 00 28 00 00 00 00 00 00 00 00 3a 36 e8 ed |...(........:6..|
-000002d0 d0 88 1f 64 e1 89 b2 3d 2c e4 fb c0 cb 77 56 ca |...d...=,....wV.|
-000002e0 ea 63 be 25 e4 eb 99 3e 35 aa f2 75 |.c.%...>5..u|
+00000000 16 03 03 02 66 0b 00 02 62 00 02 5f 00 02 5c 30 |....f...b.._..\0|
+00000010 82 02 58 30 82 01 8d a0 03 02 01 02 02 11 00 f2 |..X0............|
+00000020 99 26 eb 87 ea 8a 0d b9 fc c2 47 34 7c 11 b0 30 |.&........G4|..0|
+00000030 41 06 09 2a 86 48 86 f7 0d 01 01 0a 30 34 a0 0f |A..*.H......04..|
+00000040 30 0d 06 09 60 86 48 01 65 03 04 02 01 05 00 a1 |0...`.H.e.......|
+00000050 1c 30 1a 06 09 2a 86 48 86 f7 0d 01 01 08 30 0d |.0...*.H......0.|
+00000060 06 09 60 86 48 01 65 03 04 02 01 05 00 a2 03 02 |..`.H.e.........|
+00000070 01 20 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 |. 0.1.0...U....A|
+00000080 63 6d 65 20 43 6f 30 1e 17 0d 31 37 31 31 32 33 |cme Co0...171123|
+00000090 31 36 31 36 31 30 5a 17 0d 31 38 31 31 32 33 31 |161610Z..1811231|
+000000a0 36 31 36 31 30 5a 30 12 31 10 30 0e 06 03 55 04 |61610Z0.1.0...U.|
+000000b0 0a 13 07 41 63 6d 65 20 43 6f 30 81 9f 30 0d 06 |...Acme Co0..0..|
+000000c0 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 |.*.H............|
+000000d0 30 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 |0.......F}...'.H|
+000000e0 bc 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a |..(!.~...]..RE.z|
+000000f0 36 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 |6G....B[.....y.@|
+00000100 fb 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e |.Om..+.....g....|
+00000110 d6 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 |."8.J.ts+.4.....|
+00000120 d9 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b |.t{.X.la<..A..++|
+00000130 24 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 |$#w[.;.u]. T..c.|
+00000140 1d 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 |..$....P....C...|
+00000150 75 62 f4 14 c8 52 d7 02 03 01 00 01 a3 46 30 44 |ub...R.......F0D|
+00000160 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 |0...U...........|
+00000170 30 13 06 03 55 1d 25 04 0c 30 0a 06 08 2b 06 01 |0...U.%..0...+..|
+00000180 05 05 07 03 01 30 0c 06 03 55 1d 13 01 01 ff 04 |.....0...U......|
+00000190 02 30 00 30 0f 06 03 55 1d 11 04 08 30 06 87 04 |.0.0...U....0...|
+000001a0 7f 00 00 01 30 41 06 09 2a 86 48 86 f7 0d 01 01 |....0A..*.H.....|
+000001b0 0a 30 34 a0 0f 30 0d 06 09 60 86 48 01 65 03 04 |.04..0...`.H.e..|
+000001c0 02 01 05 00 a1 1c 30 1a 06 09 2a 86 48 86 f7 0d |......0...*.H...|
+000001d0 01 01 08 30 0d 06 09 60 86 48 01 65 03 04 02 01 |...0...`.H.e....|
+000001e0 05 00 a2 03 02 01 20 03 81 81 00 cd ac 4e f2 ce |...... ......N..|
+000001f0 5f 8d 79 88 10 42 70 7f 7c bf 1b 5a 8a 00 ef 19 |_.y..Bp.|..Z....|
+00000200 15 4b 40 15 17 71 00 6c d4 16 26 e5 49 6d 56 da |.K@..q.l..&.ImV.|
+00000210 0c 1a 13 9f d8 46 95 59 3c b6 7f 87 76 5e 18 aa |.....F.Y<...v^..|
+00000220 03 ea 06 75 22 dd 78 d2 a5 89 b8 c9 23 64 e1 28 |...u".x.....#d.(|
+00000230 38 ce 34 6c 6e 06 7b 51 f1 a7 e6 f4 b3 7f fa b1 |8.4ln.{Q........|
+00000240 3f 14 11 89 66 79 d1 8e 88 0e 0b a0 9e 30 2a c0 |?...fy.......0*.|
+00000250 67 ef ca 46 02 88 e9 53 81 22 69 22 97 ad 80 93 |g..F...S."i"....|
+00000260 d4 f7 dd 70 14 24 d7 70 0a 46 a1 16 03 03 00 25 |...p.$.p.F.....%|
+00000270 10 00 00 21 20 2f e5 7d a3 47 cd 62 43 15 28 da |...! /.}.G.bC.(.|
+00000280 ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 |._.).0..........|
+00000290 5f 58 cb 3b 74 16 03 03 00 88 0f 00 00 84 04 01 |_X.;t...........|
+000002a0 00 80 d5 bf 41 e0 65 7b 32 16 bb a3 92 48 f6 0e |....A.e{2....H..|
+000002b0 31 eb ca a2 b7 1c b3 3a b4 8f 91 0e 44 e8 9e ad |1......:....D...|
+000002c0 f7 71 4c 71 20 da 59 29 09 4f 0b 1e fb 92 c5 ce |.qLq .Y).O......|
+000002d0 7b a3 26 de 89 be f5 cc b6 be dc af 09 6a f9 a2 |{.&..........j..|
+000002e0 f0 65 5c 39 2d ad 2c 46 ce df 26 09 2e 99 5d 9e |.e\9-.,F..&...].|
+000002f0 58 2b cf 1f ed b5 1a 4b 21 0b d8 ec 14 fb bb f2 |X+.....K!.......|
+00000300 eb 41 9d 1c 6a 06 d8 38 b9 68 fc 1d 90 ad ff 9c |.A..j..8.h......|
+00000310 91 c1 4a ff b0 49 59 8a 0b 25 26 eb 28 b1 a5 f8 |..J..IY..%&.(...|
+00000320 0d 8e 14 03 03 00 01 01 16 03 03 00 28 00 00 00 |............(...|
+00000330 00 00 00 00 00 cd a4 31 83 38 57 c8 91 98 4c 6c |.......1.8W...Ll|
+00000340 76 c7 e1 d8 af f9 47 ee 45 75 f4 51 6c e5 7e da |v.....G.Eu.Ql.~.|
+00000350 00 0f da 44 49 |...DI|
>>> Flow 4 (server to client)
-00000000 14 03 03 00 01 01 16 03 03 00 28 31 96 46 0c 69 |..........(1.F.i|
-00000010 f0 46 54 dc 0f c7 1c c0 0f e2 b6 8b 53 71 66 94 |.FT.........Sqf.|
-00000020 f8 7b 82 7c 76 ab 8c c3 d0 a0 0a e9 03 e8 bf 4f |.{.|v..........O|
-00000030 c4 c5 84 |...|
+00000000 14 03 03 00 01 01 16 03 03 00 28 7f 1d 85 46 4c |..........(...FL|
+00000010 7f 93 d7 e3 c1 3f a7 71 69 16 90 9a a6 f8 9a 22 |.....?.qi......"|
+00000020 a5 8b 0e 6d 6a f2 08 7e 40 6d ba 87 74 e4 e6 1d |...mj..~@m..t...|
+00000030 ba 5e ff |.^.|
>>> Flow 5 (client to server)
-00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 3c 54 13 |.............>> Flow 2 (server to client)
-00000000 16 03 03 00 59 02 00 00 55 03 03 9d 18 45 c0 0c |....Y...U....E..|
-00000010 2a 95 e6 13 ac b3 e5 fd fb b1 ed 96 75 8b d3 e9 |*...........u...|
-00000020 a9 53 cd a7 43 dc 87 18 ab 98 f4 20 2e 5d 71 f3 |.S..C...... .]q.|
-00000030 40 c8 e3 ba b1 5d 88 3d 66 71 65 a1 43 1f e8 65 |@....].=fqe.C..e|
-00000040 9c 7b 0a fc b7 81 79 e2 99 c5 c9 3e cc a8 00 00 |.{....y....>....|
+00000000 16 03 03 00 59 02 00 00 55 03 03 1c 04 37 7b 4d |....Y...U....7{M|
+00000010 49 2a 45 1d e8 db 60 7e 7d be 7b 2d ff a2 dc aa |I*E...`~}.{-....|
+00000020 b7 5e 66 f9 67 bf 58 f7 f1 0a 7b 20 f2 72 71 31 |.^f.g.X...{ .rq1|
+00000030 2a 6e 5e 2b e4 29 ef bc 3a 56 45 26 53 b4 9f 98 |*n^+.)..:VE&S...|
+00000040 fb 07 d5 2f b3 f3 f0 3b 02 1f 00 9b cc a8 00 00 |.../...;........|
00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................|
00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..|
00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............|
@@ -60,185 +60,185 @@
00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.|
000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..|
000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......|
-000002c0 ac 0c 00 00 a8 03 00 1d 20 c8 2a 20 5e 3c 62 eb |........ .* ^...}.*..|
+00000300 ec 1c 2a c1 28 22 3e 36 4f 5a fe eb 2a 6a 9e 9e |..*.(">6OZ..*j..|
+00000310 01 83 31 93 d1 bd 0f 6f ff 9d e8 4e 7a cb 9d 8f |..1....o...Nz...|
+00000320 63 92 bc f2 0e 37 1f e0 8a 1e 22 2c eb 53 e8 25 |c....7....",.S.%|
+00000330 15 20 97 1f 0c 75 5a 9d 6a aa e6 a6 86 d9 5d 4d |. ...uZ.j.....]M|
+00000340 b8 58 d1 03 63 d4 8d cb 0b 4d 97 2e eb 50 13 39 |.X..c....M...P.9|
+00000350 07 5c d9 a8 bf cf eb 05 47 0a 48 30 5b 71 c0 ea |.\......G.H0[q..|
+00000360 cb 4f 22 27 1a d2 58 02 ca 07 bd 03 f1 16 03 03 |.O"'..X.........|
00000370 00 04 0e 00 00 00 |......|
>>> Flow 3 (client to server)
00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.|
00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....|
00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......|
-00000030 16 03 03 00 20 41 b1 f9 75 8c 2e 5c 22 45 0e 79 |.... A..u..\"E.y|
-00000040 e8 50 65 39 43 57 8f d7 48 c6 89 15 d7 c0 98 88 |.Pe9CW..H.......|
-00000050 55 e7 ca eb 4a |U...J|
+00000030 16 03 03 00 20 f9 b0 26 8b 30 54 a5 80 7e 5b 47 |.... ..&.0T..~[G|
+00000040 2e b1 28 07 ef 12 93 33 5a 8d 5e de 8d 56 d5 c3 |..(....3Z.^..V..|
+00000050 3c 05 a8 f1 5e |<...^|
>>> Flow 4 (server to client)
-00000000 14 03 03 00 01 01 16 03 03 00 20 08 71 d8 91 d6 |.......... .q...|
-00000010 af 29 72 cb 85 4d a8 b2 50 e5 f4 93 d5 36 5d 6a |.)r..M..P....6]j|
-00000020 df 15 b1 65 78 17 d7 4f d6 9f 79 |...ex..O..y|
+00000000 14 03 03 00 01 01 16 03 03 00 20 c1 77 25 ba a7 |.......... .w%..|
+00000010 08 ba 0d 1e 8b e2 eb 11 77 d8 c7 e2 20 e0 60 da |........w... .`.|
+00000020 97 f5 42 f4 12 bb 94 35 b7 ee c8 |..B....5...|
>>> Flow 5 (client to server)
-00000000 17 03 03 00 16 ff 2f ef 38 41 82 36 13 74 3a 38 |....../.8A.6.t:8|
-00000010 a8 52 2c bd 4c 15 4b 7b f1 c6 f2 |.R,.L.K{...|
+00000000 17 03 03 00 16 6f f6 5b 37 2f 21 25 ae e9 30 be |.....o.[7/!%..0.|
+00000010 ce b4 66 f7 fd 9a 5a 02 9d 43 e8 |..f...Z..C.|
>>> Flow 6 (server to client)
-00000000 16 03 03 00 14 4b 1e 75 04 1a e1 14 6e 16 79 03 |.....K.u....n.y.|
-00000010 9a 3f 87 2b b1 c4 07 d7 53 |.?.+....S|
+00000000 16 03 03 00 14 8f be 53 56 e9 19 ec 85 79 d0 cc |.......SV....y..|
+00000010 8d ab 43 3c b2 7b a3 55 57 |..C<.{.UW|
>>> Flow 7 (client to server)
-00000000 16 03 03 01 16 de 71 13 6c df 97 84 38 ce 2d c6 |......q.l...8.-.|
-00000010 e3 39 e0 55 66 4e 3d 5e 6c eb c5 a8 1a aa 66 6a |.9.UfN=^l.....fj|
-00000020 32 63 97 22 88 26 b8 ad 5f 0a 78 53 9a a4 29 bb |2c.".&.._.xS..).|
-00000030 4e 23 90 36 22 1f a7 3d 9c 06 eb 27 c5 7e fb b2 |N#.6"..=...'.~..|
-00000040 bf de 93 c4 aa e1 da cb 23 15 1b 55 2f 54 3d 12 |........#..U/T=.|
-00000050 f2 62 7f 1f bb 09 16 be 1d 8b 13 eb 9e 53 e2 15 |.b...........S..|
-00000060 a5 37 72 41 48 20 9c e7 a6 ba ba 82 52 9d 2c 99 |.7rAH ......R.,.|
-00000070 0a c5 83 e1 7e 22 ec 11 f3 50 64 6f 36 ef 43 fd |....~"...Pdo6.C.|
-00000080 98 92 e4 f6 b6 fb d2 a7 1f dd f8 2a 6d 78 3b ea |...........*mx;.|
-00000090 de 84 4e 11 a1 0a 0b f6 ea c5 78 63 82 7a 0c fc |..N.......xc.z..|
-000000a0 9e 96 b2 a5 ce a8 83 ab 02 1e b1 e1 e0 12 92 8a |................|
-000000b0 19 7a 72 31 d0 92 95 e7 f2 f1 63 d1 80 4a c2 be |.zr1......c..J..|
-000000c0 b5 f4 f9 23 8d ab 21 8f c3 3d 99 5d f0 aa d2 3a |...#..!..=.]...:|
-000000d0 ee 43 17 ba d2 6b d9 2c ef b4 55 3c af e7 d3 22 |.C...k.,..U<..."|
-000000e0 c8 70 c5 3b 0b a2 02 54 a5 2e 8d 06 56 76 f9 3f |.p.;...T....Vv.?|
-000000f0 d1 b6 b7 ea 2c 90 4d 37 3f 4b 05 8a ea 88 dc 5e |....,.M7?K.....^|
-00000100 04 50 a3 d2 46 d5 22 08 e1 d6 4e a3 40 ae 0c cc |.P..F."...N.@...|
-00000110 c4 7f be ac cd b9 74 07 ad c7 07 |......t....|
+00000000 16 03 03 01 16 ab 36 6a 25 3d 93 3c 71 b6 5b 91 |......6j%=.k../.]....|
>>> Flow 8 (server to client)
-00000000 16 03 03 00 81 ed 7f 67 61 ef ed 9f 72 81 fa 1f |.......ga...r...|
-00000010 1c be 39 c5 a4 7b a8 4d 37 1c 12 f2 92 0c 9f f7 |..9..{.M7.......|
-00000020 ca a9 40 bc 83 da 2b 57 e4 6d 90 64 9e 0b 4e f3 |..@...+W.m.d..N.|
-00000030 ee 4b 02 0a f5 db 0e 6f 84 f5 d8 21 bc c8 b7 84 |.K.....o...!....|
-00000040 4e ee ad 90 ff 55 12 37 d4 94 c8 7a 8d 44 c1 58 |N....U.7...z.D.X|
-00000050 1d d5 14 2f ef 92 39 97 0a dd c9 5f 33 c6 38 c9 |.../..9...._3.8.|
-00000060 b8 c9 e8 0b cb d9 05 83 b5 78 bd 2e 35 9e 58 77 |.........x..5.Xw|
-00000070 68 df ae 88 1f 64 f6 3c 10 b5 de ee 90 45 ba fc |h....d.<.....E..|
-00000080 37 ea f1 86 65 a0 16 03 03 02 69 b0 a0 7c 81 6d |7...e.....i..|.m|
-00000090 2b 18 96 82 5c 61 0f c2 f6 82 f9 7f e6 d5 98 c7 |+...\a..........|
-000000a0 43 3b e1 a5 eb 9b 4a fc 84 83 6e db 45 d1 f8 25 |C;....J...n.E..%|
-000000b0 fe b0 db 78 4a 27 3c fa 87 3d 17 75 c1 ff 4a 59 |...xJ'<..=.u..JY|
-000000c0 49 3a a9 7f c1 48 ca e3 d3 bf 63 42 b1 18 0a 4e |I:...H....cB...N|
-000000d0 c2 b3 54 c3 59 3a 0f 8c 4d e8 c9 5d 9a 73 27 20 |..T.Y:..M..].s' |
-000000e0 8d 5b fe b3 2f bb 58 e4 f7 27 1c eb dd 3e 3a ff |.[../.X..'...>:.|
-000000f0 75 8b e5 c9 5e 91 b6 e2 47 a4 50 88 d9 04 cf 19 |u...^...G.P.....|
-00000100 06 a3 ca 09 0f 90 e7 01 23 dc d6 fa 6f 7b 03 9d |........#...o{..|
-00000110 a3 5b a3 c1 df 06 54 14 fb e1 ee 1f 82 5d c6 ab |.[....T......]..|
-00000120 aa 92 73 39 20 42 5c cd fc 55 5f 5e 61 1b 46 27 |..s9 B\..U_^a.F'|
-00000130 d9 74 c3 d0 78 87 5c df e1 3a 7f f1 f0 f6 d3 7d |.t..x.\..:.....}|
-00000140 93 cd 2b b2 ac e8 50 13 1a be 35 13 2d 0a 7d 52 |..+...P...5.-.}R|
-00000150 f3 9e f9 ec 6b 50 a8 b8 77 43 1a ce 92 42 4e 3d |....kP..wC...BN=|
-00000160 83 f3 5b 65 c8 e0 c1 f6 b9 88 eb b0 7e 33 da ca |..[e........~3..|
-00000170 c6 bd 3e 07 53 d6 79 f1 79 38 ac f8 c7 ae aa c2 |..>.S.y.y8......|
-00000180 1f aa 6f 85 22 a6 89 f3 6e 62 6e 68 f5 98 d8 98 |..o."...nbnh....|
-00000190 33 2c e0 80 f9 32 95 40 16 95 10 b2 d6 61 e2 8f |3,...2.@.....a..|
-000001a0 09 d6 9f b8 8c fc ff 40 a3 44 dc 46 a1 b9 5c 3b |.......@.D.F..\;|
-000001b0 2e ce 1d de ee 76 ca 7a f6 32 84 b8 0c 06 33 19 |.....v.z.2....3.|
-000001c0 ef 0a 41 f5 0b 35 a3 c0 c0 fd a5 4d cb 23 37 87 |..A..5.....M.#7.|
-000001d0 02 ac c3 71 42 5f f4 78 58 05 d7 41 ec 71 5c d6 |...qB_.xX..A.q\.|
-000001e0 4d 27 37 c3 3c bc 20 27 05 25 34 41 8d a5 af c4 |M'7.<. '.%4A....|
-000001f0 3c 09 cb 3d fc 76 2d 1b 81 88 8d c4 14 65 f5 50 |<..=.v-......e.P|
-00000200 8f 9f f5 18 74 19 87 6e 88 92 81 15 01 9f c3 a9 |....t..n........|
-00000210 dc 3c 46 13 f6 15 38 17 d5 f2 ee 14 f8 c5 1d 74 |...,E.Or.|
-00000280 83 90 04 3f 98 e9 5e 43 38 d1 78 fd 54 02 d2 91 |...?..^C8.x.T...|
-00000290 6d 0d e0 90 3d 8a bc 54 53 e4 57 b0 aa db d8 c5 |m...=..TS.W.....|
-000002a0 5f e8 95 0a 6f cb d8 9c 6e 75 00 43 3c 59 91 e8 |_...o...nu.C.|
-000002d0 33 c1 de 7e f7 aa 64 d6 0a 3e ae 23 4c 91 24 34 |3..~..d..>.#L.$4|
-000002e0 39 15 5f 00 ac ea 02 1e 45 4f 61 37 b3 18 54 b1 |9._.....EOa7..T.|
-000002f0 26 71 fd 01 16 03 03 00 bc 31 a0 07 0d d9 f1 26 |&q.......1.....&|
-00000300 b3 1f 2d 13 cf ad 92 f6 20 08 3c ff 2f dd 2a 7d |..-..... .<./.*}|
-00000310 16 5d 62 cb e2 f0 c9 56 ff 9e 3a ee c8 7b 69 d4 |.]b....V..:..{i.|
-00000320 d5 5d 30 41 9d 5c fc 3b e1 b7 f4 74 d1 23 fa 10 |.]0A.\.;...t.#..|
-00000330 0b c5 68 3a 67 2e 3b 85 4a 21 bb b5 3c 22 f7 e2 |..h:g.;.J!..<"..|
-00000340 b3 dd 10 8e 23 fd f8 59 78 5c 54 40 ca ba 77 49 |....#..Yx\T@..wI|
-00000350 0f 24 72 3c eb 66 73 00 ce bd c5 a2 b8 f0 94 a4 |.$r<.fs.........|
-00000360 b8 c0 fb 64 c5 61 ba bd db 17 1d 00 ca 1d ad 62 |...d.a.........b|
-00000370 e8 7e 5a e3 37 6f 79 8d 0b 64 4f a4 a4 6d d0 ce |.~Z.7oy..dO..m..|
-00000380 44 66 e2 f4 48 ea e9 1a 99 d2 5f 48 11 06 75 fd |Df..H....._H..u.|
-00000390 f3 db 52 02 72 0a 5a f6 ce 3f a8 19 10 83 fe d1 |..R.r.Z..?......|
-000003a0 7c 54 b3 cf 79 c8 52 78 ee 9d 96 da 8e ae 08 9f ||T..y.Rx........|
-000003b0 8a 96 87 a6 d1 16 03 03 00 4a cc 16 c5 00 5d 97 |.........J....].|
-000003c0 18 cc d2 93 bd fe 20 12 7d f1 21 94 27 28 22 6d |...... .}.!.'("m|
-000003d0 64 d4 8c ae 92 fa b0 9d 13 0c 8a d8 b1 e9 7b d2 |d.............{.|
-000003e0 5f b9 2c 5f a6 92 39 c6 e3 97 88 7f 62 0c 91 ab |_.,_..9.....b...|
-000003f0 16 6c aa d4 26 10 9c 1d fc 96 4b 0c 1e a8 4c 05 |.l..&.....K...L.|
-00000400 f6 87 41 08 16 03 03 00 14 cb 96 40 62 2b b5 2c |..A........@b+.,|
-00000410 a2 1e 0a b8 37 4c 0c 98 44 80 d2 80 31 |....7L..D...1|
+00000000 16 03 03 00 81 21 a2 14 95 1e 02 74 1b aa c5 ec |.....!.....t....|
+00000010 3f 9f 1a 88 67 00 8b 16 68 54 52 bb df f7 4c 75 |?...g...hTR...Lu|
+00000020 57 49 e3 00 1e b2 6f 61 67 eb ac 1e 77 31 bc e1 |WI....oag...w1..|
+00000030 66 a9 db 13 8b 43 d3 73 f9 57 97 1d 75 bd fc 78 |f....C.s.W..u..x|
+00000040 1b 0c 92 a4 66 95 d6 89 3d 86 63 a6 e8 15 5d d2 |....f...=.c...].|
+00000050 65 4c b5 2b f7 3d be 81 17 e6 23 64 65 26 68 b8 |eL.+.=....#de&h.|
+00000060 14 6b 68 24 78 19 84 a4 a1 82 d2 b6 6f d1 58 68 |.kh$x.......o.Xh|
+00000070 43 db 14 90 af 15 3c 8d 0c 5d b3 26 f3 14 7f cf |C.....<..].&....|
+00000080 09 05 2a 2a 5d 21 16 03 03 02 69 f3 b0 da 24 57 |..**]!....i...$W|
+00000090 c9 6b 11 b6 67 20 2c 5f 64 53 ca a5 71 26 95 89 |.k..g ,_dS..q&..|
+000000a0 47 be 7d 27 dd a9 6e 8e af 45 de 5d bd 37 8c 2b |G.}'..n..E.].7.+|
+000000b0 b0 d8 d0 49 7e f1 cf 1c 47 a9 0f 5f fa 99 56 46 |...I~...G.._..VF|
+000000c0 a2 41 f7 f6 08 5f 97 6b 14 64 01 aa b2 f6 55 34 |.A..._.k.d....U4|
+000000d0 25 76 f3 ef 29 a3 cc 99 f5 06 ac 30 d1 00 db 36 |%v..)......0...6|
+000000e0 9b 41 c0 45 2e d4 bc b9 02 87 0f 0a 0e 2d 9d 56 |.A.E.........-.V|
+000000f0 df b8 94 8e 54 a8 6d 0a 8d b8 71 3c c0 76 0a 94 |....T.m...q<.v..|
+00000100 6d dc c6 5b 24 7e c5 48 25 67 15 44 2b 48 d0 cd |m..[$~.H%g.D+H..|
+00000110 82 d8 c8 5e 0c 20 32 95 a9 f8 d5 31 cd f7 44 da |...^. 2....1..D.|
+00000120 05 c4 cb e9 04 48 72 ac ca 7b 26 e6 76 d2 01 18 |.....Hr..{&.v...|
+00000130 c0 34 88 29 7c 8c dc 35 e3 25 c9 11 f0 2b 1f 44 |.4.)|..5.%...+.D|
+00000140 d8 7d ea 1d 6a 57 b2 2c 52 8e 89 50 e3 e4 1c 51 |.}..jW.,R..P...Q|
+00000150 91 0c 6d fd 8d ad 91 77 b1 34 02 83 96 7e 39 5f |..m....w.4...~9_|
+00000160 bc ed b1 05 3b f0 d3 f0 b3 05 54 e8 47 36 32 b1 |....;.....T.G62.|
+00000170 88 c9 31 7e d8 41 12 3b 55 25 b3 bc e3 9f a5 17 |..1~.A.;U%......|
+00000180 a8 45 21 68 e6 12 83 0e 80 13 d5 80 4d 89 0d fb |.E!h........M...|
+00000190 9f 06 84 35 04 e8 0e bc 8c e7 17 83 7a 0f 68 34 |...5........z.h4|
+000001a0 ee db 10 78 31 85 34 e0 d8 f4 d2 3d fa 1c 18 49 |...x1.4....=...I|
+000001b0 25 c9 b9 53 ee b1 62 ff 13 77 36 8e 59 73 f7 9b |%..S..b..w6.Ys..|
+000001c0 5f 4d 01 2d 41 dc 9e 2e f7 f4 4c f7 27 eb e3 35 |_M.-A.....L.'..5|
+000001d0 91 41 b5 7f 28 eb 04 2c f6 db 80 aa 3d 4e ac 2b |.A..(..,....=N.+|
+000001e0 9d 95 c8 97 cf 35 f5 49 0d c7 b1 4f bf 41 eb 4a |.....5.I...O.A.J|
+000001f0 9a a6 56 b8 8a 75 53 17 dc d4 ad ab 82 25 e8 0a |..V..uS......%..|
+00000200 ae 8b c0 a3 8e 67 4b d1 96 04 45 1d c8 12 32 3f |.....gK...E...2?|
+00000210 7e 4c 48 95 9f 24 8c 01 cf c3 78 10 d6 12 63 37 |~LH..$....x...c7|
+00000220 38 58 d3 31 97 25 9d 43 29 29 86 fb 9a 47 b5 c1 |8X.1.%.C))...G..|
+00000230 81 dc ab 4b be 57 bf 9f 0c 0b 28 fc 13 15 4e 2d |...K.W....(...N-|
+00000240 58 97 78 3e 7f eb bf a1 cf a1 8d ab fe 3a 47 77 |X.x>.........:Gw|
+00000250 c1 fb b7 b8 82 42 37 95 60 20 be 91 26 ca 2c 48 |.....B7.` ..&.,H|
+00000260 44 57 6c 75 24 22 93 32 cf 83 f8 0c 75 b5 4a f1 |DWlu$".2....u.J.|
+00000270 88 d0 8e 1d 4e c7 93 1b ba ea 14 04 38 f6 7a c2 |....N.......8.z.|
+00000280 d2 4b 7c 9c 1b 8b 31 6c d8 09 88 6a 6d a1 61 d6 |.K|...1l...jm.a.|
+00000290 ee 80 ea 76 c0 d9 5a 49 31 3b dd 0f b5 5a a1 29 |...v..ZI1;...Z.)|
+000002a0 d4 ff db 68 48 96 26 e7 a7 82 10 e9 6e 5c c4 66 |...hH.&.....n\.f|
+000002b0 d5 e0 87 c3 66 d8 7c 4e bf a5 31 0f fa 6e f6 21 |....f.|N..1..n.!|
+000002c0 4d fe ea f0 36 91 9e 18 81 c0 21 4f 77 eb 65 c0 |M...6.....!Ow.e.|
+000002d0 fe 84 45 22 dd 28 03 eb e5 ce 15 62 e1 b8 9f 0e |..E".(.....b....|
+000002e0 aa 9d bc 5c 38 41 01 74 17 d0 92 a5 80 e4 4b 58 |...\8A.t......KX|
+000002f0 42 bb 42 5d 16 03 03 00 bc 09 fb 78 c1 36 2e 27 |B.B].......x.6.'|
+00000300 b2 44 17 1a a8 2b f5 cd 98 78 a4 c1 1c f2 e7 53 |.D...+...x.....S|
+00000310 92 ef c1 88 83 78 37 23 08 f5 7f 5d 9f d1 c4 32 |.....x7#...]...2|
+00000320 df 01 c6 9c 3e a8 11 31 f4 77 69 94 d7 67 bc 62 |....>..1.wi..g.b|
+00000330 8e 18 57 0a cd d8 ba db cd 2b e8 f9 37 77 16 13 |..W......+..7w..|
+00000340 be 18 53 2a 50 0b 0a d7 9a f0 7d 10 d3 13 bb 82 |..S*P.....}.....|
+00000350 36 5c aa d1 17 ad 83 69 47 7f 81 5c 36 53 81 e3 |6\.....iG..\6S..|
+00000360 1d 65 9f ac b2 3e 76 77 5a 6a 39 e5 df 92 55 e6 |.e...>vwZj9...U.|
+00000370 90 96 9c b9 54 ac 09 17 ce f5 43 9f 3e 1e 3a b6 |....T.....C.>.:.|
+00000380 cb 61 da 1a 3e e0 b4 51 30 3e 22 09 0b 05 a7 6e |.a..>..Q0>"....n|
+00000390 5a df 82 d2 ab b9 d8 d2 37 a7 d7 b5 7f a9 ea 49 |Z.......7......I|
+000003a0 2f 64 57 33 5a 19 7f a3 2f 6a 7e 40 18 19 4a 61 |/dW3Z.../j~@..Ja|
+000003b0 05 92 35 8b 50 16 03 03 00 4a 50 1e e6 f4 47 dd |..5.P....JP...G.|
+000003c0 fb 02 b4 22 71 e7 1e b1 51 28 9f 2d 40 64 2c 85 |..."q...Q(.-@d,.|
+000003d0 47 33 69 3e b0 e4 c7 eb a6 31 13 76 45 39 e7 50 |G3i>.....1.vE9.P|
+000003e0 94 86 2e dd e1 58 f2 83 60 86 07 94 29 ce 69 12 |.....X..`...).i.|
+000003f0 0f 89 e3 89 2f 00 50 2b 56 ed 1d fe 25 55 9f 33 |..../.P+V...%U.3|
+00000400 3d 30 93 3c 16 03 03 00 14 0e 3f df b0 79 70 a7 |=0.<......?..yp.|
+00000410 08 bb 01 ff 08 44 69 65 49 81 9f e5 3a |.....DieI...:|
>>> Flow 9 (client to server)
-00000000 16 03 03 02 69 ef e6 70 d4 42 64 ba 8b 31 22 63 |....i..p.Bd..1"c|
-00000010 d6 66 0c 78 6f 43 80 ba dd 30 41 74 78 25 0f b2 |.f.xoC...0Atx%..|
-00000020 b2 0f d4 d5 91 45 f3 a5 24 f0 da 2c 74 57 5c 81 |.....E..$..,tW\.|
-00000030 5b 77 96 5a b0 48 26 5e 06 24 e9 98 d7 a9 ce b0 |[w.Z.H&^.$......|
-00000040 b3 a3 f4 79 0e 28 e5 fa 96 e6 b7 2e 4a 7b d4 1a |...y.(......J{..|
-00000050 96 eb d9 f7 98 07 f1 ac 88 08 20 42 2b 41 d8 f4 |.......... B+A..|
-00000060 96 2b 34 23 fb 26 e0 2b fe 0e dd 36 a4 d5 aa 24 |.+4#.&.+...6...$|
-00000070 9b 3b 67 76 86 90 28 17 e2 22 cc 83 b8 72 5b 1d |.;gv..(.."...r[.|
-00000080 d4 fa 81 33 68 db a4 43 76 57 39 3a b3 22 cb d6 |...3h..CvW9:."..|
-00000090 2e 31 07 6c b9 d6 ca 56 ca 56 67 ca 17 55 2d 49 |.1.l...V.Vg..U-I|
-000000a0 a6 42 de 7a 2c c1 cc 9f af e8 88 5f 72 10 7c 56 |.B.z,......_r.|V|
-000000b0 bf 49 54 27 0c 39 e3 2e 57 c4 c3 8c 7e 10 2b e5 |.IT'.9..W...~.+.|
-000000c0 32 a9 ba 32 02 25 e6 02 e7 a2 06 87 16 07 47 e4 |2..2.%........G.|
-000000d0 4d 6b 95 5e a9 cd 5c dc ab 4f ae a6 e7 59 60 cb |Mk.^..\..O...Y`.|
-000000e0 23 d9 4b a0 15 ab 39 a9 ef 4b 74 54 4b e1 b8 69 |#.K...9..KtTK..i|
-000000f0 fe f3 f2 04 d5 df 3e 5b 1e 0f 64 6a b1 96 ec 82 |......>[..dj....|
-00000100 9c 8c 0b 90 c1 1f c1 f6 6e e6 9e cc 11 50 6f 3a |........n....Po:|
-00000110 28 55 73 0b e3 42 89 eb ea 38 5f 29 d4 88 41 18 |(Us..B...8_)..A.|
-00000120 45 8b f9 5d 2a 35 79 ba 39 a9 d5 7f 4d 7a d3 4e |E..]*5y.9...Mz.N|
-00000130 25 59 10 30 9c 4a 24 af 96 63 e3 e6 cb 6e 7d ff |%Y.0.J$..c...n}.|
-00000140 a2 4b 69 30 76 9c 35 19 74 29 b6 ad e7 15 01 7d |.Ki0v.5.t).....}|
-00000150 e8 04 9e 00 4e d6 0d 51 3f ed a9 5e e9 b9 5f a3 |....N..Q?..^.._.|
-00000160 6e 6c 65 f8 7f ec 6f 5d c5 94 48 44 dd 02 e9 76 |nle...o]..HD...v|
-00000170 cb b2 d2 66 f8 95 6f 69 11 e3 0b a8 96 d3 ac 9b |...f..oi........|
-00000180 d3 55 48 61 ff 80 69 a3 09 c4 5c b9 fa fd 74 7b |.UHa..i...\...t{|
-00000190 4e 10 b0 09 05 4b 6c 75 59 7f 19 ba c2 d5 85 7e |N....KluY......~|
-000001a0 18 ff 08 88 76 d4 1e 2e b4 56 23 95 6c 22 68 1e |....v....V#.l"h.|
-000001b0 42 e2 5d 3a ff 84 b9 05 c2 d0 6c c6 aa ee e7 e6 |B.]:......l.....|
-000001c0 59 07 16 9c a4 3c 8a 47 b1 98 05 8e 65 95 11 fb |Y....<.G....e...|
-000001d0 b6 7b 9b 66 c1 53 c2 7e 3a 3e 0c 22 75 ea f0 2b |.{.f.S.~:>."u..+|
-000001e0 31 25 16 b1 90 0a 42 e6 c5 4e 46 08 fc d7 65 bb |1%....B..NF...e.|
-000001f0 ca a1 e4 ad 6d b5 4c 74 c5 30 85 d5 58 04 d7 1c |....m.Lt.0..X...|
-00000200 9e 57 d3 ec 99 03 1c 0d f9 98 ae 76 60 4e 97 67 |.W.........v`N.g|
-00000210 10 a0 e9 94 84 05 7c af a9 61 9f bb de 9f bd 66 |......|..a.....f|
-00000220 0a b2 6d 6a 07 c8 40 78 14 93 24 2d 4a 77 e4 13 |..mj..@x..$-Jw..|
-00000230 4a db 6f ae c2 78 5e 59 ac f9 3d 1c 8b 3b ff 14 |J.o..x^Y..=..;..|
-00000240 1b fd 05 e6 f8 31 be 63 70 4c f2 ef d0 17 a6 66 |.....1.cpL.....f|
-00000250 42 3a 94 3b 4a a6 26 49 b4 18 6d 9e b5 07 8a 49 |B:.;J.&I..m....I|
-00000260 a1 72 44 25 27 46 12 e0 61 06 4d eb b2 f5 16 03 |.rD%'F..a.M.....|
-00000270 03 00 35 9e fc 71 56 3c cc c8 d6 2b a6 b1 cb 2b |..5..qV<...+...+|
-00000280 c8 a2 5c 2b 49 95 52 2a 91 62 74 ba 95 9d 67 f3 |..\+I.R*.bt...g.|
-00000290 2a 2c 55 1d 81 83 0d b1 25 3f ff cd 75 16 e6 83 |*,U.....%?..u...|
-000002a0 a5 bc a7 8b 4d 31 32 d5 16 03 03 00 98 98 ea f6 |....M12.........|
-000002b0 4a 46 17 cb 01 d9 33 74 ec 49 78 b1 5b c5 c0 d3 |JF....3t.Ix.[...|
-000002c0 71 82 5c 80 1e 59 4f da 5d 2d 54 78 0c 60 35 26 |q.\..YO.]-Tx.`5&|
-000002d0 29 da 64 29 02 39 84 d0 3b 0b 0d 8d 84 2e 25 fc |).d).9..;.....%.|
-000002e0 e7 2c d1 33 ae bb fa 6f d2 87 54 b3 f2 d5 21 69 |.,.3...o..T...!i|
-000002f0 2a 69 43 15 48 2a 5e e8 66 f8 1d 49 28 51 14 97 |*iC.H*^.f..I(Q..|
-00000300 01 1b 31 de 22 7c a7 1c 15 19 21 36 35 92 ca e6 |..1."|....!65...|
-00000310 d3 f0 2d af 0d 8e c1 16 c2 a4 ef e9 4f 97 c3 ad |..-.........O...|
-00000320 59 0d 98 c6 d2 31 38 d5 34 e0 f3 80 6c 86 f9 bd |Y....18.4...l...|
-00000330 84 16 c1 4e d7 2a 89 26 20 46 f4 54 b2 c7 69 0e |...N.*.& F.T..i.|
-00000340 72 56 9b 35 4b 14 03 03 00 11 98 7b 9f 6f c5 62 |rV.5K......{.o.b|
-00000350 1e 2e f6 8a 10 5a ea b7 72 ef 02 16 03 03 00 20 |.....Z..r...... |
-00000360 9c 56 e6 cb ee 7a 86 0f f0 47 6a d6 04 c4 41 c9 |.V...z...Gj...A.|
-00000370 36 2f 4d 5d 4b e9 54 22 9d 0f 07 a3 36 8e 83 b8 |6/M]K.T"....6...|
+00000000 16 03 03 02 69 b8 47 2d 3a 7a e4 d0 2b 45 b2 38 |....i.G-:z..+E.8|
+00000010 1e 6f 8d 3d e1 26 91 92 d7 1f e9 a4 2c d8 30 2c |.o.=.&......,.0,|
+00000020 ce 68 50 e7 80 77 63 e1 bd c7 c8 1b 6f ca b0 bf |.hP..wc.....o...|
+00000030 82 1d 75 85 2c 5d b2 f6 9a f2 b6 9b c4 24 54 86 |..u.,].......$T.|
+00000040 b8 fb dc ae 09 25 c4 42 fc 4d f2 18 5b a3 92 31 |.....%.B.M..[..1|
+00000050 8a 78 1f 1a 74 d4 43 0b 24 2f 14 2b 0e 05 3a 8d |.x..t.C.$/.+..:.|
+00000060 7a 1c 21 2f cd 7b 9d 6c 32 b1 f6 14 fa 9d f5 be |z.!/.{.l2.......|
+00000070 9c f1 8e 75 b9 27 82 ba e7 fc 14 39 2a 6f 3e 59 |...u.'.....9*o>Y|
+00000080 d6 bc 6c 3f f1 33 5e fa bb 07 bc e4 0b 7e 4a 5d |..l?.3^......~J]|
+00000090 2b e8 9b d5 00 d2 cc 8f 94 01 82 0e bb 28 f9 d2 |+............(..|
+000000a0 1f ee 0c ff 9c 4d 37 5b 23 5b 23 a5 39 fe cd 2b |.....M7[#[#.9..+|
+000000b0 ef 30 46 b7 c1 0e a3 fc fd f6 1b d3 78 fb d9 93 |.0F.........x...|
+000000c0 3a 52 fe 91 dc 42 63 85 09 64 63 3a 9d 9f 21 74 |:R...Bc..dc:..!t|
+000000d0 c6 d9 e4 b5 cc ef 94 96 0f c1 d0 45 f6 e6 b9 32 |...........E...2|
+000000e0 01 74 88 24 bb d9 d6 25 23 14 de 25 f4 7e 9c 77 |.t.$...%#..%.~.w|
+000000f0 82 83 7e 59 dc c3 f7 d9 e4 b1 95 e0 bb 6e 66 e4 |..~Y.........nf.|
+00000100 bd cb a2 72 a0 63 d4 39 9f 57 a7 d1 88 7a 59 64 |...r.c.9.W...zYd|
+00000110 38 45 bb fc 5a 02 81 4c 2e e5 e4 1c 7d e9 e8 f0 |8E..Z..L....}...|
+00000120 e1 b7 88 f5 a6 ee d0 b7 e5 2f 9e 15 d5 76 8d f7 |........./...v..|
+00000130 68 0f 7b 6a 48 e7 19 3a bc ef f5 fc 72 a4 62 ce |h.{jH..:....r.b.|
+00000140 a6 66 e5 e8 74 03 c0 4d b4 14 e4 0c 36 fd 99 0b |.f..t..M....6...|
+00000150 0e 4f b6 5e 4c db dc 51 fe ae e9 07 37 92 6c 35 |.O.^L..Q....7.l5|
+00000160 f7 99 6c b9 36 c2 b9 7c 5e ef 72 c1 1f ba fb 18 |..l.6..|^.r.....|
+00000170 57 24 f2 d4 21 cf 46 bd 71 3d 62 63 ba 1c 0f 8b |W$..!.F.q=bc....|
+00000180 f4 a6 fc ea 27 de 48 b8 ed e3 6e 4b 30 66 fa 1e |....'.H...nK0f..|
+00000190 22 7b 49 e2 03 96 8a 6a 3c 6a 1a 62 81 cc 06 dd |"{I....jL|
+000001d0 e7 b9 9f 90 aa 1f 39 13 e2 4b 8c ff b5 13 d1 d2 |......9..K......|
+000001e0 cd ac ce 8c 2b bc b3 b3 fc f7 37 db 61 8f 6b 90 |....+.....7.a.k.|
+000001f0 c2 bc 6e e3 8e fa d9 16 ab 62 c7 3f d7 e1 0b a8 |..n......b.?....|
+00000200 2b 8a 0d b6 2c 90 dc 6e b4 44 e0 13 32 fb 80 23 |+...,..n.D..2..#|
+00000210 a9 e4 18 ea 8d c7 8a 14 0a 82 8d 3b 21 88 bf bf |...........;!...|
+00000220 ff 10 3c 08 6b 65 70 4c b5 88 7d 9c 92 43 15 55 |..<.kepL..}..C.U|
+00000230 18 e9 cf 15 5d 55 3a f0 a1 46 ca d4 9e f3 c0 16 |....]U:..F......|
+00000240 4b ee f6 17 95 e0 af 1e 85 54 62 dd 56 88 6b e1 |K........Tb.V.k.|
+00000250 29 ac f9 4f dc 5c 89 16 19 6b 21 c9 6c c8 1e 1d |)..O.\...k!.l...|
+00000260 89 7c cc a4 9b 1f c8 ce 67 c6 83 79 6a d6 16 03 |.|......g..yj...|
+00000270 03 00 35 6f 33 7d 96 3c 8d 66 a5 d1 7a 8b bc fa |..5o3}.<.f..z...|
+00000280 ca f0 89 9d 2b 37 0c f5 aa 14 07 f2 58 be d1 d3 |....+7......X...|
+00000290 ec 73 dd b6 33 e2 df 46 1a d3 ee e8 26 d9 be 2b |.s..3..F....&..+|
+000002a0 43 25 3b e2 78 72 10 43 16 03 03 00 98 18 03 96 |C%;.xr.C........|
+000002b0 9c eb 31 50 72 15 0e 9b ff c7 6b b0 60 32 08 c6 |..1Pr.....k.`2..|
+000002c0 ef 70 f9 0c 22 4a a2 0f 77 31 b3 ea d0 12 65 af |.p.."J..w1....e.|
+000002d0 c9 28 0f f9 5b b7 f3 75 9c 5a 6e df a1 6a e6 d5 |.(..[..u.Zn..j..|
+000002e0 82 0b 18 05 94 aa dd 93 e5 1d 60 06 47 f5 3e b1 |..........`.G.>.|
+000002f0 d5 e8 e7 b7 9f 43 bf 4b 8a 5e 48 3b f1 42 f6 c0 |.....C.K.^H;.B..|
+00000300 c3 65 86 e2 bc 7a 75 1d 93 cf 7f 3d 11 d3 85 c3 |.e...zu....=....|
+00000310 c3 90 90 0b 77 e1 d7 64 da 71 3c 55 de 7c b9 71 |....w..d.q...|
+00000370 f8 7e fd 4d bd 3b 0e bc 9b 74 27 09 33 c3 27 2a |.~.M.;...t'.3.'*|
>>> Flow 10 (server to client)
-00000000 14 03 03 00 11 6b bf 22 ed c6 d9 79 48 3b 35 2a |.....k."...yH;5*|
-00000010 ca 29 40 05 ad fa 16 03 03 00 20 d1 2c 33 a1 63 |.)@....... .,3.c|
-00000020 c5 96 c5 ec c8 c5 cc 94 f7 92 a3 ed 3f e0 4a ab |............?.J.|
-00000030 28 96 18 3c c1 a8 3a 03 fc ee f6 17 03 03 00 19 |(..<..:.........|
-00000040 39 e5 80 33 cc a5 f8 3a e4 13 b5 b7 e0 1d 19 5e |9..3...:.......^|
-00000050 82 b4 94 fd cd 6c a5 06 e2 |.....l...|
+00000000 14 03 03 00 11 3d 29 da dc b6 5a 09 66 34 6e 00 |.....=)...Z.f4n.|
+00000010 65 8c 29 d2 18 bd 16 03 03 00 20 63 55 d1 84 7d |e.)....... cU..}|
+00000020 3e cc 2d f5 d3 48 c2 5c 72 d8 6b cf 69 b4 ed 5f |>.-..H.\r.k.i.._|
+00000030 07 96 53 13 1e 53 59 18 c1 bb c7 17 03 03 00 19 |..S..SY.........|
+00000040 30 5b 6d d2 26 db ef c1 a9 00 e6 ce 87 86 9b 71 |0[m.&..........q|
+00000050 dd fb aa 79 aa b6 39 1e 70 |...y..9.p|
>>> Flow 11 (client to server)
-00000000 15 03 03 00 12 60 9a 8c 98 6e 55 b1 3e db b4 22 |.....`...nU.>.."|
-00000010 3c d9 51 43 36 88 eb |<.QC6..|
+00000000 15 03 03 00 12 32 8f cd ef b8 3e 96 01 07 ca 0b |.....2....>.....|
+00000010 83 21 83 97 78 25 64 |.!..x%d|
diff --git a/src/crypto/tls/testdata/Client-TLSv12-RenegotiateTwice b/src/crypto/tls/testdata/Client-TLSv12-RenegotiateTwice
index 4967e0fa41..983174f5ec 100644
--- a/src/crypto/tls/testdata/Client-TLSv12-RenegotiateTwice
+++ b/src/crypto/tls/testdata/Client-TLSv12-RenegotiateTwice
@@ -16,11 +16,11 @@
000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0|
000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t|
>>> Flow 2 (server to client)
-00000000 16 03 03 00 59 02 00 00 55 03 03 1e 7a 8b a7 bd |....Y...U...z...|
-00000010 bd 98 42 b7 80 8f d3 a5 1c b8 36 4b e3 4c d4 87 |..B.......6K.L..|
-00000020 e1 13 93 bb 9f 70 1b 21 22 15 fa 20 64 89 5b 25 |.....p.!".. d.[%|
-00000030 cb 8e 05 53 0b a4 b5 06 49 46 83 7d 8b 13 b1 e4 |...S....IF.}....|
-00000040 47 d0 21 91 fe 20 0a e2 dc 29 71 ce cc a8 00 00 |G.!.. ...)q.....|
+00000000 16 03 03 00 59 02 00 00 55 03 03 34 8b db 6b 9e |....Y...U..4..k.|
+00000010 68 c3 92 09 72 4f 02 6c b9 7a ac 74 72 0b 32 01 |h...rO.l.z.tr.2.|
+00000020 f4 86 9e b5 53 db da 96 c2 65 2a 20 8f 89 24 79 |....S....e* ..$y|
+00000030 8a a5 38 7a 52 68 7a a9 cc d0 5a 04 4d ce 87 0e |..8zRhz...Z.M...|
+00000040 64 48 51 e0 00 cb 60 f0 b4 e9 99 27 cc a8 00 00 |dHQ...`....'....|
00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................|
00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..|
00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............|
@@ -60,284 +60,284 @@
00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.|
000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..|
000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......|
-000002c0 ac 0c 00 00 a8 03 00 1d 20 db 69 f9 f0 59 b6 50 |........ .i..Y.P|
-000002d0 b8 fe a7 d0 df fa 32 b9 df 3b 31 8e 3f fb ee 82 |......2..;1.?...|
-000002e0 2e e3 e6 42 c2 61 78 ee 77 08 04 00 80 9c f6 b1 |...B.ax.w.......|
-000002f0 60 99 fe 8d 65 0a 87 0f ec d2 35 bc 7c 26 3c 1f |`...e.....5.|&<.|
-00000300 55 3d 6d 6c 8a 64 5b a7 95 fa cc e0 a6 9b 36 bd |U=ml.d[.......6.|
-00000310 1e 0f 8e bc 36 d5 28 e8 ae 2e 34 97 f6 be 87 ce |....6.(...4.....|
-00000320 c5 1b 91 7f 5a 22 db 9a d0 cd cb 47 ac 2e 06 2f |....Z".....G.../|
-00000330 9d f1 fe 35 c1 88 db 8e d3 3c 8b 6f a3 38 b6 e3 |...5.....<.o.8..|
-00000340 99 42 be 6c bd b4 66 43 00 59 04 0e 6c e1 89 dc |.B.l..fC.Y..l...|
-00000350 6f 05 6f 32 f6 aa 2b 55 3b 95 95 0f fe a4 55 18 |o.o2..+U;.....U.|
-00000360 d3 71 3c fb 33 f6 ae 15 74 4b 33 bb a3 16 03 03 |.q<.3...tK3.....|
+000002c0 ac 0c 00 00 a8 03 00 1d 20 63 06 67 5c 4e da 3f |........ c.g\N.?|
+000002d0 0a 02 78 46 92 fe 8f ed 41 ac 1a d5 04 e6 ca 4a |..xF....A......J|
+000002e0 7e 9c d0 32 e8 ee f3 9c 5d 08 04 00 80 c0 51 ba |~..2....].....Q.|
+000002f0 71 28 00 53 c6 40 63 20 d4 bd 52 60 d2 f6 e2 57 |q(.S.@c ..R`...W|
+00000300 ba 6f a8 bf 42 2a 11 b5 9a eb 9f b6 53 77 87 72 |.o..B*......Sw.r|
+00000310 ea 7d bf f8 f4 cf 1d 76 6c 03 75 9d df 88 b1 13 |.}.....vl.u.....|
+00000320 66 5c 43 41 1e 97 52 32 86 d0 22 3c f6 ca 90 a5 |f\CA..R2.."<....|
+00000330 ba cf 75 94 1f 22 93 c0 0c c9 82 a5 eb d2 07 85 |..u.."..........|
+00000340 a0 39 9e 5d fa 88 1f 62 25 09 c3 97 c1 1d 4e a2 |.9.]...b%.....N.|
+00000350 fe 98 96 b8 c0 eb b9 18 07 2d e1 cf 9b fd 25 ba |.........-....%.|
+00000360 93 fb 73 e5 7e 36 27 b3 11 00 58 95 f8 16 03 03 |..s.~6'...X.....|
00000370 00 04 0e 00 00 00 |......|
>>> Flow 3 (client to server)
00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.|
00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....|
00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......|
-00000030 16 03 03 00 20 3e 7f d0 53 7f 67 81 82 2d 8b fd |.... >..S.g..-..|
-00000040 68 ce ea 38 c5 3d 1f a1 0d 72 0b ac de e0 99 9c |h..8.=...r......|
-00000050 0e d8 4f 5c 2e |..O\.|
+00000030 16 03 03 00 20 02 50 f6 74 83 31 96 36 c1 22 99 |.... .P.t.1.6.".|
+00000040 1d d7 99 b2 8c 2b 04 3a bd 3e 19 e5 ef 71 dc 72 |.....+.:.>...q.r|
+00000050 b2 0d c8 d1 3f |....?|
>>> Flow 4 (server to client)
-00000000 14 03 03 00 01 01 16 03 03 00 20 18 e0 d3 a6 d4 |.......... .....|
-00000010 bf cd b7 b7 6c 98 53 9d 75 bb c8 ee 29 28 6c d6 |....l.S.u...)(l.|
-00000020 4b 96 66 fb 2c 99 bc aa 3f aa 86 |K.f.,...?..|
+00000000 14 03 03 00 01 01 16 03 03 00 20 9b a3 02 3e 55 |.......... ...>U|
+00000010 4a e6 4c 7f 9a a6 a2 65 bd 74 ff ad c5 ce 43 21 |J.L....e.t....C!|
+00000020 d3 b1 d1 89 0c 15 7d 7d a7 d8 4c |......}}..L|
>>> Flow 5 (client to server)
-00000000 17 03 03 00 16 72 e6 81 87 6e 2d d9 76 10 8b 7d |.....r...n-.v..}|
-00000010 7b e4 ee ee 31 bb d5 6a be 69 29 |{...1..j.i)|
+00000000 17 03 03 00 16 4c 5e 0a 69 e1 e8 fc 52 f0 3d ea |.....L^.i...R.=.|
+00000010 33 f5 02 6b 47 49 cd a5 b5 94 4e |3..kGI....N|
>>> Flow 6 (server to client)
-00000000 16 03 03 00 14 c5 9f 94 4a 11 1b 2f c3 ad 90 d5 |........J../....|
-00000010 5e b5 7a 87 f1 19 33 11 52 |^.z...3.R|
+00000000 16 03 03 00 14 6a 8d 46 e1 33 c6 63 9d 27 3e e8 |.....j.F.3.c.'>.|
+00000010 7f 31 74 7f 4f 60 b3 f7 aa |.1t.O`...|
>>> Flow 7 (client to server)
-00000000 16 03 03 01 16 f9 ea fe 74 a7 a0 8c 3d a8 7f 61 |........t...=..a|
-00000010 a7 f6 7a de 4d 36 32 d0 be 7b 0b df 80 65 62 06 |..z.M62..{...eb.|
-00000020 d2 1d ce 1a f2 83 c7 0a a3 c5 eb 37 b1 60 0c 0c |...........7.`..|
-00000030 47 9f fd 66 61 4b 5d 55 cc 13 0b 50 77 5a 31 68 |G..faK]U...PwZ1h|
-00000040 75 94 d5 a6 ec 61 07 a2 45 f7 d6 73 af 7b ea 2d |u....a..E..s.{.-|
-00000050 9f bd cd 08 d2 4b f8 24 27 8e 5a 24 a6 cb ed 01 |.....K.$'.Z$....|
-00000060 6d ef fc 2f ff f9 2d 23 d1 64 6b a4 d2 8c cc ff |m../..-#.dk.....|
-00000070 55 28 cc 79 21 86 6a e9 c9 d3 c3 38 b0 ee 37 18 |U(.y!.j....8..7.|
-00000080 1b 9c 87 e2 70 42 8e e9 72 37 79 09 4c f1 e2 74 |....pB..r7y.L..t|
-00000090 ef 11 c1 ad 7b e2 b4 f1 57 19 08 51 80 f1 9f 9a |....{...W..Q....|
-000000a0 84 40 00 61 4f 77 8a 02 69 35 44 f9 b0 a6 94 0f |.@.aOw..i5D.....|
-000000b0 d2 a0 77 78 c8 ab cb b1 3f 81 2f f7 20 7b f1 af |..wx....?./. {..|
-000000c0 ad c8 9a 15 77 09 3a 21 68 da c5 29 e9 3a 9e 83 |....w.:!h..).:..|
-000000d0 9d 25 c7 29 3c 02 48 71 3d be e6 a4 13 d9 1b 5a |.%.)<.Hq=......Z|
-000000e0 79 50 00 7a 3b 29 6c b6 4e 59 0a ff e3 1c 69 65 |yP.z;)l.NY....ie|
-000000f0 f7 a9 c8 eb 74 74 05 a4 10 c3 9f 47 11 0a 4e 2c |....tt.....G..N,|
-00000100 75 dd 31 1d 85 6c c9 2b 95 3e 61 20 61 78 d9 68 |u.1..l.+.>a ax.h|
-00000110 5b 52 b1 a1 08 70 a7 e4 89 fa 32 |[R...p....2|
+00000000 16 03 03 01 16 6f 4d 64 ff 20 fa 1c 19 26 bc 99 |.....oMd. ...&..|
+00000010 ec 09 be e7 6d 88 73 1e 4f c6 74 35 f7 5c b3 e5 |....m.s.O.t5.\..|
+00000020 f6 d1 2a 90 7f c3 34 dc 83 6b a9 f1 32 01 a1 84 |..*...4..k..2...|
+00000030 0c 4c 06 db 88 d4 19 31 d2 46 1f 2c 3d 13 75 5b |.L.....1.F.,=.u[|
+00000040 f3 e5 d0 b7 a8 4f 2c b2 89 35 78 82 78 b7 f5 c6 |.....O,..5x.x...|
+00000050 ea a2 1d f3 24 9d e2 01 25 e2 96 a1 06 57 5c 50 |....$...%....W\P|
+00000060 d6 5b 56 24 18 6e b4 ce 6a 2e c7 01 65 99 3f 35 |.[V$.n..j...e.?5|
+00000070 c1 07 48 75 ad 0b 1a b3 58 df 83 42 f8 78 eb 92 |..Hu....X..B.x..|
+00000080 e8 70 c9 34 af db e8 d6 b0 c8 37 ac b2 d7 18 ba |.p.4......7.....|
+00000090 a3 1d 35 09 2e 2f 82 e0 3a 68 fd 7f ba 4d 5c 5c |..5../..:h...M\\|
+000000a0 6c 6d ac 24 60 bf e0 37 a9 17 8d 6d 8a 69 96 23 |lm.$`..7...m.i.#|
+000000b0 4f c7 53 a0 48 65 58 cc 01 03 df 33 36 5a 8a 7e |O.S.HeX....36Z.~|
+000000c0 3f 84 33 26 3f 02 66 48 82 22 22 b7 7d 62 7e 56 |?.3&?.fH."".}b~V|
+000000d0 94 df 43 df 08 fc 70 f6 bb 1a dd 19 b1 ea ea a2 |..C...p.........|
+000000e0 6f 36 ab b0 d2 77 e6 c8 f6 70 a6 a6 a3 0d ab c8 |o6...w...p......|
+000000f0 dc d1 9b a2 05 43 44 0c 17 8d 47 86 55 77 56 34 |.....CD...G.UwV4|
+00000100 d7 71 2c 75 9a d4 70 e4 77 5e 1a b7 b1 13 ae 14 |.q,u..p.w^......|
+00000110 d0 99 a0 9e 50 9c 35 94 4d 34 e5 |....P.5.M4.|
>>> Flow 8 (server to client)
-00000000 16 03 03 00 81 25 5a 30 ca 7c f0 f5 7f c4 5f e3 |.....%Z0.|...._.|
-00000010 19 4d 25 ea 3d f8 b3 3f 8d e4 89 da db 4e 19 62 |.M%.=..?.....N.b|
-00000020 d2 4e 9a a5 5d c6 84 f2 70 f3 b5 10 cb 57 f5 9e |.N..]...p....W..|
-00000030 83 a4 78 14 86 3c 27 f5 08 bd c0 59 ab ac 3c 5f |..x..<'....Y..<_|
-00000040 8c d7 23 9b c1 9f f4 ad c5 5c 3c 3d bd f4 82 42 |..#......\<=...B|
-00000050 58 b8 bf 69 9a 13 2a f6 2d 18 0b df a4 02 74 7d |X..i..*.-.....t}|
-00000060 99 69 aa a7 18 e5 2c f1 1e b4 f7 31 96 0f a3 d8 |.i....,....1....|
-00000070 63 09 b9 eb c9 15 c1 61 de 8a 8c 30 a6 3a 1f 0f |c......a...0.:..|
-00000080 31 06 73 cb 81 57 16 03 03 02 69 b7 45 9e a0 f1 |1.s..W....i.E...|
-00000090 46 f5 05 fc 58 a3 cc 88 38 a4 80 e9 1c 31 bb 84 |F...X...8....1..|
-000000a0 b1 d2 cb 22 5e 47 cd 97 f5 21 b6 7e df 0a ca ef |..."^G...!.~....|
-000000b0 42 71 2f b6 92 c0 44 a9 2f 36 a9 92 9e 23 2f 6a |Bq/...D./6...#/j|
-000000c0 7a 2b 70 5b 8d 2e 53 e9 2b ac 39 22 54 e9 e2 82 |z+p[..S.+.9"T...|
-000000d0 8e 41 7c 40 c9 97 12 ac c9 91 2d 4d 9b e3 ce 1a |.A|@......-M....|
-000000e0 c2 57 d7 e5 89 56 56 52 17 d1 99 99 e0 21 fb f3 |.W...VVR.....!..|
-000000f0 94 1c fd 4a 8f 17 00 61 24 1e 86 cc a9 9a d2 75 |...J...a$......u|
-00000100 32 b7 44 f4 7b ed 37 46 d3 fb cf 98 0e dd 47 a9 |2.D.{.7F......G.|
-00000110 69 f9 ff 34 76 d8 6c 94 7b 97 18 dc 87 25 a0 97 |i..4v.l.{....%..|
-00000120 38 d3 df 22 4f 0e b7 c7 91 64 9a d4 04 f4 35 a3 |8.."O....d....5.|
-00000130 89 28 e9 04 8e fe ed 8c 3c 9d 18 7e e3 14 2e 4e |.(......<..~...N|
-00000140 86 b4 3a 5c 33 f3 27 2c 08 27 91 9a 62 72 c8 98 |..:\3.',.'..br..|
-00000150 56 60 1c e6 5e 80 75 56 89 cd 0f 4d 55 1a 52 7d |V`..^.uV...MU.R}|
-00000160 39 05 cb e2 5d 33 64 67 4d 3d 90 c6 f2 86 62 ff |9...]3dgM=....b.|
-00000170 7f 29 ae fe 49 49 53 6e 4d b9 78 54 ee a6 d7 60 |.)..IISnM.xT...`|
-00000180 55 a8 f1 4b 8a 51 6f 09 f2 84 84 89 4b 36 9e 56 |U..K.Qo.....K6.V|
-00000190 32 28 71 c8 ec 92 f8 31 c5 af d0 4d 84 0a 1d 37 |2(q....1...M...7|
-000001a0 72 ab cf fe ce 02 7c 41 5b f9 44 9c 04 cf 7e 38 |r.....|A[.D...~8|
-000001b0 09 5b ce c5 11 ff db df 05 2e c9 66 be 60 cb 5f |.[.........f.`._|
-000001c0 e3 ef 88 04 b6 38 a3 5f 58 cc ea bc 6c 83 52 68 |.....8._X...l.Rh|
-000001d0 39 ec 88 ca da 49 32 48 6b 5f 93 7d d8 5d 91 e5 |9....I2Hk_.}.]..|
-000001e0 4f b4 b5 47 fd 7d 46 82 fd 82 78 14 7a ca d5 e2 |O..G.}F...x.z...|
-000001f0 ec 12 09 b4 bd 85 d8 50 03 f6 d1 a7 18 29 ca df |.......P.....)..|
-00000200 47 27 41 f7 0b 4c 36 b9 69 b0 71 2c c0 7a 6a 8b |G'A..L6.i.q,.zj.|
-00000210 4d 2b 69 02 21 69 f3 38 77 ce ab c6 1c 15 22 f1 |M+i.!i.8w.....".|
-00000220 3a 0e b3 5e 2e e5 e5 d5 68 1f b9 60 35 f9 f3 c2 |:..^....h..`5...|
-00000230 3d ba 83 39 4f 90 9a ab 7f a1 5b 15 44 e6 b6 0a |=..9O.....[.D...|
-00000240 7f e4 4e 5b 5d 97 98 b0 9e 9e 6f b5 c8 2e 8d 0b |..N[].....o.....|
-00000250 0c 87 8a fb a7 39 89 9a c9 5b 3e bf 3d 63 da a3 |.....9...[>.=c..|
-00000260 0f 1c 92 41 c4 c9 95 b5 e1 2b 37 62 b9 f3 95 ba |...A.....+7b....|
-00000270 e5 9c 5e 39 82 5f 7d a9 2b 74 c2 a7 46 64 0f 31 |..^9._}.+t..Fd.1|
-00000280 4d 68 d3 05 1f 58 2d 11 c0 2e e2 a9 c2 cb 81 06 |Mh...X-.........|
-00000290 0b 77 34 0e af 3e 35 8e 1d 00 40 8e ca b5 02 e8 |.w4..>5...@.....|
-000002a0 10 f8 82 36 ae 70 82 74 65 97 b2 91 3f 2e d0 23 |...6.p.te...?..#|
-000002b0 40 ef bf d9 d9 1a 7d 4a d0 c1 8b 4a 54 8c 41 22 |@.....}J...JT.A"|
-000002c0 07 63 34 bc fb fb 0d e4 9c e2 43 77 13 94 ed 74 |.c4.......Cw...t|
-000002d0 8a ac 4a 17 b6 eb 7e 8c dd 82 14 fa 45 a9 ef 1c |..J...~.....E...|
-000002e0 01 f7 86 18 c2 a8 33 ab 21 36 4c 6c ac 41 aa b1 |......3.!6Ll.A..|
-000002f0 f7 56 48 68 16 03 03 00 bc ab b6 6e 14 2e 1c 47 |.VHh.......n...G|
-00000300 90 fa 6f 63 4d 2f 1a 23 48 6f 1d 45 7d 07 e3 06 |..ocM/.#Ho.E}...|
-00000310 67 ec b2 b1 74 2e 1e 60 9f 36 5e a6 1c a4 b8 60 |g...t..`.6^....`|
-00000320 70 bf 31 68 c0 d5 16 da 6c 44 ce 9c 88 12 84 ef |p.1h....lD......|
-00000330 8f 8b ee cc 0d 5b df f0 87 9e 8f 79 e3 e5 b7 cd |.....[.....y....|
-00000340 d0 ab 56 68 5d cb 9b b1 66 f3 c3 d4 b8 72 2b 0d |..Vh]...f....r+.|
-00000350 ae 4a 2b ea f7 40 6c 94 95 56 1f d4 0b e5 d0 6b |.J+..@l..V.....k|
-00000360 8a 3d 11 10 57 1a c4 ad d0 9e 24 a9 77 fb 75 48 |.=..W.....$.w.uH|
-00000370 3c 60 19 af 0c 0b 36 43 7d c2 d0 98 14 03 a5 02 |<`....6C}.......|
-00000380 36 79 bc 18 da b9 d9 3a 82 1c 9f 49 62 a4 aa cc |6y.....:...Ib...|
-00000390 eb a3 88 ec e4 1c df a9 00 00 6e a0 d6 18 a7 da |..........n.....|
-000003a0 4b d7 e2 d2 c8 8d d9 ce 45 d5 82 65 bc 82 6d d0 |K.......E..e..m.|
-000003b0 26 1b 06 7e eb 16 03 03 00 4a 68 73 85 c5 11 e5 |&..~.....Jhs....|
-000003c0 53 6c ee 2c ac ad e5 aa 96 b8 bc 37 8b 37 f4 ac |Sl.,.......7.7..|
-000003d0 7a 5c c6 71 59 10 28 f9 ae b3 d7 d7 57 b8 4f 13 |z\.qY.(.....W.O.|
-000003e0 78 d0 28 17 02 38 70 d9 85 a1 d3 ae 2a e8 7e 3e |x.(..8p.....*.~>|
-000003f0 da 6f d0 0c 62 33 c8 03 de 45 8f b9 1c b0 e4 ea |.o..b3...E......|
-00000400 6a 20 fd df 16 03 03 00 14 4d 41 6c 0d 81 3b 6f |j .......MAl..;o|
-00000410 9d 6b 53 d7 b7 f9 1a 57 a0 66 8a c2 11 |.kS....W.f...|
+00000000 16 03 03 00 81 28 ba 2e 7a 2b 59 83 ae aa ba c7 |.....(..z+Y.....|
+00000010 d7 49 a5 ca c0 fc 8b 49 f5 10 77 ac e7 ae 12 de |.I.....I..w.....|
+00000020 0d ad 0e 2c d9 ee 99 c4 95 7b 09 b2 91 27 44 6a |...,.....{...'Dj|
+00000030 7c 08 ce bb 98 4a 1c 8c 47 30 21 c7 5d 1e 86 39 ||....J..G0!.]..9|
+00000040 79 07 48 2a ac 90 7b 26 46 6a a5 b1 7c df fa ae |y.H*..{&Fj..|...|
+00000050 0f 20 c8 f0 b5 65 57 2b d5 1f 14 cc bc 7e 94 42 |. ...eW+.....~.B|
+00000060 b6 30 c1 d7 eb 8d 39 0f 65 7a b7 d0 38 21 eb b0 |.0....9.ez..8!..|
+00000070 2d 04 5a 8b 9c 8b 24 91 fe de ac 1f f5 4f aa 74 |-.Z...$......O.t|
+00000080 71 e1 98 8b df 2f 16 03 03 02 69 fb 1f be be 41 |q..../....i....A|
+00000090 51 00 c5 48 bc a3 18 78 2c dc e3 59 d2 0d 23 c7 |Q..H...x,..Y..#.|
+000000a0 2b 03 f3 ce 08 81 62 8a e9 59 52 06 2a cd 7f fe |+.....b..YR.*...|
+000000b0 f4 58 5a a4 6c d1 fa f2 1e 31 7e c5 14 39 dc 37 |.XZ.l....1~..9.7|
+000000c0 27 4f 70 ef 79 7e b1 d1 32 1b 3c cf 08 e2 8a 44 |'Op.y~..2.<....D|
+000000d0 56 48 ea 85 8b 86 1d 77 ea 75 f2 c6 8b 14 9d 57 |VH.....w.u.....W|
+000000e0 17 87 29 64 e1 ef 1a 46 25 ed e1 d3 e6 90 63 8d |..)d...F%.....c.|
+000000f0 30 b6 4d 3c 98 68 45 95 78 11 2c c5 4e 2c 2b 3a |0.M<.hE.x.,.N,+:|
+00000100 a8 8b 02 1c b9 15 09 ea 59 30 c7 a8 d5 28 f3 45 |........Y0...(.E|
+00000110 77 eb bc bc 4a d9 82 4a 7d 8b 5e e1 36 17 ba 95 |w...J..J}.^.6...|
+00000120 34 ea 7e d7 b8 0d 8c 63 07 30 d9 07 49 df b0 ea |4.~....c.0..I...|
+00000130 aa 5e 95 7f 90 ab 09 79 31 88 27 00 9e bd 84 5b |.^.....y1.'....[|
+00000140 ab f6 be 18 10 42 11 49 bd ce 42 dc 2b ae 8f 00 |.....B.I..B.+...|
+00000150 a1 74 5a d1 e3 0b ba 62 57 5f 0e 65 e4 13 ce 78 |.tZ....bW_.e...x|
+00000160 b1 da 89 03 f6 42 cd 1b fe 03 0c f4 89 77 07 bd |.....B.......w..|
+00000170 fa 07 5a 4a 86 1f 47 15 2a 18 ec 26 36 e9 c7 04 |..ZJ..G.*..&6...|
+00000180 75 bb 66 e1 32 97 65 e2 e8 2c b1 bc 39 14 3a d6 |u.f.2.e..,..9.:.|
+00000190 77 d0 15 32 e5 58 eb 49 52 15 c6 d6 9c 4e 2d 97 |w..2.X.IR....N-.|
+000001a0 5c 59 5a 51 11 71 1e 3b 1e 25 b8 20 ef 16 d0 27 |\YZQ.q.;.%. ...'|
+000001b0 f9 ad 01 61 96 8c 50 a2 60 86 99 8c b3 cf 04 07 |...a..P.`.......|
+000001c0 de 8a b3 85 53 95 28 e7 6c db 26 42 b2 6c 51 3c |....S.(.l.&B.lQ<|
+000001d0 b7 54 98 ff 78 48 b2 8e 11 b9 3b 59 b9 38 0b 48 |.T..xH....;Y.8.H|
+000001e0 ac 11 b3 0c b2 f7 98 58 64 ce 16 ae 78 9f 39 ce |.......Xd...x.9.|
+000001f0 20 2b c3 14 74 54 17 54 8e a1 b7 ed 48 77 37 a0 | +..tT.T....Hw7.|
+00000200 12 18 77 b2 ab 51 d2 e3 fc 6a af b3 a2 4b 60 87 |..w..Q...j...K`.|
+00000210 fb f9 0c e8 33 84 e1 6b 95 f0 af 04 c3 c7 b7 0d |....3..k........|
+00000220 bd f2 a6 26 f4 b2 15 c0 9e 90 1b cf 66 3f f8 1e |...&........f?..|
+00000230 64 bf 91 30 b9 2f 31 5b 76 99 67 50 6e b3 fa 00 |d..0./1[v.gPn...|
+00000240 1f 1f 50 1d 52 ea f9 98 7d 59 3a 1d 10 b5 cf 00 |..P.R...}Y:.....|
+00000250 49 a6 72 78 2c e8 2a b2 64 38 34 55 25 b1 4f f7 |I.rx,.*.d84U%.O.|
+00000260 3d 5d 18 d8 63 c4 34 b9 78 15 19 c8 6c d8 03 e9 |=]..c.4.x...l...|
+00000270 0b cb bd 0c b1 32 9c 32 57 ad 7f bd cd db 99 77 |.....2.2W......w|
+00000280 7f 2a 01 60 c6 ce 99 a9 a0 17 ae 02 0c 72 67 b2 |.*.`.........rg.|
+00000290 0e d3 24 c4 88 96 7f ab c2 46 fb fe 47 b0 72 a0 |..$......F..G.r.|
+000002a0 87 6b 22 00 ee 97 ce 13 eb ab 5b 41 2e 60 79 a1 |.k".......[A.`y.|
+000002b0 4b d1 8f d2 d0 5b 02 77 9c 29 1e ea 3e 30 a9 8f |K....[.w.)..>0..|
+000002c0 07 b7 22 2a d7 64 50 cf 0a 34 6b db b8 8d e4 f6 |.."*.dP..4k.....|
+000002d0 50 71 65 54 0f e0 87 93 ca 3e 1b 68 29 2f d9 dd |PqeT.....>.h)/..|
+000002e0 15 76 f0 c3 1c a4 ca e9 5f 17 29 87 bb 0a 5b 74 |.v......_.)...[t|
+000002f0 6c 2d 13 63 16 03 03 00 bc a6 81 fa a1 7b 6e 54 |l-.c.........{nT|
+00000300 0b 47 30 a5 e9 ca e6 86 db f9 af 19 5e fe ae a6 |.G0.........^...|
+00000310 91 c8 e9 c0 c5 17 b4 a6 2b cd 40 ee 9e fc 2d ef |........+.@...-.|
+00000320 8c 68 6c ce 05 66 b1 80 7d 6f 07 91 6e 9f 23 ab |.hl..f..}o..n.#.|
+00000330 f2 a7 d1 99 d1 5f ed 58 b1 aa 7f 31 f4 7f 2a ea |....._.X...1..*.|
+00000340 3e 21 a0 4e 1c 49 d9 ab 1e 43 84 dc 42 cf f5 75 |>!.N.I...C..B..u|
+00000350 ae fc 97 a3 e7 b8 51 1b 68 1b f5 83 2b 2d b0 a5 |......Q.h...+-..|
+00000360 7c f9 f2 21 c1 68 d9 e2 4f bf f5 1e e6 90 7b 54 ||..!.h..O.....{T|
+00000370 2c 45 d2 35 a1 5c da 57 be ce 90 a7 56 90 f2 55 |,E.5.\.W....V..U|
+00000380 08 9e b1 52 09 12 b9 f1 8b fd fb 1a f2 9f 39 bf |...R..........9.|
+00000390 73 c2 9c dc 6c 0f 19 9b 37 ec 91 86 27 ec 1a e8 |s...l...7...'...|
+000003a0 92 f8 a2 05 71 12 e6 8b 04 0c f3 b4 4d 93 d4 b4 |....q.......M...|
+000003b0 69 7b c3 9c 22 16 03 03 00 4a ba fe c0 02 30 02 |i{.."....J....0.|
+000003c0 33 02 67 87 19 20 13 90 48 80 a1 93 97 cc a6 26 |3.g.. ..H......&|
+000003d0 51 14 4d 2b 60 3d da 72 f0 99 51 2a 8b b4 54 ff |Q.M+`=.r..Q*..T.|
+000003e0 47 6b 6c b4 6a 92 a9 9c 3c c0 ee ae 79 25 de 17 |Gkl.j...<...y%..|
+000003f0 61 cf 06 37 6f 84 e8 b8 4c 7b 9a c1 a1 ff 6e c5 |a..7o...L{....n.|
+00000400 f3 0b 7d 8d 16 03 03 00 14 a9 38 b9 f0 df 71 c5 |..}.......8...q.|
+00000410 1f fa 77 04 1e b4 4c 2b 64 01 e6 59 cb |..w...L+d..Y.|
>>> Flow 9 (client to server)
-00000000 16 03 03 02 69 68 53 61 f2 30 36 9b 4b 58 b2 19 |....ihSa.06.KX..|
-00000010 39 8c b0 72 4f 09 1d 4b 85 08 49 5f 27 4c d0 a9 |9..rO..K..I_'L..|
-00000020 47 01 71 90 a8 8e da 50 ad 92 29 e5 f2 20 ac f7 |G.q....P..).. ..|
-00000030 6e 6c 25 56 8a 08 25 35 14 2a bb c5 d6 02 f9 3b |nl%V..%5.*.....;|
-00000040 de 98 e3 c3 6a fb 48 30 36 41 22 be 41 bd 12 d4 |....j.H06A".A...|
-00000050 14 96 f6 c5 53 a9 37 ed c0 f5 c3 42 10 f9 76 d2 |....S.7....B..v.|
-00000060 79 f9 18 18 ff 03 63 cd bd fb 8a 90 ae 54 95 f5 |y.....c......T..|
-00000070 c9 df cb 85 93 a8 09 69 12 d2 2a bf cf 2d 62 2a |.......i..*..-b*|
-00000080 66 7f 16 50 a9 ab 1b 86 46 ed 92 75 b5 24 42 5f |f..P....F..u.$B_|
-00000090 a5 87 c7 08 98 46 42 6b 1f 3f a0 f0 c5 03 99 41 |.....FBk.?.....A|
-000000a0 c7 70 c0 6c 3a 31 b5 cc 1f a5 32 75 16 41 b1 82 |.p.l:1....2u.A..|
-000000b0 7e a6 23 4c 76 e7 73 a7 d2 31 d6 5e 63 75 2e 64 |~.#Lv.s..1.^cu.d|
-000000c0 8e c0 dd fc 69 c9 cd c5 cb 27 63 25 06 0a 38 e3 |....i....'c%..8.|
-000000d0 80 b5 29 44 25 b6 0f 65 81 eb 46 e4 27 7f 6d 83 |..)D%..e..F.'.m.|
-000000e0 13 2d f1 fb 20 1f 52 2f e2 ec e6 cc 38 7a 76 6a |.-.. .R/....8zvj|
-000000f0 a5 95 28 37 d5 fd 38 f6 b8 7f 1b d7 35 9e be 2c |..(7..8.....5..,|
-00000100 e6 35 0d bc ac bd 60 e2 76 b7 9a 36 6b b6 e2 81 |.5....`.v..6k...|
-00000110 11 18 c1 a6 33 37 aa fc 6d 27 57 56 27 8a e6 9b |....37..m'WV'...|
-00000120 16 65 be 8e 27 a3 cd a5 fa 12 49 22 52 18 bd 32 |.e..'.....I"R..2|
-00000130 82 c0 21 9f 39 fb b2 0f 8e 0d d3 52 e6 ca 98 a7 |..!.9......R....|
-00000140 4f b0 60 4a fd 21 f4 3d f8 01 58 05 38 29 4c 1a |O.`J.!.=..X.8)L.|
-00000150 52 98 a3 9d d8 0c 2a 43 36 a3 11 de 9d d4 31 a2 |R.....*C6.....1.|
-00000160 b6 3f 28 dc 3f fc cc ef c1 34 0b b8 e7 ab ea d9 |.?(.?....4......|
-00000170 22 04 ca ac 50 4f 7c 08 16 6e d6 59 e8 2e c3 29 |"...PO|..n.Y...)|
-00000180 a1 58 42 26 77 97 36 4f a6 22 32 cd 1b bf 54 83 |.XB&w.6O."2...T.|
-00000190 5c 58 b9 e0 9b e3 5e 2b c9 f0 4b 12 c6 8a f2 d2 |\X....^+..K.....|
-000001a0 ce 48 84 07 85 98 4f f3 17 2c a8 18 cc 72 71 6d |.H....O..,...rqm|
-000001b0 26 3c 2f e7 f8 04 4e c6 46 ce 1f cd 72 2f 3a 7b |&Q.......|
-00000270 03 00 35 d2 71 1a 6d a7 5d a8 ef f0 06 72 e8 fb |..5.q.m.]....r..|
-00000280 8d 9b c4 15 49 94 33 95 ad be 75 e3 f9 0f 0a 12 |....I.3...u.....|
-00000290 aa e8 4f d9 75 b1 74 17 35 83 e5 19 ee 77 15 b8 |..O.u.t.5....w..|
-000002a0 96 b5 39 71 b4 cd ce e2 16 03 03 00 98 12 dc b2 |..9q............|
-000002b0 5d 91 b2 41 9c 15 9c 9e 02 bc 7b 53 a6 1e b4 5e |]..A......{S...^|
-000002c0 4d 09 6d 3c 74 9c 08 59 ac 02 3a 3f 5f 20 6b 41 |M.miS|
-00000340 ee 6c 2f 12 b1 14 03 03 00 11 f4 df 0d 7c 69 ab |.l/..........|i.|
-00000350 2f 66 af 42 39 df 8b 11 90 a6 32 16 03 03 00 20 |/f.B9.....2.... |
-00000360 28 f1 b1 31 fa 17 04 ab 6f c8 84 a8 47 ba 9d ac |(..1....o...G...|
-00000370 8b a2 37 c5 47 9d 65 5f a2 b1 fb fc e8 0e db 29 |..7.G.e_.......)|
+00000000 16 03 03 02 69 fb 20 8a eb 44 f8 0a 95 61 0a 01 |....i. ..D...a..|
+00000010 48 6c ef 59 52 6f 99 7d 6e ce 7e 00 5e 67 f4 cd |Hl.YRo.}n.~.^g..|
+00000020 19 08 39 12 a0 43 44 59 0f 9c 21 34 06 fe 09 6f |..9..CDY..!4...o|
+00000030 3d de 99 a3 f8 96 03 12 78 eb 76 a7 ee 09 b4 49 |=.......x.v....I|
+00000040 50 42 48 09 f1 7b 54 aa e9 45 73 29 e8 41 47 9a |PBH..{T..Es).AG.|
+00000050 d5 8c fa bc f8 54 96 23 30 cb 36 ac cd 75 a4 16 |.....T.#0.6..u..|
+00000060 ee 88 cc 74 25 5d 2e e2 88 d9 9d dc 87 bd 77 8b |...t%]........w.|
+00000070 ac 98 20 34 cb c7 1c 71 44 b1 3c a6 42 11 bd 20 |.. 4...qD.<.B.. |
+00000080 65 74 c3 36 c9 e3 6d ae 7e 37 9a b7 33 d8 6c 11 |et.6..m.~7..3.l.|
+00000090 93 49 a4 e8 14 11 27 72 9c c8 44 75 21 5d 82 1e |.I....'r..Du!]..|
+000000a0 71 ca 7d 46 95 5f 2e c4 80 be 90 2f 5a 13 92 28 |q.}F._...../Z..(|
+000000b0 dc 54 5b e6 a0 9c c7 f8 bd 97 bd e5 6c 05 d2 68 |.T[.........l..h|
+000000c0 c3 f3 54 1c 9e bc a3 20 c1 de f1 e7 3a 7e 5a fd |..T.... ....:~Z.|
+000000d0 4f 22 f7 d4 e7 19 fb 94 6f fd bd 15 39 bf 9e 4b |O"......o...9..K|
+000000e0 63 35 19 0b 59 28 47 f3 56 ae 4c 13 50 30 b5 d1 |c5..Y(G.V.L.P0..|
+000000f0 d1 a9 a2 32 dc 23 5e 47 e9 dd 8c d5 32 12 d9 0d |...2.#^G....2...|
+00000100 78 04 bc ae f9 81 5c e3 05 88 c9 89 72 c6 7d 86 |x.....\.....r.}.|
+00000110 c6 55 aa 39 cd 9e 9e 5e ce 00 ce 51 fa 54 ee ba |.U.9...^...Q.T..|
+00000120 64 a6 9c a8 88 00 a8 ed 6a 7a 63 cc d8 60 a4 52 |d.......jzc..`.R|
+00000130 a9 2f 23 c5 ca 96 12 d5 ec 11 46 84 1f d3 43 74 |./#.......F...Ct|
+00000140 db 87 13 42 18 71 b9 ff 18 d4 3b b5 c5 87 c8 c0 |...B.q....;.....|
+00000150 91 fb 8c 7e c8 39 77 0e e0 52 bb 58 18 fa d8 5a |...~.9w..R.X...Z|
+00000160 e0 e5 ab 4b 08 36 be 1d 6a ae a3 44 af 54 90 2f |...K.6..j..D.T./|
+00000170 4f fb bc a5 d4 be c2 74 4e a1 22 61 10 09 5e 35 |O......tN."a..^5|
+00000180 1c ab 1c 73 de 20 37 38 d0 5f 6c 24 f8 8d 79 22 |...s. 78._l$..y"|
+00000190 0a b0 53 86 04 1e 73 36 57 dc c0 fb 98 15 ea 5e |..S...s6W......^|
+000001a0 85 1d 8f 7f 7a 59 27 8d ce 5d df 29 c8 4d 10 d2 |....zY'..].).M..|
+000001b0 87 79 9b 60 ff 17 a1 24 41 0d 12 99 dc ad ad 76 |.y.`...$A......v|
+000001c0 00 74 a3 5a 73 9e 0c f4 90 0e bb 5a 11 5a 89 c7 |.t.Zs......Z.Z..|
+000001d0 71 79 1a 72 f9 6f 19 6d eb 29 32 39 4d da 69 e4 |qy.r.o.m.)29M.i.|
+000001e0 e9 f8 3a b0 b8 10 76 c0 21 3b 95 76 ec 01 7d f2 |..:...v.!;.v..}.|
+000001f0 10 15 5f 1d 94 b1 13 e8 ca c4 07 c4 aa d1 50 65 |.._...........Pe|
+00000200 5b 1f e9 ec 50 52 f6 33 38 e7 16 e4 e5 78 29 a1 |[...PR.38....x).|
+00000210 41 6c 4f dc 07 bb 28 59 7f 1d cb 61 4d 2d 1e 43 |AlO...(Y...aM-.C|
+00000220 b5 d5 8f b8 84 ec 4d 1c c7 5c 62 b7 21 71 83 74 |......M..\b.!q.t|
+00000230 58 3b 70 92 c8 c8 af 7d f6 da 75 9d 30 99 cf 33 |X;p....}..u.0..3|
+00000240 4e f0 8f 5e 44 1b 0d 35 83 80 b9 8c 80 23 a6 29 |N..^D..5.....#.)|
+00000250 34 0c 88 8f 55 da 85 f8 92 89 4c 34 6a 73 98 bd |4...U.....L4js..|
+00000260 86 70 11 7e a3 b7 04 0a 24 07 34 6c 06 64 16 03 |.p.~....$.4l.d..|
+00000270 03 00 35 08 d2 96 51 e2 6f 68 ae 19 04 9c 59 e4 |..5...Q.oh....Y.|
+00000280 09 72 da 6a 8e ee 4f 87 b3 b3 1e 89 0b a5 45 32 |.r.j..O.......E2|
+00000290 98 a4 f3 af 64 d7 71 37 2a a5 d4 53 5a 0a 03 05 |....d.q7*..SZ...|
+000002a0 d6 33 c2 ff 5f 2d 6d 94 16 03 03 00 98 49 3c 15 |.3.._-m......I<.|
+000002b0 0a e5 ac 39 54 97 f5 2a dd 05 02 87 16 1c 6c ae |...9T..*......l.|
+000002c0 4e 62 1e 27 81 54 66 13 9a d1 1d d2 2c 5b 17 20 |Nb.'.Tf.....,[. |
+000002d0 a4 69 b5 69 ec 3a 59 bd 8b d2 5d f3 84 c7 65 a2 |.i.i.:Y...]...e.|
+000002e0 ad 02 57 bf 3f 72 c5 ce 61 24 09 7e e4 f4 2a a6 |..W.?r..a$.~..*.|
+000002f0 81 29 d0 9c 0f c5 d5 67 7a b0 e4 42 2f a5 5f 00 |.).....gz..B/._.|
+00000300 42 ea ef 8b c8 55 c6 c4 27 26 e5 f7 57 2e 35 f8 |B....U..'&..W.5.|
+00000310 e2 cc 41 6a 29 e2 66 b3 44 fe 2b f9 de 7d 32 96 |..Aj).f.D.+..}2.|
+00000320 96 e6 cf 57 2c b8 73 bc e2 c2 89 20 8a 71 d3 03 |...W,.s.... .q..|
+00000330 02 7e 95 ef 94 f6 68 b5 94 4b b4 ec a4 e0 10 42 |.~....h..K.....B|
+00000340 c4 9e f2 28 dd 14 03 03 00 11 96 52 4d c7 17 35 |...(.......RM..5|
+00000350 cf 9a 66 5f 73 c3 f5 40 60 12 11 16 03 03 00 20 |..f_s..@`...... |
+00000360 67 eb 03 bf 5c 0f b8 d5 7d e4 14 0a 81 32 50 2a |g...\...}....2P*|
+00000370 6b 02 53 f6 37 00 ef ef 8a 5f ee 3a bf 5b 84 b9 |k.S.7...._.:.[..|
>>> Flow 10 (server to client)
-00000000 14 03 03 00 11 f5 62 67 0e 91 7e aa 24 ec 3f f2 |......bg..~.$.?.|
-00000010 9f 28 6f 5d 82 d5 16 03 03 00 20 0e 66 b9 47 16 |.(o]...... .f.G.|
-00000020 b2 77 dc c5 3f ac f9 6a 4e f9 78 c4 25 64 f2 1f |.w..?..jN.x.%d..|
-00000030 6c f1 51 7f c8 5d 21 7f 0e 5c ac 17 03 03 00 19 |l.Q..]!..\......|
-00000040 69 4e ff 74 0b c7 7a ce 64 71 c9 a1 6b dd b9 9b |iN.t..z.dq..k...|
-00000050 9d 6b 21 bb cb b8 37 4d 87 16 03 03 00 14 1a 98 |.k!...7M........|
-00000060 7e 2f 5a 82 51 2c 0f 0d 79 25 4e 6f 11 dc 97 86 |~/Z.Q,..y%No....|
-00000070 64 23 |d#|
+00000000 14 03 03 00 11 ab e7 45 c8 02 30 54 0f 5a ea 63 |.......E..0T.Z.c|
+00000010 42 ea 39 9b 46 ba 16 03 03 00 20 60 56 50 ad d0 |B.9.F..... `VP..|
+00000020 fe 7d 56 a2 e1 d9 87 76 96 3b b3 27 3b 7f be e4 |.}V....v.;.';...|
+00000030 98 d0 7a 6a a2 e3 37 1c f5 a9 a1 17 03 03 00 19 |..zj..7.........|
+00000040 67 ee fd 6d 58 de bd b8 df aa 4d 36 e4 93 83 7b |g..mX.....M6...{|
+00000050 e5 bd d1 ba 5c f3 2f aa a8 16 03 03 00 14 73 29 |....\./.......s)|
+00000060 15 c9 16 62 a2 97 81 f8 44 94 86 c1 94 37 9f 19 |...b....D....7..|
+00000070 1d c2 |..|
>>> Flow 11 (client to server)
-00000000 16 03 03 01 16 08 6c 5f e7 b8 3e 36 50 c0 05 0c |......l_..>6P...|
-00000010 a6 fa 1a f8 83 3f 1f fd fd ae 62 15 4b 4e 80 8b |.....?....b.KN..|
-00000020 5a f4 a2 3e 67 df 82 28 e4 eb f4 26 5c 62 53 6e |Z..>g..(...&\bSn|
-00000030 dc 20 7f e7 af 68 7a 0b 10 77 12 36 97 c3 b9 06 |. ...hz..w.6....|
-00000040 d1 78 46 4f e9 61 f4 65 8a d6 c9 ed 2d 00 9c de |.xFO.a.e....-...|
-00000050 20 b5 20 99 cd 90 d6 d1 04 26 bd 75 42 eb ad 6a | . ......&.uB..j|
-00000060 27 27 9c 20 5b 22 e6 e3 cc 67 0e b2 ae c7 4c d5 |''. ["...g....L.|
-00000070 fa e5 c0 bc 7e c6 20 d1 75 f5 bf 18 fd bf 5c 36 |....~. .u.....\6|
-00000080 95 66 38 ab 53 ad 77 d7 ad fb 15 de 2a 66 86 56 |.f8.S.w.....*f.V|
-00000090 1c b9 4f 73 cb 9a d1 9d 60 a8 ce c0 22 ae f4 49 |..Os....`..."..I|
-000000a0 23 86 48 a2 a4 81 28 a9 d1 53 26 c6 a0 71 54 90 |#.H...(..S&..qT.|
-000000b0 54 a9 e8 df 9a f9 af 59 29 52 95 73 6f b3 0b 07 |T......Y)R.so...|
-000000c0 ed a5 1c fb 93 29 bf c7 30 bf e4 d1 5c 5c 04 ef |.....)..0...\\..|
-000000d0 f0 84 15 06 f4 28 b3 a4 ad d5 48 6b e8 ff 24 09 |.....(....Hk..$.|
-000000e0 e8 28 c4 ad de d4 8e e1 d2 e5 3b f1 03 0d 9d 61 |.(........;....a|
-000000f0 f2 b3 2a 85 dd dd a6 2d 3c c0 b2 7c c6 81 fb a8 |..*....-<..|....|
-00000100 da 3b 85 72 13 37 a4 da 11 cd 54 3e 84 43 4d 47 |.;.r.7....T>.CMG|
-00000110 30 ed 39 6d c7 a1 6a ea 39 80 75 |0.9m..j.9.u|
+00000000 16 03 03 01 16 bb 29 a6 76 e4 5a ec 09 4e a7 6a |......).v.Z..N.j|
+00000010 66 d7 6e 39 fc 5a dd be 9f 34 1e cb 3a b3 3f 1e |f.n9.Z...4..:.?.|
+00000020 48 ad 0b e0 0e 43 b1 3e 57 f3 4a d1 c7 c6 1a f0 |H....C.>W.J.....|
+00000030 a8 3e d1 37 de 95 ad 0f 92 85 ee b2 2b 1c 30 2f |.>.7........+.0/|
+00000040 f5 70 ca 42 28 0c c2 e4 06 73 d5 eb 31 d2 86 f7 |.p.B(....s..1...|
+00000050 d6 42 5d e0 b0 a6 c0 94 2c 52 0b 18 2c 95 9c 2a |.B].....,R..,..*|
+00000060 56 4d a4 17 fb 51 49 be 3a 37 27 87 c7 d5 94 56 |VM...QI.:7'....V|
+00000070 88 c5 94 a6 ff a1 dd cf 2b 70 e1 6c a9 39 1b e7 |........+p.l.9..|
+00000080 69 c3 0e ef 08 d2 fb 6d 54 8a 80 64 99 6a b3 e4 |i......mT..d.j..|
+00000090 2e 44 62 ce 1c 4d 7a 0a 45 cd ba 52 23 47 6d 05 |.Db..Mz.E..R#Gm.|
+000000a0 97 03 c6 c4 c7 5a ca bf 38 73 b4 8c e5 a5 14 1b |.....Z..8s......|
+000000b0 10 ea 29 17 af f6 37 bd 7f 56 88 b2 63 92 9f b9 |..)...7..V..c...|
+000000c0 6c 18 9b 1b ad ce ac f0 97 45 3e 72 e0 10 8e 64 |l........E>r...d|
+000000d0 80 dc cd a1 f9 10 d1 cd 46 2a 98 cd 40 94 5b dc |........F*..@.[.|
+000000e0 f5 07 05 96 f3 74 db 91 3c 45 f1 6e b7 f9 52 e8 |.....t..>> Flow 12 (server to client)
-00000000 16 03 03 00 81 4d dc 53 4e 94 ec b0 47 9b 8f 04 |.....M.SN...G...|
-00000010 98 4e 78 3a d2 64 0a 11 65 38 15 71 35 06 83 96 |.Nx:.d..e8.q5...|
-00000020 0d 0d 54 4b 4b aa 9d 3f a1 dc 89 78 c2 a4 6c 89 |..TKK..?...x..l.|
-00000030 c9 56 f1 aa 9a d4 23 9a 21 af 51 73 fe 52 98 af |.V....#.!.Qs.R..|
-00000040 d5 af 55 66 f0 bf 4d a4 73 b4 06 55 aa 01 39 49 |..Uf..M.s..U..9I|
-00000050 8d 8d 21 bf 17 45 70 1a 95 ab df fa db 24 e2 f7 |..!..Ep......$..|
-00000060 e4 98 dc 86 15 b1 d4 7a 11 c4 b2 72 80 fb 51 fa |.......z...r..Q.|
-00000070 8d b3 6e 94 5d d0 0b 47 e0 43 78 ef ce b0 69 40 |..n.]..G.Cx...i@|
-00000080 d7 b5 26 ad 90 24 16 03 03 02 69 d8 13 11 85 13 |..&..$....i.....|
-00000090 e2 4c 6a 6b 70 85 ba d4 70 c4 23 84 d5 3d 39 0c |.Ljkp...p.#..=9.|
-000000a0 03 37 a2 e7 77 c9 0f 0d 8f 7c 6c d4 f3 6e d9 71 |.7..w....|l..n.q|
-000000b0 99 d7 33 dc ab 82 24 b7 7c 7d 92 b0 da 52 6a 5c |..3...$.|}...Rj\|
-000000c0 b8 ae ad 8f 98 e7 65 e9 ce 16 ee d3 51 09 52 dd |......e.....Q.R.|
-000000d0 be 96 76 37 1c 40 83 da 14 ad 61 df 09 2b 68 4f |..v7.@....a..+hO|
-000000e0 d1 e0 93 f3 d0 c4 ad be 53 c5 5c 2e ee 79 42 3d |........S.\..yB=|
-000000f0 fa 04 7b d0 bd 7a 8f 2b 5f 2a b0 d7 98 81 45 14 |..{..z.+_*....E.|
-00000100 28 ab 85 63 28 6f a1 49 cb 2f b2 76 f1 cc 77 5f |(..c(o.I./.v..w_|
-00000110 6b ef 9c d5 47 b7 c9 f9 b5 58 c3 37 79 93 36 5b |k...G....X.7y.6[|
-00000120 00 13 ef bc 36 68 33 46 58 ae 48 11 59 52 59 f2 |....6h3FX.H.YRY.|
-00000130 74 6a 71 fe 63 38 f0 84 9a 7d 39 d6 f7 a1 92 ee |tjq.c8...}9.....|
-00000140 85 d3 3e 44 29 3d 71 b5 d5 fb 26 c3 57 ac d8 60 |..>D)=q...&.W..`|
-00000150 de 6c de 9e e0 61 e6 c4 75 3a 01 d5 ae 15 bd 51 |.l...a..u:.....Q|
-00000160 27 ff e6 b5 65 c2 30 96 10 0f 31 6c 8b d3 16 ee |'...e.0...1l....|
-00000170 ec 52 80 dc e7 84 29 9b e2 71 13 54 c3 58 b5 8b |.R....)..q.T.X..|
-00000180 22 4d c0 41 33 69 c1 fe e3 f0 42 39 ee fd c0 6a |"M.A3i....B9...j|
-00000190 c1 52 5a 64 8b a6 f0 16 71 cf 45 2b cf fe 5d 74 |.RZd....q.E+..]t|
-000001a0 b4 7f 25 dd 46 b0 e2 51 42 59 e3 79 c9 f1 f4 d0 |..%.F..QBY.y....|
-000001b0 28 f8 74 f1 df 74 e6 b6 0b 8a be 11 e0 67 c1 79 |(.t..t.......g.y|
-000001c0 a1 7c 18 0e 65 8b 5c 76 3c c1 7c 79 5f b9 06 3a |.|..e.\v<.|y_..:|
-000001d0 ce a3 69 04 cf 9c 1e bf 5e 53 4e ac 79 59 63 ec |..i.....^SN.yYc.|
-000001e0 57 5b 87 c5 48 cb 13 09 9f 68 61 02 e4 3b a1 2d |W[..H....ha..;.-|
-000001f0 a7 86 95 39 1e 83 05 50 e2 f9 ad 9b 92 2f f5 21 |...9...P...../.!|
-00000200 e9 da 58 e6 d9 ef 9e 69 62 dc e1 8f a5 04 89 db |..X....ib.......|
-00000210 2f 41 f6 37 c6 fa e1 d6 c5 73 3f 54 e8 dc d3 bb |/A.7.....s?T....|
-00000220 d6 83 23 c9 c5 e6 85 67 78 39 21 4f 99 88 21 81 |..#....gx9!O..!.|
-00000230 88 a7 8d cd ed e7 68 05 84 c0 32 34 39 85 79 7d |......h...249.y}|
-00000240 18 28 94 25 ee e8 9d c6 40 03 c7 1b 6c 4c 27 33 |.(.%....@...lL'3|
-00000250 c1 65 79 8b e5 9b 54 9b 91 e0 b8 7f 7b 8b 66 b2 |.ey...T.....{.f.|
-00000260 5f 2b 18 52 ad 69 d6 6a f8 22 c5 a9 fc e0 1d 72 |_+.R.i.j.".....r|
-00000270 ae 18 13 ba 33 b7 ed 0e 6c 49 95 01 1e 3c 72 ed |....3...lI......Y.&1.|
-000002d0 b7 0f 37 9c 44 53 2c b7 0a 01 8c 10 00 92 0c cf |..7.DS,.........|
-000002e0 e5 aa 62 a7 ef 8a d9 9a 2c 2a ec 35 6e ab 5c e0 |..b.....,*.5n.\.|
-000002f0 ee 34 ff dd 16 03 03 00 bc 9c 3f f9 18 06 c1 bc |.4........?.....|
-00000300 51 3b f7 9b 00 3e db 7c 0b 6b cd 0d 15 01 2d 00 |Q;...>.|.k....-.|
-00000310 d8 be 79 94 56 a3 2f e0 fb 04 da 77 4b ff 68 42 |..y.V./....wK.hB|
-00000320 b1 ca 12 0d e8 af a7 fc 12 7a 85 82 21 71 90 9d |.........z..!q..|
-00000330 63 ff 60 ed 18 65 c3 6c eb 84 81 fb ff fa e5 ea |c.`..e.l........|
-00000340 bc e7 d5 d0 14 6f ee bb 17 a8 0d ed 2d dd 94 0c |.....o......-...|
-00000350 8c 3f db e3 57 53 e8 27 9c b5 61 e6 a4 07 9b 0e |.?..WS.'..a.....|
-00000360 a9 0a b5 56 cb 08 8c 6d 90 8b 25 4b 56 30 70 7c |...V...m..%KV0p||
-00000370 7a c8 a9 97 53 e1 8a 59 bb 7c bb 93 96 90 e1 af |z...S..Y.|......|
-00000380 32 c4 14 24 06 2e 68 84 ac 21 1e 44 3b 3b 7e 35 |2..$..h..!.D;;~5|
-00000390 b8 41 27 bb 9c d8 c6 9e dc 9d 89 9a 3b fa a5 fd |.A'.........;...|
-000003a0 10 43 74 d6 a8 15 14 80 38 3d 30 e0 b0 eb ec 25 |.Ct.....8=0....%|
-000003b0 3b 47 ec 85 87 16 03 03 00 14 2f f9 cd f0 af 35 |;G......../....5|
-000003c0 69 f4 32 4e 55 10 9f fc 0e 69 34 be bc 06 |i.2NU....i4...|
+00000000 16 03 03 00 81 47 d2 a4 b9 04 d0 39 aa 1f d3 7a |.....G.....9...z|
+00000010 f2 c3 a5 03 8a 35 6c 6b bf 18 02 62 d3 ab 8a 0f |.....5lk...b....|
+00000020 99 69 f3 84 45 7a 09 28 09 68 3a 67 8a ee 94 b1 |.i..Ez.(.h:g....|
+00000030 d3 2a e6 37 b7 f1 88 df c0 18 42 96 78 4e cf 3b |.*.7......B.xN.;|
+00000040 e9 35 50 af ee 96 52 e9 1c 58 47 79 87 97 ce d9 |.5P...R..XGy....|
+00000050 71 9b 4a 47 bc 60 8f 95 ea 75 4e c8 3e ca 79 0f |q.JG.`...uN.>.y.|
+00000060 22 b2 37 19 12 d6 08 4d 01 93 d9 86 ed 4c 9e 42 |".7....M.....L.B|
+00000070 fb 9b 37 26 98 33 74 cf 84 f4 e1 23 81 6f b6 b2 |..7&.3t....#.o..|
+00000080 a9 27 e7 88 50 77 16 03 03 02 69 6b 78 db e3 0e |.'..Pw....ikx...|
+00000090 cc 07 a4 96 1f 75 13 6d fe cd 3d 36 8c b0 44 e9 |.....u.m..=6..D.|
+000000a0 4a 3a 41 26 c9 8c 2f 25 28 9d a8 7b dd df 28 6a |J:A&../%(..{..(j|
+000000b0 fc ef 87 d4 06 dd 4e 05 ff 40 e3 6c 49 94 ad 1c |......N..@.lI...|
+000000c0 c2 30 cc 41 35 39 a2 70 95 db de a7 c0 aa 05 c0 |.0.A59.p........|
+000000d0 a2 a7 18 8e ba 70 ee 4b 0d 8d de 98 c7 8a 58 9c |.....p.K......X.|
+000000e0 8b 51 f7 8f bb 7c 8f f7 60 53 9e 11 7e 5c e6 25 |.Q...|..`S..~\.%|
+000000f0 be 22 aa 0a 3d 35 1c ac 2b 7d 98 fc 01 3a a9 9d |."..=5..+}...:..|
+00000100 bf b5 d1 ae 10 52 ae 17 f6 df fc 24 38 0b f2 64 |.....R.....$8..d|
+00000110 a8 9a 5c ff cb 42 bd 9d af 41 4d 6b 22 67 94 ac |..\..B...AMk"g..|
+00000120 6b 95 2e 43 41 5d 5e c9 67 29 5f f8 8e 13 9d 18 |k..CA]^.g)_.....|
+00000130 3c d4 ff 20 66 ff a6 d1 84 1a 33 31 27 5d 28 b5 |<.. f.....31'](.|
+00000140 24 57 43 c1 83 6a e7 8c 35 0c a7 6f 5e 78 e8 84 |$WC..j..5..o^x..|
+00000150 7c ee 9a 94 dc fd f7 a4 10 3d bb 66 0a 17 14 e7 ||........=.f....|
+00000160 d7 29 47 f7 70 76 d6 ec b2 3c e2 a0 22 e6 c5 c3 |.)G.pv...<.."...|
+00000170 bf a6 94 72 8b 70 eb 2b b8 4f c9 7d 72 22 75 ce |...r.p.+.O.}r"u.|
+00000180 b9 c2 34 08 ac 87 d3 a8 35 81 f7 5e 20 02 0c e8 |..4.....5..^ ...|
+00000190 0a 47 4e 37 4a 03 6d b1 c5 8f 29 77 80 c7 6c 5c |.GN7J.m...)w..l\|
+000001a0 c3 3e 6f 3d 02 ee 5e f2 fb 20 a2 ad c1 5b 2c 02 |.>o=..^.. ...[,.|
+000001b0 ef dd 81 e7 ea af f0 01 4f 0b eb f8 a1 82 3d ee |........O.....=.|
+000001c0 be b5 09 df f2 34 49 f0 e8 f3 bc 7e e7 6a 14 0d |.....4I....~.j..|
+000001d0 e4 aa e5 38 8a 2c 15 01 52 48 83 46 50 13 2b 71 |...8.,..RH.FP.+q|
+000001e0 f4 48 1a 3d 3f 14 dc 3c ba fc a8 68 57 44 5d f1 |.H.=?..<...hWD].|
+000001f0 f4 7f 23 8d ca f1 75 99 8c 36 99 38 b9 06 85 d0 |..#...u..6.8....|
+00000200 a6 76 8b ae 7e 2a 26 cb cc 9e 8c 7c 98 e6 00 86 |.v..~*&....|....|
+00000210 a9 d4 cb 42 8c 04 dc 6b 37 1e 8b e2 98 90 0f b3 |...B...k7.......|
+00000220 c0 ea 07 1c 92 45 39 65 12 90 41 23 93 55 59 13 |.....E9e..A#.UY.|
+00000230 22 e1 68 05 cc 5d ef a2 40 85 fb 61 d5 53 cb 77 |".h..]..@..a.S.w|
+00000240 63 7b 16 bf c6 17 57 fb 58 1e d2 86 1a 4a 79 a2 |c{....W.X....Jy.|
+00000250 1f da 2c 64 65 1c 7c 13 21 1b 33 22 36 0e 03 41 |..,de.|.!.3"6..A|
+00000260 8e 6a 78 98 ae 29 71 3e 5c be 5f 83 55 f4 80 2d |.jx..)q>\._.U..-|
+00000270 b8 2a b8 84 bd 97 7c 60 03 ae 67 77 44 47 70 c2 |.*....|`..gwDGp.|
+00000280 09 0d 1b ed a8 17 8e 84 97 1a b4 75 c2 48 86 bd |...........u.H..|
+00000290 b1 3c 1f 7c 1a 5b 60 10 a0 66 aa 8e f7 ba 9b e8 |.<.|.[`..f......|
+000002a0 35 6c 46 f0 67 3f f1 8b 5f a0 be 31 2e 45 22 80 |5lF.g?.._..1.E".|
+000002b0 ba d1 ff 88 f0 c8 bd 31 84 64 6a 07 02 75 bd 99 |.......1.dj..u..|
+000002c0 f1 aa 3c 9d 0e b8 f4 76 b3 24 4f 68 f0 83 b1 da |..<....v.$Oh....|
+000002d0 eb 70 1e 27 f4 17 90 a4 bc e5 1f d8 8b ee a1 e4 |.p.'............|
+000002e0 1e c5 f4 a2 5b c3 0c 6d 2e c8 0e 67 89 4b d9 fe |....[..m...g.K..|
+000002f0 9b a0 15 97 16 03 03 00 bc 2c e6 a2 fe 1b d7 1e |.........,......|
+00000300 38 85 ef 39 d1 d6 df ae c4 7f af b2 ff c2 92 0b |8..9............|
+00000310 37 e3 5c a9 6c 2c 9e f7 0e a3 88 ee 09 14 6b eb |7.\.l,........k.|
+00000320 46 81 74 4a a7 f8 39 82 7d a0 16 69 e4 17 52 f0 |F.tJ..9.}..i..R.|
+00000330 16 5f f7 2a a1 a0 a2 bb 41 4c 0c f9 9c e3 af 5e |._.*....AL.....^|
+00000340 bd 43 47 2d 6d 4a 88 60 95 52 29 94 3d ec 75 d4 |.CG-mJ.`.R).=.u.|
+00000350 dc f5 01 4a 57 fd 7b 96 13 75 5b ed a8 9d 29 5f |...JW.{..u[...)_|
+00000360 5f 28 dc 04 3a 91 0f 6b d6 7d 32 fe 75 cd 61 49 |_(..:..k.}2.u.aI|
+00000370 1b 6d b3 c6 41 87 6b 2d 09 e1 3d 8e f5 fb 9b b7 |.m..A.k-..=.....|
+00000380 04 9a 01 ab 82 e5 2b 17 4f 93 d7 ef 31 79 10 b0 |......+.O...1y..|
+00000390 1c cb 17 5b 8a 7a e9 22 ea 83 68 93 68 f6 85 34 |...[.z."..h.h..4|
+000003a0 d1 4d 75 5a b3 69 46 42 92 04 09 47 b1 8e 67 ad |.MuZ.iFB...G..g.|
+000003b0 47 4e 2c 02 48 16 03 03 00 14 b0 40 bb eb e1 a6 |GN,.H......@....|
+000003c0 94 fd d0 8a e1 91 a7 c9 d2 4b f8 95 95 c7 |.........K....|
>>> Flow 13 (client to server)
-00000000 16 03 03 00 35 d6 3f 29 84 29 7e 6b a9 c8 30 51 |....5.?).)~k..0Q|
-00000010 e9 ab f5 2e f6 ae 21 f0 f2 81 cd d3 29 d1 90 4a |......!.....)..J|
-00000020 72 a0 42 0b 37 db be 88 fe eb 83 4e f8 d1 1e 11 |r.B.7......N....|
-00000030 18 13 8e 93 cd c2 be ed fa 6b 14 03 03 00 11 43 |.........k.....C|
-00000040 58 95 9e e8 f3 55 52 86 10 4c 9f 43 4c 10 b7 c5 |X....UR..L.CL...|
-00000050 16 03 03 00 20 e8 98 d2 f8 ba 0f 82 98 f2 dc f7 |.... ...........|
-00000060 f8 62 3c 35 e6 f4 4a 8e d4 c1 28 73 21 8d 98 ea |.b<5..J...(s!...|
-00000070 97 c9 28 36 6e |..(6n|
+00000000 16 03 03 00 35 25 1e 49 ad bf 9c 37 e2 d0 2b aa |....5%.I...7..+.|
+00000010 44 91 d5 61 e7 a5 16 b2 cb 93 43 d7 a0 2b b7 19 |D..a......C..+..|
+00000020 f2 41 d8 36 65 95 4a bb 68 1b 65 7b de 89 a5 af |.A.6e.J.h.e{....|
+00000030 1a aa ec bf b4 66 97 fc 76 d0 14 03 03 00 11 94 |.....f..v.......|
+00000040 b0 9b 4d 47 6e 63 e3 3d c4 a7 36 94 3f d2 04 a3 |..MGnc.=..6.?...|
+00000050 16 03 03 00 20 34 f5 58 f2 80 c9 19 41 07 d8 6c |.... 4.X....A..l|
+00000060 6f 64 e7 e9 76 65 cf a8 61 97 27 29 28 f8 0c 7a |od..ve..a.')(..z|
+00000070 2c 5e 05 c6 53 |,^..S|
>>> Flow 14 (server to client)
-00000000 14 03 03 00 11 f0 39 a2 95 5c ed d1 ae 22 c3 30 |......9..\...".0|
-00000010 ba 24 34 92 f9 2e 16 03 03 00 20 cb 3c c6 a2 59 |.$4....... .<..Y|
-00000020 0a 06 3b 51 dc f4 07 16 5f 59 55 3d 7a ff c6 a6 |..;Q...._YU=z...|
-00000030 5f c9 6f 05 ec a5 ca 26 e8 a2 98 17 03 03 00 19 |_.o....&........|
-00000040 e7 70 10 59 2a fd 3a a2 bb 68 f9 67 c5 02 ff 0f |.p.Y*.:..h.g....|
-00000050 df 4b b9 4a af ae 99 3a 37 |.K.J...:7|
+00000000 14 03 03 00 11 c3 73 b6 63 12 88 86 2b cb a8 94 |......s.c...+...|
+00000010 9b c4 10 9f 98 cb 16 03 03 00 20 1e 06 97 84 3f |.......... ....?|
+00000020 7f 2e 8d 1a 81 1d da d1 f5 53 5d a4 89 9e 90 22 |.........S]...."|
+00000030 fd 14 58 d1 f7 b2 cd eb 42 2f e8 17 03 03 00 19 |..X.....B/......|
+00000040 1f e3 dc 74 9d 6b 81 43 cb 31 6b 48 31 50 15 e8 |...t.k.C.1kH1P..|
+00000050 80 f0 60 c4 43 f6 50 9a 3c |..`.C.P.<|
>>> Flow 15 (client to server)
-00000000 15 03 03 00 12 5c bf f0 9d 23 49 46 1d 56 03 45 |.....\...#IF.V.E|
-00000010 73 2d d2 38 3e 7a 75 |s-.8>zu|
+00000000 15 03 03 00 12 33 e5 90 b6 f4 60 f4 da 3f f5 c4 |.....3....`..?..|
+00000010 5c a1 a1 75 01 04 8a |\..u...|
diff --git a/src/crypto/tls/testdata/Client-TLSv12-RenegotiateTwiceRejected b/src/crypto/tls/testdata/Client-TLSv12-RenegotiateTwiceRejected
index 91566b1a1f..f9a7a11374 100644
--- a/src/crypto/tls/testdata/Client-TLSv12-RenegotiateTwiceRejected
+++ b/src/crypto/tls/testdata/Client-TLSv12-RenegotiateTwiceRejected
@@ -16,11 +16,11 @@
000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0|
000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t|
>>> Flow 2 (server to client)
-00000000 16 03 03 00 59 02 00 00 55 03 03 ef fc 56 c9 fb |....Y...U....V..|
-00000010 4a 34 30 75 fd ee 15 a8 0c dd b5 a6 e8 80 9a 67 |J40u...........g|
-00000020 5f f7 a6 14 be 5b 9c b1 31 f2 5a 20 5a 88 e1 e8 |_....[..1.Z Z...|
-00000030 84 21 a5 0a 69 ca 66 d2 f0 9f a3 d8 fb f6 2c f6 |.!..i.f.......,.|
-00000040 44 50 b4 77 7e c0 ce 6c f0 43 f4 9c cc a8 00 00 |DP.w~..l.C......|
+00000000 16 03 03 00 59 02 00 00 55 03 03 52 6a c1 e9 3d |....Y...U..Rj..=|
+00000010 5e 12 f4 95 42 33 5e 56 98 6b e5 b9 c0 e2 b4 02 |^...B3^V.k......|
+00000020 3e 99 0c 26 52 66 69 35 ef 4a 66 20 bb ee b5 86 |>..&Rfi5.Jf ....|
+00000030 ec 40 54 e7 ef 93 8e cd e4 bd c2 57 e7 2b d3 86 |.@T........W.+..|
+00000040 44 93 8f 4f 3a e3 4d eb 53 88 b0 43 cc a8 00 00 |D..O:.M.S..C....|
00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................|
00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..|
00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............|
@@ -60,188 +60,188 @@
00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.|
000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..|
000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......|
-000002c0 ac 0c 00 00 a8 03 00 1d 20 8a a6 ee 07 46 48 fa |........ ....FH.|
-000002d0 f5 c7 bb 6b f0 7f 4f dc 63 99 19 66 f7 8e 56 74 |...k..O.c..f..Vt|
-000002e0 a0 1c 7c da 8f 85 23 b6 4d 08 04 00 80 3f be fc |..|...#.M....?..|
-000002f0 45 87 6d 9c 7d db e2 48 7d 48 e0 0c 8f e6 2b f2 |E.m.}..H}H....+.|
-00000300 ec 3b 7d d2 7c 23 56 cd 25 d5 1d 30 24 58 cd 4c |.;}.|#V.%..0$X.L|
-00000310 79 dc 3d 27 d0 14 33 a2 4a ae 1b 2f 5c fa bc dc |y.='..3.J../\...|
-00000320 80 0c 33 fa eb 04 5a 3a f7 b5 8b f8 07 e4 b4 cf |..3...Z:........|
-00000330 bd 13 7d 1f f6 c2 6e 75 a7 4d 59 23 c0 b8 31 b8 |..}...nu.MY#..1.|
-00000340 17 4e e6 d4 36 f1 63 29 82 70 4d ce 96 4e 7f 82 |.N..6.c).pM..N..|
-00000350 14 2d 1a e2 03 52 d5 c8 9f 97 67 73 f1 4c 00 fe |.-...R....gs.L..|
-00000360 c1 da ba 85 6b e9 f9 0e a2 dc 0d b8 7a 16 03 03 |....k.......z...|
+000002c0 ac 0c 00 00 a8 03 00 1d 20 dc 94 bc ee 1b 36 ac |........ .....6.|
+000002d0 13 5f 6a b8 12 89 3b 05 8f 76 cf 1e 9c 20 2e 75 |._j...;..v... .u|
+000002e0 7c a4 f4 23 7f 74 72 97 74 08 04 00 80 b9 22 bb ||..#.tr.t.....".|
+000002f0 8e 21 42 cd 1e 68 2c 47 f0 b1 7f 2d 26 ac 7b a6 |.!B..h,G...-&.{.|
+00000300 10 b0 a7 72 31 99 ce be 5e e3 a5 c0 18 a6 18 50 |...r1...^......P|
+00000310 d8 98 9c 0a f5 15 0f db be 76 50 4b 09 8d f0 94 |.........vPK....|
+00000320 a3 48 23 7b d0 13 5e 2c 71 c1 8b e4 56 2b 69 88 |.H#{..^,q...V+i.|
+00000330 88 78 b4 b7 7c 0f 29 6c 73 21 b3 e5 26 a5 10 04 |.x..|.)ls!..&...|
+00000340 23 93 77 06 81 ff 23 df 06 be 82 4e ac 42 80 10 |#.w...#....N.B..|
+00000350 ea db 84 f9 96 98 8e bb bf ab b4 b6 fc 21 88 02 |.............!..|
+00000360 49 cb a3 4c 89 ee 19 cb 4d 71 6f fc 37 16 03 03 |I..L....Mqo.7...|
00000370 00 04 0e 00 00 00 |......|
>>> Flow 3 (client to server)
00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.|
00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....|
00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......|
-00000030 16 03 03 00 20 4e e0 f0 1b ee c0 b0 08 57 d2 62 |.... N.......W.b|
-00000040 42 9d 1c df c9 a7 1d a2 d9 f7 bc ad b3 4a 10 3d |B............J.=|
-00000050 19 f9 86 65 62 |...eb|
+00000030 16 03 03 00 20 6e 65 ea 6e 03 fb f9 4e 00 8f d1 |.... ne.n...N...|
+00000040 99 24 83 3a 38 ef 28 7b 16 43 70 b5 af 0d de 37 |.$.:8.({.Cp....7|
+00000050 cd bf ac 83 09 |.....|
>>> Flow 4 (server to client)
-00000000 14 03 03 00 01 01 16 03 03 00 20 d8 bd 04 97 4f |.......... ....O|
-00000010 9b 65 26 89 85 0d 95 62 cf e0 b9 47 41 4b 63 f7 |.e&....b...GAKc.|
-00000020 c6 8a 3a a9 aa 4d 8c 75 a3 9f de |..:..M.u...|
+00000000 14 03 03 00 01 01 16 03 03 00 20 ef 39 04 ca 70 |.......... .9..p|
+00000010 71 ee f8 1b 72 10 b7 6a 89 cd 85 ee a4 81 a4 87 |q...r..j........|
+00000020 88 1b c7 5b 18 d9 95 fe 31 d9 c8 |...[....1..|
>>> Flow 5 (client to server)
-00000000 17 03 03 00 16 f2 0d 54 a8 f0 54 f5 46 34 47 62 |.......T..T.F4Gb|
-00000010 32 42 b1 e0 ee 58 3f 76 98 92 95 |2B...X?v...|
+00000000 17 03 03 00 16 58 8c 23 1b 8d 7f 44 92 a4 5d 88 |.....X.#...D..].|
+00000010 3e ee 7c 98 90 14 b4 61 e9 5c ea |>.|....a.\.|
>>> Flow 6 (server to client)
-00000000 16 03 03 00 14 9a 6f 93 24 77 ee 28 3b 10 cf bb |......o.$w.(;...|
-00000010 26 6a a1 ce d8 c6 70 bf ce |&j....p..|
+00000000 16 03 03 00 14 32 2b 55 14 4a 65 21 51 b0 72 e0 |.....2+U.Je!Q.r.|
+00000010 4c 57 b0 b1 78 0b e3 30 de |LW..x..0.|
>>> Flow 7 (client to server)
-00000000 16 03 03 01 16 f6 d7 1b 74 c1 89 ef 25 7b 62 49 |........t...%{bI|
-00000010 5f 4f 95 ba 96 39 25 8e d2 43 76 38 60 0b 38 83 |_O...9%..Cv8`.8.|
-00000020 31 72 c7 c1 7f 2c be 9f fe c9 d2 14 84 cb 5b 67 |1r...,........[g|
-00000030 08 b5 a7 67 dc d9 f6 26 11 49 6d 91 42 0d 62 79 |...g...&.Im.B.by|
-00000040 c2 c8 9d 6a 20 44 03 ab 9b dd 05 e1 fd 7f e9 3d |...j D.........=|
-00000050 17 c4 8c 54 66 87 e3 96 30 da 91 23 c6 47 a0 e5 |...Tf...0..#.G..|
-00000060 9d f0 b1 98 da b9 e8 56 85 b6 d6 c2 96 f7 44 f3 |.......V......D.|
-00000070 42 75 52 fc c6 b9 a4 11 86 81 c8 7b 96 7d 90 f4 |BuR........{.}..|
-00000080 ad 18 45 28 aa 3c 09 e0 63 37 f6 b7 c7 0a 2f 99 |..E(.<..c7..../.|
-00000090 68 60 3f 99 ae b3 81 ce dd de 2f d4 77 64 47 5e |h`?......./.wdG^|
-000000a0 43 a6 d4 fa 63 03 54 d6 d3 73 ab 97 54 04 08 e4 |C...c.T..s..T...|
-000000b0 c7 0c 5f 39 99 cf df af 9a 70 76 4d 11 f1 49 24 |.._9.....pvM..I$|
-000000c0 9e dc 63 68 41 e6 3d da 2c fd dc 07 8b 88 42 43 |..chA.=.,.....BC|
-000000d0 e9 b3 e0 8e 43 2e 43 d5 1f bc 9d b9 d3 ab e1 6f |....C.C........o|
-000000e0 5a 4e ae 51 6d f8 93 c0 c8 68 e1 96 b2 f4 88 6a |ZN.Qm....h.....j|
-000000f0 0a c5 f5 29 88 4e e1 42 17 a1 9c 15 5c 4d 71 a8 |...).N.B....\Mq.|
-00000100 1d 0e 24 48 06 ab ac 4b 62 d2 d9 37 55 b3 d7 76 |..$H...Kb..7U..v|
-00000110 83 4b bc 5e 03 17 f9 cf 62 97 02 |.K.^....b..|
+00000000 16 03 03 01 16 ff 7a 5b 80 e0 cd 83 55 3d b5 97 |......z[....U=..|
+00000010 60 d2 51 1e 75 d2 5d b9 ea 2a 5f 67 43 03 7c 50 |`.Q.u.]..*_gC.|P|
+00000020 25 5d a2 81 5f fa 0f be 08 9d 80 ac 73 16 bc 64 |%].._.......s..d|
+00000030 51 54 33 09 cc 05 90 24 c0 ee 99 a9 d1 8f 1b 3e |QT3....$.......>|
+00000040 9f 6a e8 b6 83 b0 30 fe e6 6b 6e 37 dd 95 95 30 |.j....0..kn7...0|
+00000050 64 46 c7 fc 15 54 84 ef 3d 1a 28 2d ee 3b aa 19 |dF...T..=.(-.;..|
+00000060 60 21 f9 d1 98 04 b4 0f 08 79 34 1f aa 12 2e 60 |`!.......y4....`|
+00000070 93 ff 87 16 56 55 24 c7 96 00 3b c2 72 7f 9d 96 |....VU$...;.r...|
+00000080 8b b7 2b 50 8f 99 df f5 4c 6a 42 0a cc 2f 27 f2 |..+P....LjB../'.|
+00000090 88 6d 42 e3 20 c8 1f 01 2b fb e9 b3 aa f3 2f 02 |.mB. ...+...../.|
+000000a0 fa 78 34 38 00 0f 1d f9 c7 5a 08 ae 56 19 c2 6c |.x48.....Z..V..l|
+000000b0 0b b0 d1 40 0d 0e 57 d2 00 be 3d 65 9c c1 86 00 |...@..W...=e....|
+000000c0 4c a5 1b a6 67 4d 39 cd ba fe 96 3c c5 25 dd 43 |L...gM9....<.%.C|
+000000d0 7b 49 f0 b5 8a 66 46 d4 65 6b 2d da 55 13 14 48 |{I...fF.ek-.U..H|
+000000e0 76 c8 2c 3d a4 4d 7a 14 1e 70 32 06 b3 96 cd 4e |v.,=.Mz..p2....N|
+000000f0 bd 4f 06 a8 83 ae 30 83 b6 6b 61 2e 08 73 0e 14 |.O....0..ka..s..|
+00000100 08 13 3d f0 7c ec cf 78 ff b4 25 21 15 5e 80 14 |..=.|..x..%!.^..|
+00000110 80 4f af c7 9e 44 04 33 da cb 27 |.O...D.3..'|
>>> Flow 8 (server to client)
-00000000 16 03 03 00 81 96 53 73 c8 b5 6a 00 4a 58 41 8f |......Ss..j.JXA.|
-00000010 42 e6 47 47 2b bd 0e 1e 90 30 ae fa ab 88 0b 01 |B.GG+....0......|
-00000020 70 79 c4 39 f1 ee cf 98 5d 7f 0d 81 23 28 40 40 |py.9....]...#(@@|
-00000030 f8 7a 72 13 02 75 ec 68 d5 7a 11 8a 15 b6 bb 4c |.zr..u.h.z.....L|
-00000040 9e f5 70 1c 17 b2 b5 bc 30 c5 43 d8 8f 12 d9 cb |..p.....0.C.....|
-00000050 46 ba 02 36 dc bb b5 64 c4 9a 15 e7 ed 16 5c 74 |F..6...d......\t|
-00000060 df 53 d4 c1 f1 01 ab 71 25 b8 8e 7b e0 ae f2 3d |.S.....q%..{...=|
-00000070 f2 cf 21 64 c2 61 34 c3 56 d7 80 9a fd 85 6e ac |..!d.a4.V.....n.|
-00000080 a6 10 97 87 1d 06 16 03 03 02 69 53 75 f7 64 d8 |..........iSu.d.|
-00000090 34 23 ce 18 4c 68 b7 f6 0f 7d be a8 bb d0 c9 2f |4#..Lh...}...../|
-000000a0 6a 4e b1 9d 88 ad 41 8b a7 42 14 02 9d 8f 9d ee |jN....A..B......|
-000000b0 f4 b0 6b d2 ac db 67 33 38 b1 5a d8 df c9 e8 f2 |..k...g38.Z.....|
-000000c0 e1 b2 08 bf fd 83 bb d9 9b 07 0c 05 c7 e5 e3 95 |................|
-000000d0 17 04 66 ad 22 c4 32 5e 2e b8 28 4a 4e 18 bf ee |..f.".2^..(JN...|
-000000e0 60 81 a1 f5 b0 2a e3 a5 fd c0 7f b7 6f 1d 1e 9e |`....*......o...|
-000000f0 6b 55 ec b5 e8 2a 95 b3 f1 91 40 e8 e9 49 f1 0e |kU...*....@..I..|
-00000100 14 9a 83 be fb eb 1f 64 34 79 3e 62 6d 3b 3a fc |.......d4y>bm;:.|
-00000110 7e 7b 5a 9e c4 f7 a2 97 50 fe a4 40 d6 6d a0 00 |~{Z.....P..@.m..|
-00000120 53 0b ae 67 54 fc 3f 4b f3 ba eb e5 76 5b 8b 9f |S..gT.?K....v[..|
-00000130 06 87 53 8c 23 93 57 00 dd 29 b3 60 38 1c e2 26 |..S.#.W..).`8..&|
-00000140 c7 ba 0b a4 ae db c2 3e 49 50 7e be 0b 47 75 bd |.......>IP~..Gu.|
-00000150 bd 55 34 70 8e 99 a9 ed a9 50 e7 d3 6b c2 a2 63 |.U4p.....P..k..c|
-00000160 29 73 6e 0e 22 26 92 72 71 8d b1 d6 d1 e4 98 b1 |)sn."&.rq.......|
-00000170 a4 94 73 f4 39 1b bc 6d 58 fc 4f b3 e4 24 e7 75 |..s.9..mX.O..$.u|
-00000180 48 92 f7 be 15 06 36 15 1a 30 a5 65 10 4d 45 fe |H.....6..0.e.ME.|
-00000190 75 6d 2f a5 52 2c 71 f6 c2 e0 9e 6f 1c 7e ce f3 |um/.R,q....o.~..|
-000001a0 81 23 7e 73 c3 56 e3 26 d3 d0 d4 a5 69 05 3a 94 |.#~s.V.&....i.:.|
-000001b0 0c 4c 31 27 e3 4c ad 1a 77 db 85 4c ad ca f1 ce |.L1'.L..w..L....|
-000001c0 5c 25 57 4b 3c 5f 58 e9 15 dc aa 3b 30 f4 72 44 |\%WK<_X....;0.rD|
-000001d0 0c 2c e3 ed bc f9 0b ef 8e e6 57 ae 6c fa ca 89 |.,........W.l...|
-000001e0 b6 91 ec 90 d6 40 65 ea c2 33 32 d9 93 76 82 0c |.....@e..32..v..|
-000001f0 06 a7 e1 33 e7 7a 01 23 8f cb 6a 4b 2d 0b eb a5 |...3.z.#..jK-...|
-00000200 f0 80 1a fb c4 ec 05 b8 ef c9 58 6f a4 12 87 b5 |..........Xo....|
-00000210 18 cc c0 64 5f 41 7c e3 a7 98 50 1c 68 ca 8a 89 |...d_A|...P.h...|
-00000220 c0 c8 1b 77 28 11 54 9e 5d 38 14 c5 ac 50 4c 9d |...w(.T.]8...PL.|
-00000230 2c 72 6e 0e 98 9b 2d 29 3a 81 62 05 96 23 c8 9e |,rn...-):.b..#..|
-00000240 bd 27 cf 16 60 e2 77 8c af 7a 08 05 cd 2c 06 8f |.'..`.w..z...,..|
-00000250 52 6a b1 82 ad dc 60 56 0f bd 71 1d 2c a0 4b d3 |Rj....`V..q.,.K.|
-00000260 03 1e c3 75 21 8b 8c d3 cb bb 0b 8f 9c 44 43 a4 |...u!........DC.|
-00000270 2e d8 35 2c 3d ab 0b c9 3a 23 54 45 df 48 59 ab |..5,=...:#TE.HY.|
-00000280 df 8a bc b6 e2 68 97 64 d7 f4 9f bd c4 a0 45 9c |.....h.d......E.|
-00000290 7d 4f 00 ce 98 60 c2 3e 4f af cd 55 27 e8 57 ef |}O...`.>O..U'.W.|
-000002a0 5e 81 58 90 60 e3 7c ca 0a 81 fa 47 38 dc d3 6f |^.X.`.|....G8..o|
-000002b0 3e 6e c4 62 eb 91 aa 2b 42 f3 46 8f 57 a4 b3 5a |>n.b...+B.F.W..Z|
-000002c0 ef 5b 80 82 12 05 40 6a 63 69 53 be 20 16 ab e7 |.[....@jciS. ...|
-000002d0 72 f7 79 a6 d9 d1 46 33 2f a3 34 f8 c1 60 06 98 |r.y...F3/.4..`..|
-000002e0 10 47 3c e2 95 31 b5 69 b8 9e f0 15 2b e0 7c 22 |.G<..1.i....+.|"|
-000002f0 1b b8 e1 b6 16 03 03 00 bc 3b 1a 18 ff 2c a5 9f |.........;...,..|
-00000300 0b 79 13 81 1f e8 df 9e 9c 95 57 50 9d 53 32 5f |.y........WP.S2_|
-00000310 27 4b aa ca 8e 7c fb 7e 69 27 06 7c aa 7d 73 ba |'K...|.~i'.|.}s.|
-00000320 05 d2 f6 d7 61 87 3f d5 12 b6 13 75 09 bf d2 44 |....a.?....u...D|
-00000330 d3 e7 c4 86 f9 4c 9e e7 1c 5b 3c 14 5d 0d fd f4 |.....L...[<.]...|
-00000340 03 9a 24 5c a2 fd 84 7c 2e 76 8a 15 ff 7a ad 74 |..$\...|.v...z.t|
-00000350 27 a8 ec 87 65 fc a9 f0 58 36 bd 42 54 e8 fd 89 |'...e...X6.BT...|
-00000360 62 fc 74 c2 c3 4e 54 2e 49 34 b8 08 09 da d8 75 |b.t..NT.I4.....u|
-00000370 0f 49 eb 06 9d f3 f1 29 0d db 58 1c 3e 78 8c f6 |.I.....)..X.>x..|
-00000380 3c 7a 3b b8 d0 14 57 21 96 9f 75 44 d3 5d 3c 24 |.|
+000000c0 d7 b5 0b 9a 9d be d4 ec 03 9d e5 a5 e0 e2 f2 a3 |................|
+000000d0 7f b2 87 ed 09 46 b2 e1 6a e2 39 e9 82 0d fb 62 |.....F..j.9....b|
+000000e0 a4 ef 1e 29 75 96 68 da f9 8d 75 86 df 0c 57 9c |...)u.h...u...W.|
+000000f0 48 e9 3e de 16 ab 22 b2 6d 37 38 d6 33 44 bd 38 |H.>...".m78.3D.8|
+00000100 16 2c 49 1c 2c 17 1a 28 05 45 eb 65 44 4e 1a 02 |.,I.,..(.E.eDN..|
+00000110 fc 2f 5c c9 e8 d8 16 e6 4f 5f f4 bd b4 d7 ec 73 |./\.....O_.....s|
+00000120 2f d1 f5 5b 68 69 b6 6a 59 8e 0b 24 2d 7c 69 96 |/..[hi.jY..$-|i.|
+00000130 a6 99 66 3e 38 25 82 30 ba 1a b5 b9 66 23 ea 60 |..f>8%.0....f#.`|
+00000140 b6 30 5e f5 29 80 8a 75 fc 96 f0 af 3d d2 8e 83 |.0^.)..u....=...|
+00000150 5e 00 fc 76 1c 69 cc 2b e8 d2 70 21 95 65 da 2c |^..v.i.+..p!.e.,|
+00000160 ed c3 fd a4 31 de 00 e5 3a b1 81 38 fc 68 da 0f |....1...:..8.h..|
+00000170 b0 8c 32 f4 67 08 ed 31 0d fc e1 9b 20 8c 79 99 |..2.g..1.... .y.|
+00000180 bd 52 e6 eb 27 04 a5 94 1c e9 a0 5a 18 bf 7b 59 |.R..'......Z..{Y|
+00000190 22 e6 5c 63 84 2f 0a f6 ef b8 c9 c0 cf 82 0d 07 |".\c./..........|
+000001a0 42 66 65 0b d5 5e ea 27 0d f9 de 7e 13 a9 c2 b5 |Bfe..^.'...~....|
+000001b0 ea e2 22 4f a0 13 dc 12 69 9a ec ed d4 44 b2 bc |.."O....i....D..|
+000001c0 88 65 09 ea 50 ca d6 48 c2 f2 12 9e b3 ab 29 c5 |.e..P..H......).|
+000001d0 61 72 3d 0e 77 bd 96 d9 ff 24 4d 7f 4d 22 e0 67 |ar=.w....$M.M".g|
+000001e0 54 02 18 42 e7 78 0c 18 28 89 24 a8 4a a1 cc 70 |T..B.x..(.$.J..p|
+000001f0 a2 a1 4f ee a0 b6 1f 7e cb 9b 20 95 1f 10 63 60 |..O....~.. ...c`|
+00000200 df fe ce 37 9e 9e ce ff fa 49 4f 4c 5b c0 f6 35 |...7.....IOL[..5|
+00000210 b7 eb e1 ac 85 64 11 6e 83 61 6f da d9 e9 09 a6 |.....d.n.ao.....|
+00000220 10 eb c2 da 62 9c ac e0 2e 0a ff 21 2e f7 94 6d |....b......!...m|
+00000230 a6 56 f9 1c 39 52 f3 c7 29 a9 d6 b2 8c a9 4f bf |.V..9R..).....O.|
+00000240 62 c8 74 cb 80 3d 3e 4d d1 25 4c 29 14 21 cd 13 |b.t..=>M.%L).!..|
+00000250 b0 92 5a ca 9b 10 f6 4c 91 6e f7 c3 55 5e 0e f0 |..Z....L.n..U^..|
+00000260 e2 8f 2f 65 f9 b8 c2 43 0c 38 45 86 22 15 ed 8f |../e...C.8E."...|
+00000270 6b 49 ff 45 e5 59 b7 54 f8 c9 d3 b0 f6 71 82 7b |kI.E.Y.T.....q.{|
+00000280 7d 52 be 6c 33 f2 27 5c f8 33 96 05 64 fa b2 b9 |}R.l3.'\.3..d...|
+00000290 ae 74 23 91 46 6f 9b 42 5b 96 1c c4 1c f4 5e b0 |.t#.Fo.B[.....^.|
+000002a0 c7 78 0f f3 da d3 01 ae 25 6c c1 10 31 47 e9 0d |.x......%l..1G..|
+000002b0 84 27 5d 5a 23 35 07 3c 2d ea e8 dc cd d3 c6 85 |.']Z#5.<-.......|
+000002c0 86 ff 48 07 b8 97 d5 c5 10 f4 47 46 af 87 d9 03 |..H.......GF....|
+000002d0 24 3d b0 80 33 46 2a 4d 15 77 5c 21 3c a4 13 99 |$=..3F*M.w\!<...|
+000002e0 6c 9e ce 69 81 2e 90 c9 ba 9a 95 91 30 cc 8d 9b |l..i........0...|
+000002f0 6c 55 c4 09 16 03 03 00 bc 30 d3 15 d7 3b 42 a9 |lU.......0...;B.|
+00000300 9b a2 1f c8 ff 90 43 4c 0f 9c 4e 59 98 23 a2 9e |......CL..NY.#..|
+00000310 17 e0 ea 06 ae 8f 23 e6 85 f9 ca 80 39 34 78 a3 |......#.....94x.|
+00000320 7b 7e 61 88 86 35 e3 8e a3 61 2d f9 24 6e e4 b1 |{~a..5...a-.$n..|
+00000330 c2 7d 56 bc 9d e0 12 3d e5 90 10 b9 39 d5 64 6b |.}V....=....9.dk|
+00000340 a8 91 75 d7 95 e7 e6 ce 8f 11 b0 66 87 f5 48 5d |..u........f..H]|
+00000350 c9 a1 56 b1 71 e9 74 5f 48 a6 06 32 dc 66 7b 0b |..V.q.t_H..2.f{.|
+00000360 85 66 36 e9 d3 13 2d d8 60 8c b2 89 c5 2a de b7 |.f6...-.`....*..|
+00000370 48 63 e0 8e 27 65 3a 01 6f be 75 45 ec 2a 61 c4 |Hc..'e:.o.uE.*a.|
+00000380 a8 0b cf 95 93 a2 d6 27 fa 71 82 92 3a 95 39 a7 |.......'.q..:.9.|
+00000390 fc e5 33 e3 f2 0e a4 94 94 bb e6 65 25 3a 6f 6e |..3........e%:on|
+000003a0 da a0 6d fc 57 2b 46 f8 ab 55 0e 5a 1e 56 92 68 |..m.W+F..U.Z.V.h|
+000003b0 7e 88 f4 d0 b2 16 03 03 00 4a 08 e0 60 21 59 5d |~........J..`!Y]|
+000003c0 29 3e ba b9 1d 13 3a a0 e3 b2 76 39 29 00 92 d0 |)>....:...v9)...|
+000003d0 24 a6 d9 fd e2 2b c8 5d 6b 78 ea 75 ce 68 93 1b |$....+.]kx.u.h..|
+000003e0 3b b8 59 e4 6b 60 5b 4a 28 7a e9 1d 04 72 a8 e0 |;.Y.k`[J(z...r..|
+000003f0 64 31 e4 86 da a9 f2 00 36 55 bd 56 02 d4 b3 48 |d1......6U.V...H|
+00000400 a7 21 69 11 16 03 03 00 14 44 1c 39 61 56 3d 7e |.!i......D.9aV=~|
+00000410 ca dd cb 34 06 10 4f 5f 32 45 63 c1 98 |...4..O_2Ec..|
>>> Flow 9 (client to server)
-00000000 16 03 03 02 69 3a 4c e1 16 19 be 83 57 cf 43 19 |....i:L.....W.C.|
-00000010 c9 1c 20 a3 43 21 4f b7 3f a3 82 1b 20 98 88 e3 |.. .C!O.?... ...|
-00000020 ef 6d d8 3d 7e 1e 80 e7 f3 39 0a 87 e8 cd 90 16 |.m.=~....9......|
-00000030 45 04 c5 0f 4d bf 63 5b 16 50 74 66 8b 3c 27 49 |E...M.c[.Ptf.<'I|
-00000040 54 7f f1 7f f7 b7 fe 1a c4 14 46 5f f7 d5 ab 36 |T.........F_...6|
-00000050 8c 39 09 b9 9e b4 99 3f 4b 90 cc 64 cf 4e c9 a9 |.9.....?K..d.N..|
-00000060 82 7f 7a bc fa 50 3b bf be c3 11 95 cc 88 06 ab |..z..P;.........|
-00000070 1c 1f 95 8a a0 2a a0 6b 61 ee ee 32 06 5e 4b d2 |.....*.ka..2.^K.|
-00000080 d1 ef 70 ef 54 5f 26 0e e3 a4 63 6b 0c 46 f3 91 |..p.T_&...ck.F..|
-00000090 a5 ce a2 69 2a d1 0e 73 04 d2 4a 3e 58 bb ad e8 |...i*..s..J>X...|
-000000a0 38 fc 6c 6f ad 6a 1a 4c 7f 1e f7 04 70 94 4d 62 |8.lo.j.L....p.Mb|
-000000b0 ed 3d ea 1e 36 d0 83 24 43 a1 1a 89 bd f6 18 6a |.=..6..$C......j|
-000000c0 8f 31 40 1a ec 8e 18 1e db 60 fc 76 e3 5b 20 8b |.1@......`.v.[ .|
-000000d0 ef 61 bb 49 e2 5b 60 fe 9f 9e 22 d1 3d 1f ac 2d |.a.I.[`...".=..-|
-000000e0 11 91 ed 38 6f f1 25 ef 6d 3a 49 52 7f 2f f1 b1 |...8o.%.m:IR./..|
-000000f0 f6 68 df aa 9c 3e 60 a7 cc 19 35 65 04 5d 7f 37 |.h...>`...5e.].7|
-00000100 86 10 14 01 17 38 1e 91 ab 3c 20 3a 13 2d ea cc |.....8...< :.-..|
-00000110 be 79 54 76 32 e7 b2 0d e9 f7 50 66 94 02 7d c6 |.yTv2.....Pf..}.|
-00000120 4b 02 34 92 12 93 18 56 6b a4 61 4f 5b 6f 8f 7c |K.4....Vk.aO[o.||
-00000130 fc 80 5b cb 3e ac df b1 2d c3 85 9e 55 9b 15 22 |..[.>...-...U.."|
-00000140 46 54 e4 5c 23 35 20 05 e1 b8 89 44 57 4f dd ef |FT.\#5 ....DWO..|
-00000150 d8 33 36 c9 d8 d6 e0 71 61 a7 e9 ff 2a cf 7c a2 |.36....qa...*.|.|
-00000160 f8 e0 78 57 d2 21 d8 07 8c 51 4b 16 83 f9 49 5a |..xW.!...QK...IZ|
-00000170 86 ae 68 d2 b3 d3 06 42 c8 56 a5 77 56 4f 3a e8 |..h....B.V.wVO:.|
-00000180 3f ab de 12 82 1f 87 11 ef c3 fa b9 20 0b e1 e0 |?........... ...|
-00000190 1d bd 96 3e e9 f5 a4 96 79 e5 1e 3e 7e 6e cb b3 |...>....y..>~n..|
-000001a0 08 f8 ea 85 ca a2 bb a2 ef ca 8f c2 31 9a a8 56 |............1..V|
-000001b0 b1 d3 a6 dd 63 0c 1d ad ae 69 da b2 11 77 fe 81 |....c....i...w..|
-000001c0 c1 37 34 ed 9a 3c fe 09 3a 3b 6d cd d3 45 63 cb |.74..<..:;m..Ec.|
-000001d0 99 cc d9 88 95 0a fe 58 47 9a 14 a2 16 c0 e1 96 |.......XG.......|
-000001e0 5e 4f 8f fa a4 d5 2c c6 43 aa 94 1f 1b 90 5d 03 |^O....,.C.....].|
-000001f0 18 f3 2a f3 a3 14 44 0b df 51 8b 66 8f dd 7f 65 |..*...D..Q.f...e|
-00000200 c6 ee 9a 60 8b b9 af ab 26 9e 5f 6a c8 dc 66 d1 |...`....&._j..f.|
-00000210 d1 58 26 9c 58 86 2d fb 98 cd 70 c5 db 37 db b2 |.X&.X.-...p..7..|
-00000220 22 bb 00 fe f4 87 68 58 22 f3 15 24 ed 89 fe db |".....hX"..$....|
-00000230 dd 52 e5 3f 4f 90 ab fd 4b e4 e4 70 35 d3 28 72 |.R.?O...K..p5.(r|
-00000240 05 08 af fb 7c ba 63 3f c1 a0 32 48 00 6a 6f 6c |....|.c?..2H.jol|
-00000250 77 a1 c9 0e 23 e2 7d 6a 9b 9a 04 4e fb 6e db 53 |w...#.}j...N.n.S|
-00000260 ba 5a c1 79 ee 13 2c 8b dd 79 5d 5b 0e b1 16 03 |.Z.y..,..y][....|
-00000270 03 00 35 a4 5c 1d bc be f0 32 77 49 96 7e 92 b7 |..5.\....2wI.~..|
-00000280 74 d9 96 8c 86 c8 06 e6 08 6e 20 47 14 2d 9e 98 |t........n G.-..|
-00000290 ab 28 fa 26 a6 48 d4 1a 06 41 34 74 15 bd 54 bb |.(.&.H...A4t..T.|
-000002a0 7d fc 30 10 a9 12 3a 6d 16 03 03 00 98 9d 61 7e |}.0...:m......a~|
-000002b0 6a 9e 2a 7f 9c ff 25 6b 0d 01 1b 34 ad 00 d1 b5 |j.*...%k...4....|
-000002c0 0b 5f 0c d3 43 ca aa 61 e9 44 a7 e5 18 0d 85 87 |._..C..a.D......|
-000002d0 5f 96 7a 80 ac 56 20 19 1d 62 39 84 9e e1 a4 62 |_.z..V ..b9....b|
-000002e0 a1 bf c3 b3 9d da 1b a5 39 cb 58 2f 28 fb 57 5b |........9.X/(.W[|
-000002f0 94 d0 49 67 f3 c0 c1 83 5b 92 04 f9 1a 6a 3b 7e |..Ig....[....j;~|
-00000300 c8 51 d5 fb ab c3 45 44 f1 6a 07 b5 09 94 f3 4c |.Q....ED.j.....L|
-00000310 55 27 12 3d fc 07 b3 e0 dd f5 df e9 00 f1 cb 42 |U'.=...........B|
-00000320 e0 f7 55 51 43 f6 7e 1b 62 83 e5 71 75 8e e2 1a |..UQC.~.b..qu...|
-00000330 e0 b6 00 48 44 cf 33 fd 72 7e 91 dc d4 b9 9d cc |...HD.3.r~......|
-00000340 29 9e e2 97 a8 14 03 03 00 11 53 e5 86 22 41 e7 |).........S.."A.|
-00000350 f0 ad 61 5c 0b d9 b5 b2 15 0f 0a 16 03 03 00 20 |..a\........... |
-00000360 d3 d8 b8 47 4a 73 3c b3 41 e3 0b a7 51 67 ca ba |...GJs<.A...Qg..|
-00000370 57 9b 38 07 2a 76 06 2c b3 24 6a 82 cf bf da 37 |W.8.*v.,.$j....7|
+00000000 16 03 03 02 69 68 d9 de 2a 4d 03 fe 05 cc b8 d3 |....ih..*M......|
+00000010 c8 f0 3d df 1c 73 f1 bd 55 08 45 c4 2a 6b a1 c8 |..=..s..U.E.*k..|
+00000020 35 7d 56 b7 b9 15 63 ba 09 31 59 8b f8 ce a0 f8 |5}V...c..1Y.....|
+00000030 1b 3b 5f 5e 1c 3d bb 26 43 cb 7b f3 ba 3b a2 38 |.;_^.=.&C.{..;.8|
+00000040 a3 d5 bd 0b 65 16 7c e3 79 cc ed 17 04 34 60 e7 |....e.|.y....4`.|
+00000050 1e 60 52 72 13 e4 6b ef 32 99 86 94 49 30 47 df |.`Rr..k.2...I0G.|
+00000060 e2 6c 6d 3f 6c 19 e4 4e b9 df 42 e3 c8 47 2c d0 |.lm?l..N..B..G,.|
+00000070 be 2c 94 3b 1d 3e 3a b3 06 67 c3 25 9b 24 4e 8e |.,.;.>:..g.%.$N.|
+00000080 dc c7 50 ab 72 bd b4 d1 ff f7 3f 6d 13 89 55 8c |..P.r.....?m..U.|
+00000090 14 a1 ae fe ad a0 bb 8f fe 51 ac 5b eb 23 3d d0 |.........Q.[.#=.|
+000000a0 9e b8 5e 34 8c dd 47 79 9c 73 f5 6b 47 ff 10 7d |..^4..Gy.s.kG..}|
+000000b0 ac 1d a7 54 5e b5 0f 75 86 67 13 70 d5 66 da 55 |...T^..u.g.p.f.U|
+000000c0 0b 48 a0 88 ae f9 81 92 33 0b 29 79 42 f7 c2 98 |.H......3.)yB...|
+000000d0 2c 2f 32 c7 df 35 ff 4a 44 10 fa 9f 66 ce 4b 9a |,/2..5.JD...f.K.|
+000000e0 3c 5b b3 7d ac 3b 9a 68 bb 40 3d 36 6b 72 98 c5 |<[.}.;.h.@=6kr..|
+000000f0 85 3c b0 75 1c d6 45 0f f9 4d 26 2d ec 67 90 ed |.<.u..E..M&-.g..|
+00000100 88 33 92 7d 99 22 c4 08 90 64 17 1e 06 03 d5 a3 |.3.}."...d......|
+00000110 72 a6 92 99 d3 c8 46 9f e7 f9 15 bb dd ba e5 f7 |r.....F.........|
+00000120 d9 06 af 5c 1c a0 03 c7 fe 51 b5 41 0c 8f 6d ad |...\.....Q.A..m.|
+00000130 f2 41 23 a5 44 38 8a bb b3 d9 3c e8 5e 99 98 23 |.A#.D8....<.^..#|
+00000140 9c 87 3d f8 10 df 58 c2 dd b9 2c 7e 56 a1 75 84 |..=...X...,~V.u.|
+00000150 a2 e5 66 20 58 ed fe f7 04 ff 93 e0 6e 9f 1e f3 |..f X.......n...|
+00000160 a9 8a 9a 37 38 d2 7c 4d 74 88 f5 bd 2b 5a 05 bc |...78.|Mt...+Z..|
+00000170 53 a1 48 ab 98 ca 91 bb fa f3 62 a9 0a fa 89 e6 |S.H.......b.....|
+00000180 22 06 1d 59 72 32 51 d6 f6 de e8 89 b6 eb 96 f2 |"..Yr2Q.........|
+00000190 4d e0 82 0d b8 ec a7 09 84 79 18 70 3e 09 ba 9a |M........y.p>...|
+000001a0 98 27 13 e8 e6 e5 9d 7c df 4d 42 a8 41 be 62 e0 |.'.....|.MB.A.b.|
+000001b0 1d 48 24 5d 35 e5 a5 ff f5 67 85 cf b8 53 e1 5e |.H$]5....g...S.^|
+000001c0 dd 82 40 9e d3 94 fd 7b 1b b3 13 d8 98 a8 1f 21 |..@....{.......!|
+000001d0 1a 04 5a df 3c 8f 3a c0 dc 86 8b e1 39 0a 03 8e |..Z.<.:.....9...|
+000001e0 8c 9a 4c d5 15 32 2d 1c 0f ad 43 25 e6 5a 77 f9 |..L..2-...C%.Zw.|
+000001f0 2d e5 a0 a0 b2 32 43 0f 11 55 bb c2 e1 c6 45 2a |-....2C..U....E*|
+00000200 da a0 6c 14 49 0f a7 d7 40 b1 1a c8 72 2a a8 26 |..l.I...@...r*.&|
+00000210 45 f4 66 9a e0 42 aa 25 ac 28 ec 8c a2 df 48 cc |E.f..B.%.(....H.|
+00000220 c3 a9 9e 9e af 38 88 82 43 8f 99 02 79 90 3e d9 |.....8..C...y.>.|
+00000230 9e d0 75 a5 95 83 ec 44 2b 13 1c d8 eb 3f 2c 5d |..u....D+....?,]|
+00000240 1b 7e e2 fe 47 89 08 5b 58 dc 3d ea 32 5e a1 af |.~..G..[X.=.2^..|
+00000250 c5 e8 90 b8 28 4b 58 55 34 46 ef 2a d6 a0 9b 0b |....(KXU4F.*....|
+00000260 73 b9 8b b4 38 63 08 92 03 4c 8c 12 be a8 16 03 |s...8c...L......|
+00000270 03 00 35 f5 3c 22 cc bc cf c3 ad 84 1d dc f4 b6 |..5.<"..........|
+00000280 e0 4a 1c b9 e5 d8 a6 b7 a2 8c fb 40 11 12 40 5c |.J.........@..@\|
+00000290 e2 f4 ce ac 83 93 69 71 19 85 43 19 9e 30 ee 97 |......iq..C..0..|
+000002a0 02 8e 69 8f 4d 1d 2c 0f 16 03 03 00 98 94 e4 82 |..i.M.,.........|
+000002b0 1d 6b d2 ce 76 6d 68 55 db bb 91 73 6e e9 73 05 |.k..vmhU...sn.s.|
+000002c0 6a d3 eb 48 f1 d7 f6 52 ba 49 6a f2 f7 74 c8 56 |j..H...R.Ij..t.V|
+000002d0 ba f5 e5 97 cb a0 b7 ab 37 2c ff 7a a6 42 e6 78 |........7,.z.B.x|
+000002e0 51 8a 9c bf fa 05 b7 66 04 6d 83 d1 0d e8 18 d0 |Q......f.m......|
+000002f0 f2 b3 4d 4d 2d c0 f7 ac d1 55 b8 03 d7 dc d7 c2 |..MM-....U......|
+00000300 73 72 54 c9 29 e4 98 29 a3 95 11 7e 56 52 87 09 |srT.)..)...~VR..|
+00000310 05 fe 74 e2 f1 74 c7 f6 f2 28 4f 2c 24 92 ac ae |..t..t...(O,$...|
+00000320 1c df 4e f9 db ce 3c db 48 60 6b 4d 12 9c f7 de |..N...<.H`kM....|
+00000330 26 73 25 d2 e7 d1 2e fd b5 5e c4 66 2a 60 4a 04 |&s%......^.f*`J.|
+00000340 2d b9 6c b1 d2 14 03 03 00 11 58 08 81 e4 4d c4 |-.l.......X...M.|
+00000350 93 47 e2 45 e2 44 73 36 3a fe ba 16 03 03 00 20 |.G.E.Ds6:...... |
+00000360 25 2d 76 2c 22 34 e9 ed 11 a5 84 ee d3 63 df 17 |%-v,"4.......c..|
+00000370 88 be 86 7c 51 35 fb 7e aa a6 b9 a2 02 59 f7 00 |...|Q5.~.....Y..|
>>> Flow 10 (server to client)
-00000000 14 03 03 00 11 9a a1 96 36 69 58 ba 18 5d ee 45 |........6iX..].E|
-00000010 66 02 f4 3b f8 ba 16 03 03 00 20 cf 43 d1 45 30 |f..;...... .C.E0|
-00000020 cf b9 99 27 36 a9 a1 0b 2d ab ab 14 c1 ec 97 f9 |...'6...-.......|
-00000030 e5 01 c9 81 eb f9 78 5b 82 44 05 17 03 03 00 19 |......x[.D......|
-00000040 5f c9 75 6f 23 fe 04 a6 e8 34 5f eb fb fd fd 3c |_.uo#....4_....<|
-00000050 f6 c6 8e 64 3a 8d 35 92 d8 16 03 03 00 14 90 95 |...d:.5.........|
-00000060 39 68 e7 49 6e f6 58 7c bd 14 76 f1 a5 fe 83 21 |9h.In.X|..v....!|
-00000070 b3 67 |.g|
+00000000 14 03 03 00 11 bb 91 ed b9 75 be 6c 2c b8 7c 57 |.........u.l,.|W|
+00000010 0b 44 2e 6d 68 4a 16 03 03 00 20 49 17 51 ce 23 |.D.mhJ.... I.Q.#|
+00000020 ff 71 ad f5 45 75 01 43 4d d2 f8 08 d8 e5 4d d7 |.q..Eu.CM.....M.|
+00000030 1c 35 5e 8b 18 54 e5 f6 0c b5 2e 17 03 03 00 19 |.5^..T..........|
+00000040 ec 43 1a 6d 9e fb 53 cd 55 1a 72 2e da d1 ea 58 |.C.m..S.U.r....X|
+00000050 66 17 a9 1c be fc d9 72 dd 16 03 03 00 14 c2 98 |f......r........|
+00000060 a4 ac d5 0c a2 10 61 8b 55 3a 69 b6 26 33 4f fe |......a.U:i.&3O.|
+00000070 2d 42 |-B|
>>> Flow 11 (client to server)
-00000000 15 03 03 00 12 18 02 52 db f2 60 de 38 62 3a 06 |.......R..`.8b:.|
-00000010 7b 6d 84 74 cf ae d5 15 03 03 00 12 fd 06 4d b1 |{m.t..........M.|
-00000020 f8 71 8c b8 13 cc 9e 40 be 76 96 60 54 b7 |.q.....@.v.`T.|
+00000000 15 03 03 00 12 d4 c8 e4 36 30 00 40 d1 d5 9a 9d |........60.@....|
+00000010 3c 2d eb 4f e0 6e a3 15 03 03 00 12 4d b6 67 e4 |<-.O.n......M.g.|
+00000020 02 d0 89 50 ef 4b 8a 1f 49 f2 f0 14 b6 7e |...P.K..I....~|
diff --git a/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-RSAPSS b/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-RSAPSS
index e44b5a3848..9488dd6b66 100644
--- a/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-RSAPSS
+++ b/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-RSAPSS
@@ -16,121 +16,128 @@
000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0|
000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t|
>>> Flow 2 (server to client)
-00000000 16 03 03 00 7a 02 00 00 76 03 03 e9 53 0e 37 17 |....z...v...S.7.|
-00000010 22 a6 ae 2f 8b 85 d4 fe 3b e1 2d 22 d1 69 3c 4b |"../....;.-".iY|
-00000220 b7 40 13 8e a4 dd 16 57 d1 8e 2b e3 40 57 eb b0 |.@.....W..+.@W..|
-00000230 10 03 43 4a 30 0c e7 7f df 33 66 40 13 c7 7c ca |..CJ0....3f@..|.|
-00000240 fc 71 e4 75 8d 78 09 05 70 34 80 a9 27 6a a1 1b |.q.u.x..p4..'j..|
-00000250 6d 7e a1 60 81 70 52 c2 1b f6 f3 f0 92 3c 50 45 |m~.`.pR.......U...i.B.|
-00000410 d3 38 62 a5 95 e2 a4 35 03 43 04 c7 6e |.8b....5.C..n|
+00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 ba |..+.....3.$... .|
+00000060 2a 76 cb fb 6c 6b bb 30 fb ef 87 6f e5 06 5c 6f |*v..lk.0...o..\o|
+00000070 78 a7 44 41 93 c0 33 89 be 32 8c 0f fa 5c 43 14 |x.DA..3..2...\C.|
+00000080 03 03 00 01 01 17 03 03 00 17 ac 3e 8a 31 22 16 |...........>.1".|
+00000090 d3 69 bf 1d b5 2e 18 23 b3 21 00 17 23 a4 3f 9a |.i.....#.!..#.?.|
+000000a0 0b 17 03 03 00 20 aa f0 51 64 b5 44 f0 28 ab 56 |..... ..Qd.D.(.V|
+000000b0 da 34 2d 62 77 4d 88 07 b6 82 ad 64 df e6 59 c9 |.4-bwM.....d..Y.|
+000000c0 91 e5 f8 f2 67 88 17 03 03 02 7a cf 2d 71 db 3f |....g.....z.-q.?|
+000000d0 05 45 b8 68 18 1c b9 66 b6 00 f8 dc 9d ae e5 d2 |.E.h...f........|
+000000e0 a3 a8 02 5f ac e4 95 a6 fc 96 78 7b fd 0a 21 62 |..._......x{..!b|
+000000f0 ff 7c 15 2c fb f1 21 15 1e 8d 9e f9 71 62 43 e4 |.|.,..!.....qbC.|
+00000100 c9 69 e4 fe 87 f0 9d 9e aa a4 5c d8 4e ae 3c 38 |.i........\.N.<8|
+00000110 e5 76 21 7b 03 a8 70 6f e8 96 39 34 e7 3c b9 51 |.v!{..po..94.<.Q|
+00000120 b4 ef ce 7d 0b 1e 57 7d 62 de 47 6a 0a b0 97 6d |...}..W}b.Gj...m|
+00000130 49 fe ae 6f c9 d6 e4 4a 54 60 3d 55 53 06 aa 28 |I..o...JT`=US..(|
+00000140 7a 3e 7b e0 d1 8a 60 45 87 81 bf fc 98 13 1e de |z>{...`E........|
+00000150 7a 90 73 81 13 91 3a c4 da 71 74 e0 1d d5 30 55 |z.s...:..qt...0U|
+00000160 46 6a 48 c2 0c 18 91 a3 79 8e c2 b9 5b 24 88 76 |FjH.....y...[$.v|
+00000170 5f e6 8f 24 91 95 5b 0d 38 39 5b a4 f6 0e 1a b8 |_..$..[.89[.....|
+00000180 e8 2b 0d ac a8 56 10 23 54 a5 78 c9 2a cb ed 24 |.+...V.#T.x.*..$|
+00000190 58 16 1a 2f 1c b7 72 fc da ab 56 f6 27 d1 98 39 |X../..r...V.'..9|
+000001a0 1f f9 dd e0 1f 1f 23 1a ff 6b af e1 17 9d ec 35 |......#..k.....5|
+000001b0 de 0b 4d a4 46 5a fd 07 56 ce 72 19 76 dc 0c 06 |..M.FZ..V.r.v...|
+000001c0 99 38 ce 58 3b 9f 13 9a d5 b7 d6 08 a6 05 4d e1 |.8.X;.........M.|
+000001d0 75 da 59 4d ab d9 28 e8 af c4 50 f0 b1 49 f8 fd |u.YM..(...P..I..|
+000001e0 c9 11 b8 01 70 bb 49 e2 0f 26 1b cb ee c2 7b bd |....p.I..&....{.|
+000001f0 2f 72 78 be a1 67 1d 0c d0 bb 4e e7 40 b3 bd 8c |/rx..g....N.@...|
+00000200 e2 f4 4f b2 c5 4c 82 49 51 00 44 17 c6 82 72 f5 |..O..L.IQ.D...r.|
+00000210 cd 55 c1 43 28 52 85 2b 5d 91 33 9c 15 34 6e ae |.U.C(R.+].3..4n.|
+00000220 77 4e 08 0c 9c d2 ae 7f e8 83 af 60 96 10 ae dc |wN.........`....|
+00000230 58 6a 3b ae 15 e5 9c a8 25 f3 69 71 f7 94 9c 75 |Xj;.....%.iq...u|
+00000240 e0 b5 05 16 ae ce f4 23 20 30 aa 74 a3 63 68 76 |.......# 0.t.chv|
+00000250 f6 ec 64 e1 3d f6 0e b6 c4 7d a8 08 44 a9 96 1d |..d.=....}..D...|
+00000260 7d c8 22 a8 df 04 2c ad 65 f1 4c 99 7d a1 cb bd |}."...,.e.L.}...|
+00000270 b7 d4 d7 b5 ee 88 bd 15 2e 75 76 e2 72 bb 7d e6 |.........uv.r.}.|
+00000280 5b eb fc f7 96 96 f0 3c aa b6 a8 58 92 e9 29 f6 |[......<...X..).|
+00000290 40 bf 8e 14 23 7c 45 da e9 17 4b 32 16 11 ec 74 |@...#|E...K2...t|
+000002a0 78 d5 8c 5a 06 46 e4 dc 90 b9 44 8e d6 8a 4e 43 |x..Z.F....D...NC|
+000002b0 7f f9 60 9e a1 46 fa 16 88 ab 3c f1 1e d0 2e 00 |..`..F....<.....|
+000002c0 5d 01 e6 a7 b1 27 f7 40 26 17 f3 da fb cd 06 d1 |]....'.@&.......|
+000002d0 4e 27 75 9a 6f 0b 63 82 9c 40 07 4c 6e 0d d8 4b |N'u.o.c..@.Ln..K|
+000002e0 f1 e6 d5 1c 41 55 72 b5 43 24 53 1e 0e a4 08 d7 |....AUr.C$S.....|
+000002f0 44 93 00 c9 8b 49 ba 7a 32 0c d8 e6 46 87 5d 62 |D....I.z2...F.]b|
+00000300 9d 4a 11 04 67 21 19 42 50 ad ad ab dd 62 0f f7 |.J..g!.BP....b..|
+00000310 0f 57 78 82 71 f6 09 9f 41 bc 8e 34 24 7c b5 d2 |.Wx.q...A..4$|..|
+00000320 5d 0c 18 fb d8 f6 62 dc 57 6a 78 2c 21 35 d8 eb |].....b.Wjx,!5..|
+00000330 bb f8 7e 01 63 50 c1 98 88 a4 b5 63 1e c0 68 3c |..~.cP.....c..h<|
+00000340 41 3c b8 6e 48 17 03 03 00 99 b6 09 37 a6 c2 d9 |A<.nH.......7...|
+00000350 5f 39 69 e1 0b ca 40 d8 31 5b 4b 4f c1 33 bf 1f |_9i...@.1[KO.3..|
+00000360 db c2 8c 9c d2 14 26 96 4e aa b2 63 30 40 fa 49 |......&.N..c0@.I|
+00000370 fb 2d 66 59 70 cb c7 f8 fe 59 19 8b eb d5 5c 6c |.-fYp....Y....\l|
+00000380 5c a0 c9 ba e6 4d d9 c3 e0 fe 00 c4 fb ab 8a f1 |\....M..........|
+00000390 2b ab 53 86 a7 86 57 01 b8 ae c4 a6 12 6b 7d f8 |+.S...W......k}.|
+000003a0 ea 2d df 37 04 01 eb 14 f4 9a d0 e7 67 46 ec 9f |.-.7........gF..|
+000003b0 35 f8 d4 2e c6 95 91 10 0e dc 01 60 9a d6 f8 d8 |5..........`....|
+000003c0 9e c1 fd f8 2e e2 51 8a e9 2f c3 4a 4f 01 31 52 |......Q../.JO.1R|
+000003d0 af cb 4b 52 96 4c 90 57 83 1f 11 97 d6 d6 16 74 |..KR.L.W.......t|
+000003e0 77 f8 c4 17 03 03 00 35 b0 61 57 8f 52 7e 93 b1 |w......5.aW.R~..|
+000003f0 f0 90 a1 23 09 6e 11 ff a5 6c 38 f3 31 11 be 03 |...#.n...l8.1...|
+00000400 ad 59 65 57 1b 60 2b fc 41 98 e0 79 6d 14 26 c8 |.YeW.`+.A..ym.&.|
+00000410 fb d6 5f 00 e0 cc 70 46 a3 81 e4 3c ff |.._...pF...<.|
>>> Flow 3 (client to server)
-00000000 14 03 03 00 01 01 17 03 03 02 11 ee 25 34 95 80 |............%4..|
-00000010 b9 4f 23 e2 2b ed 34 ad c8 35 e2 d1 4d 99 e1 15 |.O#.+.4..5..M...|
-00000020 5a 9a 39 79 80 1e ec 0d 24 3b 07 d8 9d e6 0c 82 |Z.9y....$;......|
-00000030 5b 42 f3 37 66 6d 41 8a 0f f8 7c 53 8d 5d 5a c2 |[B.7fmA...|S.]Z.|
-00000040 9e 7f 5e 54 1c 36 85 64 fe f3 4f b3 36 92 f1 fd |..^T.6.d..O.6...|
-00000050 08 73 22 7a 20 37 f9 d1 1e 16 21 7e ea 4f 6a cb |.s"z 7....!~.Oj.|
-00000060 89 19 13 4b 1a 50 49 a9 fe a6 eb 12 ac 0e 78 dc |...K.PI.......x.|
-00000070 b8 02 d4 35 0d 2f 46 f2 97 74 2c f9 61 eb 03 f4 |...5./F..t,.a...|
-00000080 4e f7 98 69 46 ff 78 e1 9f e9 89 27 8e 83 b3 2f |N..iF.x....'.../|
-00000090 ff 24 26 41 ad 6a dd 71 d9 b9 05 56 ea 73 d8 e9 |.$&A.j.q...V.s..|
-000000a0 11 fb 0f 64 b6 c0 57 90 6b 5b e7 7c 8d a2 40 b2 |...d..W.k[.|..@.|
-000000b0 8a 18 87 1a ec 45 cc 68 df 89 c6 93 32 2f de 7a |.....E.h....2/.z|
-000000c0 72 ce ae 75 bb a8 37 f9 8d 75 87 e4 12 6a 59 ad |r..u..7..u...jY.|
-000000d0 a8 3b 26 27 ab c4 1e e2 ba 42 11 6a f2 ba eb 9b |.;&'.....B.j....|
-000000e0 3b 93 c5 9a 3d e2 20 28 92 35 60 86 27 95 c5 4a |;...=. (.5`.'..J|
-000000f0 e3 4d b2 35 6d 64 2f 08 7d d8 c0 c5 ef 3f e0 24 |.M.5md/.}....?.$|
-00000100 64 37 d7 a6 13 6d ee ee 7f dc b8 80 5d 95 d3 84 |d7...m......]...|
-00000110 8a 4a 30 59 d9 9f 23 0f c4 ab d7 6b cc 26 2c 4b |.J0Y..#....k.&,K|
-00000120 b8 7f f1 f3 eb d6 10 c5 50 22 a3 45 2d 20 a4 39 |........P".E- .9|
-00000130 99 d7 1b ae 12 83 bf 75 52 56 f1 17 ee 1c e4 4f |.......uRV.....O|
-00000140 ef b5 c2 cb 64 28 48 7a 69 d6 18 33 83 e2 70 ed |....d(Hzi..3..p.|
-00000150 65 36 6c 4d 91 1f 61 88 d4 55 3a 09 cf d6 45 88 |e6lM..a..U:...E.|
-00000160 82 69 ce bd 63 63 3e 43 68 6b b9 6e ed 2d 4f 13 |.i..cc>Chk.n.-O.|
-00000170 89 3d d3 f4 05 19 b4 35 b1 33 84 d9 71 cc 7f 03 |.=.....5.3..q...|
-00000180 2a 77 32 be c3 ab 2d db aa c7 99 b0 a0 29 a7 d7 |*w2...-......)..|
-00000190 9c f6 84 8d 4f 99 79 c0 52 2b 2a f1 a8 f1 85 bc |....O.y.R+*.....|
-000001a0 b3 5f 3f de b8 df e2 e0 ac f4 f1 11 c4 c5 c5 45 |._?............E|
-000001b0 24 19 0c 8f fd ca e2 80 f8 91 2d 1c cc 5e c8 8b |$.........-..^..|
-000001c0 c1 49 96 d5 3e 17 e3 cd a0 38 8d aa 20 d2 12 81 |.I..>....8.. ...|
-000001d0 ff 11 a8 e6 93 77 34 a5 ab 40 a2 75 01 f8 c5 f3 |.....w4..@.u....|
-000001e0 0d e0 cc 7b b8 d1 0f d6 0d 34 a1 58 67 47 8e 47 |...{.....4.XgG.G|
-000001f0 45 89 74 de 77 3c 65 d2 5e 60 35 a1 a7 85 0a 82 |E.t.w].....D...B....|
-00000310 17 03 03 00 13 ee 2f 0d a2 33 1f 9a ca 26 43 e8 |....../..3...&C.|
-00000320 8b 1d 41 0d 11 c9 2d 8a |..A...-.|
+00000000 14 03 03 00 01 01 17 03 03 02 7a 22 a3 3d 18 f8 |..........z".=..|
+00000010 a2 c7 8e 62 c3 07 99 b4 e6 bd 94 79 12 82 e9 e0 |...b.......y....|
+00000020 96 ff 5f c3 ec 34 02 2f 8d 95 2f 40 80 99 19 a3 |.._..4./../@....|
+00000030 bd 64 fd e4 0e b3 81 ad 4c 2e d9 72 d2 a3 bd 00 |.d......L..r....|
+00000040 81 42 78 5d f3 70 c3 78 0b fa cd b8 96 17 5e e7 |.Bx].p.x......^.|
+00000050 6e 03 b8 c6 ab 2b 2e 63 45 c7 b1 c9 98 71 c9 1d |n....+.cE....q..|
+00000060 bb 7b 6e 6d c7 d5 90 b8 b2 4e 62 1a 8f cf 7d 99 |.{nm.....Nb...}.|
+00000070 52 3d 70 40 0f 0f 96 1c ee a7 ff 29 2a 53 de d4 |R=p@.......)*S..|
+00000080 34 f9 d9 b2 33 2c 69 5e 2d f2 a7 62 dd ec 77 b1 |4...3,i^-..b..w.|
+00000090 6c 0f 61 86 8a bc 11 1f 91 ad f4 94 de 96 dd ef |l.a.............|
+000000a0 d8 be 5e 45 50 fe af 1a 03 54 20 f6 05 8e a3 b0 |..^EP....T .....|
+000000b0 f7 31 93 f3 78 59 4d 54 50 99 a5 a1 53 81 1b 5d |.1..xYMTP...S..]|
+000000c0 6d ea 32 e9 52 ab 83 d6 18 3f 2f 43 cd 64 ac 3f |m.2.R....?/C.d.?|
+000000d0 11 6c 91 0d fa 86 f8 a5 12 eb 41 ac 24 2d 79 5b |.l........A.$-y[|
+000000e0 ee 8e 02 46 f0 37 0a b1 19 c7 97 ed 97 d1 11 18 |...F.7..........|
+000000f0 df 80 8f f3 d7 61 a4 fe 6c ec b0 80 4e bc e4 52 |.....a..l...N..R|
+00000100 10 2f b1 6f 3f d4 39 08 81 f6 01 4b b4 d4 d5 20 |./.o?.9....K... |
+00000110 6b a1 be e6 cf c7 0e 95 e9 d7 00 07 63 25 1b 64 |k...........c%.d|
+00000120 4b b7 c4 79 29 84 45 45 5d 0d fe 72 2a 7e c6 bf |K..y).EE]..r*~..|
+00000130 5a 98 ec e2 16 26 82 57 eb a6 dc ff 73 b6 e8 4c |Z....&.W....s..L|
+00000140 87 52 e5 0a c1 6a 6f 02 69 17 17 ea e0 1c c1 07 |.R...jo.i.......|
+00000150 b4 f4 78 a7 99 39 8b 63 61 c2 7e 99 f4 64 16 d6 |..x..9.ca.~..d..|
+00000160 0a 84 9a 0f d4 f4 bd 4d d4 4f 16 ec 19 30 a7 34 |.......M.O...0.4|
+00000170 f9 b9 60 10 39 25 ee 9d bd 99 37 52 e6 32 a1 c9 |..`.9%....7R.2..|
+00000180 68 9b a2 4e 16 91 0e 54 54 d5 c5 77 bb 01 ba af |h..N...TT..w....|
+00000190 97 be ea 09 85 91 69 84 4f 2c 04 f0 38 50 93 49 |......i.O,..8P.I|
+000001a0 e7 41 cb c1 d6 b6 77 59 09 7c 1e 0a 58 93 1e b4 |.A....wY.|..X...|
+000001b0 cf ed 32 85 b0 cd 6f 86 c7 94 8c 30 9d 83 a2 a0 |..2...o....0....|
+000001c0 4a de ad 8c b9 d8 58 d3 8c 34 6b 12 54 f1 28 66 |J.....X..4k.T.(f|
+000001d0 ea 55 d9 95 d0 b6 b3 aa 68 c3 31 e1 8f 1b f8 43 |.U......h.1....C|
+000001e0 51 b9 06 fc 53 69 9b 1c e6 2c f8 b7 f0 47 4a 5a |Q...Si...,...GJZ|
+000001f0 82 ca 27 df 0f 3d f8 79 90 8d c2 bd 27 85 74 6b |..'..=.y....'.tk|
+00000200 9e 8b eb 74 a8 28 ba 6a 25 16 01 2c 56 3b c0 fa |...t.(.j%..,V;..|
+00000210 91 ac af a7 c5 39 8d 2c b1 f3 a2 c9 a5 72 c6 ff |.....9.,.....r..|
+00000220 49 a0 78 14 5c 8c d2 71 de b9 4f 55 3a ca b6 a5 |I.x.\..q..OU:...|
+00000230 df ce bb f7 c2 d5 af 2c c0 97 08 82 cc b4 02 26 |.......,.......&|
+00000240 c3 0c 99 39 4a df 6c d6 59 14 c4 d6 04 9d a4 92 |...9J.l.Y.......|
+00000250 d2 53 42 16 56 99 5f c2 82 a0 a8 5a 92 53 e6 b1 |.SB.V._....Z.S..|
+00000260 cd fc bc 9a b9 55 0b ae 2c 50 ce a3 bf d2 7d d2 |.....U..,P....}.|
+00000270 2b 58 ba 87 65 33 09 cf 74 51 0f 4b 4f a9 53 0d |+X..e3..tQ.KO.S.|
+00000280 fa 60 1e ba e6 17 03 03 00 99 aa 43 d9 e2 e4 91 |.`.........C....|
+00000290 cf 65 fa 35 0e b0 21 51 9d c4 33 f5 7c 09 ff e5 |.e.5..!Q..3.|...|
+000002a0 db fd 6e 96 6d 13 7c 4c ec 90 72 bd 54 6a 3f d8 |..n.m.|L..r.Tj?.|
+000002b0 1a a3 e2 a2 01 6b d6 50 a0 b1 d5 67 34 44 42 30 |.....k.P...g4DB0|
+000002c0 97 2e 82 07 46 04 56 0a 43 4b 9d 8c 81 64 bb 0b |....F.V.CK...d..|
+000002d0 21 62 ea 23 0b 1c a0 c4 b2 cc 2f 51 b5 a2 9a a3 |!b.#....../Q....|
+000002e0 37 d3 0c 57 80 85 77 3b 8d 17 f1 a9 d5 ae 72 f9 |7..W..w;......r.|
+000002f0 cd 8c c4 2c fb c7 e0 f0 3a 5c d5 6a f7 8f 7e 53 |...,....:\.j..~S|
+00000300 c1 d0 7a b0 8d c9 b3 17 7c 99 df 54 d6 43 13 d5 |..z.....|..T.C..|
+00000310 78 9c 34 7e c9 11 4e e7 1c 8c f4 0f 82 89 94 61 |x.4~..N........a|
+00000320 80 d2 49 17 03 03 00 35 aa cd 97 5a a2 d3 27 78 |..I....5...Z..'x|
+00000330 d4 79 28 a7 57 dc 4f b1 2d b8 bd 3c ae ec e6 be |.y(.W.O.-..<....|
+00000340 33 be b9 20 3b 69 22 03 31 34 7a 8d 68 39 c7 d5 |3.. ;i".14z.h9..|
+00000350 a1 a0 aa 46 15 94 93 d7 54 41 5b 6b 20 17 03 03 |...F....TA[k ...|
+00000360 00 17 f2 60 ff 91 c2 85 55 ed ab 39 6f 5d 0f 22 |...`....U..9o]."|
+00000370 45 3e 61 07 14 a3 05 f4 94 17 03 03 00 13 01 ea |E>a.............|
+00000380 95 52 29 1c 63 71 3a 2d 73 a7 29 31 2c d0 ce 9f |.R).cq:-s.)1,...|
+00000390 2b |+|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-ALPN b/src/crypto/tls/testdata/Server-TLSv12-ALPN
index ec9bf72436..0d9f63b006 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-ALPN
+++ b/src/crypto/tls/testdata/Server-TLSv12-ALPN
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 e3 01 00 00 df 03 03 2d 48 5c c5 05 |...........-H\..|
-00000010 19 52 14 d8 ed 53 5d 30 50 4d 3a ae d9 58 53 96 |.R...S]0PM:..XS.|
-00000020 0a ce fb 18 ed ef f1 57 fe 42 75 00 00 38 c0 2c |.......W.Bu..8.,|
+00000000 16 03 01 00 e3 01 00 00 df 03 03 24 c0 b7 bd da |...........$....|
+00000010 2a 23 bd 6f a0 8f 94 be 7c 14 56 ad fd a8 87 3f |*#.o....|.V....?|
+00000020 c1 97 38 14 7a d4 30 28 11 c4 b5 00 00 38 c0 2c |..8.z.0(.....8.,|
00000030 c0 30 00 9f cc a9 cc a8 cc aa c0 2b c0 2f 00 9e |.0.........+./..|
00000040 c0 24 c0 28 00 6b c0 23 c0 27 00 67 c0 0a c0 14 |.$.(.k.#.'.g....|
00000050 00 39 c0 09 c0 13 00 33 00 9d 00 9c 00 3d 00 3c |.9.....3.....=.<|
@@ -60,37 +60,37 @@
000002a0 d3 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 |.;..............|
000002b0 1d 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb |. /.}.G.bC.(.._.|
000002c0 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb |).0.........._X.|
-000002d0 3b 74 08 04 00 80 0a 5e 25 64 2c 25 6d 9d 7d da |;t.....^%d,%m.}.|
-000002e0 18 0a 9b ff c7 6a 0b 89 ed f8 96 00 70 6f ab 35 |.....j......po.5|
-000002f0 d3 3b 56 cc a1 78 c8 60 4e 50 12 1a 59 02 d9 4c |.;V..x.`NP..Y..L|
-00000300 07 21 03 65 62 9c a4 06 2d ce 34 68 c8 01 57 f1 |.!.eb...-.4h..W.|
-00000310 b5 33 a0 00 72 9f e8 46 87 7c 18 65 e2 2a 18 5e |.3..r..F.|.e.*.^|
-00000320 d3 9d 60 bc cf b8 38 10 2d 21 c0 9e 2c 5d 89 4c |..`...8.-!..,].L|
-00000330 93 27 02 6b 5a 04 02 60 b0 f0 3f 7c 54 aa 9a f1 |.'.kZ..`..?|T...|
-00000340 30 10 50 31 36 0e 87 0c 86 29 53 92 3b 91 24 72 |0.P16....)S.;.$r|
-00000350 79 6d 5c 09 15 19 16 03 03 00 04 0e 00 00 00 |ym\............|
+000002d0 3b 74 04 01 00 80 8a b8 11 46 fc 88 8d f3 7d 22 |;t.......F....}"|
+000002e0 e0 1e d6 ac 45 79 e7 4d fa 46 df 6d a2 b2 67 38 |....Ey.M.F.m..g8|
+000002f0 73 73 d9 20 9e 7c a1 a0 01 0c e7 e3 08 b2 f9 db |ss. .|..........|
+00000300 97 82 c9 1e 27 33 f6 69 5b 8d 3c ca a8 a3 34 d5 |....'3.i[.<...4.|
+00000310 70 ac f6 62 6e 80 5d 5b 6e 1e bd 2d 27 d2 6d c3 |p..bn.][n..-'.m.|
+00000320 ca 08 8c fc ea 94 d2 99 49 d8 5f 30 6a a2 d9 c4 |........I._0j...|
+00000330 f2 17 d9 50 9e 82 9c 95 93 6d 7c b6 18 16 84 92 |...P.....m|.....|
+00000340 31 29 bd a0 df ed 09 ab bf 32 ca c5 26 67 bb 28 |1).......2..&g.(|
+00000350 78 1b c6 5b 7a 21 16 03 03 00 04 0e 00 00 00 |x..[z!.........|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 25 10 00 00 21 20 2e 56 a8 73 0e 9c |....%...! .V.s..|
-00000010 90 0d aa 07 77 a8 09 17 61 e2 11 5c 3a f6 33 6d |....w...a..\:.3m|
-00000020 be 6b 08 77 8a 0d eb 68 2f 21 14 03 03 00 01 01 |.k.w...h/!......|
-00000030 16 03 03 00 28 a7 07 30 a2 67 4f 2d 2f 5f 52 7c |....(..0.gO-/_R||
-00000040 11 81 d0 ea 37 51 73 8a fc 35 fc 58 b2 e6 6b b7 |....7Qs..5.X..k.|
-00000050 66 a9 f0 cf 16 e7 31 b6 83 58 d3 e4 58 |f.....1..X..X|
+00000000 16 03 03 00 25 10 00 00 21 20 69 44 46 d1 ad ea |....%...! iDF...|
+00000010 ac b6 dc 35 6a b1 06 77 57 e8 94 58 49 15 4b 35 |...5j..wW..XI.K5|
+00000020 7c c9 40 a0 75 37 f0 77 79 0c 14 03 03 00 01 01 ||.@.u7.wy.......|
+00000030 16 03 03 00 28 2d 84 08 73 fc f7 b7 8d 07 63 4a |....(-..s.....cJ|
+00000040 c4 42 37 b6 cd e1 87 9f 4f 3b 4e 8c a5 3f 95 67 |.B7.....O;N..?.g|
+00000050 74 02 9a f1 d1 39 0c 7b 7b 8e 82 79 28 |t....9.{{..y(|
>>> Flow 4 (server to client)
00000000 16 03 03 00 82 04 00 00 7e 00 00 00 00 00 78 50 |........~.....xP|
00000010 46 ad c1 db a8 38 86 7b 2b bb fd d0 c3 42 3e 00 |F....8.{+....B>.|
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................|
-00000030 6f ec 80 83 61 8a 3f 4b ad 3f 5f 7d 74 f9 cc 19 |o...a.?K.?_}t...|
-00000040 2b 27 d5 b0 1b 12 9a 8c 82 0f e5 b5 99 f8 0d 10 |+'..............|
-00000050 88 4a b2 65 62 bc a0 c2 2d 97 79 ad 69 58 08 fa |.J.eb...-.y.iX..|
-00000060 6e 3b a7 b5 cb 33 94 de ff b6 49 87 3d d4 c7 0d |n;...3....I.=...|
-00000070 65 a6 a7 66 f9 40 27 b1 e2 28 9a b2 db 82 ab 0f |e..f.@'..(......|
-00000080 d8 f6 10 ab f7 d3 d9 14 03 03 00 01 01 16 03 03 |................|
-00000090 00 28 00 00 00 00 00 00 00 00 09 75 fa e0 ab f5 |.(.........u....|
-000000a0 d4 57 a8 a0 0d 15 d1 25 1f b4 f3 2e 39 a3 91 75 |.W.....%....9..u|
-000000b0 5c 37 5e 26 61 6b 95 2f 41 8a 17 03 03 00 25 00 |\7^&ak./A.....%.|
-000000c0 00 00 00 00 00 00 01 64 6b d0 f8 a2 9c 0f 95 11 |.......dk.......|
-000000d0 e6 05 f2 3c 24 c0 d2 95 7f f1 cc 65 ef 5c 6d 80 |...<$......e.\m.|
-000000e0 1d c9 67 f5 15 03 03 00 1a 00 00 00 00 00 00 00 |..g.............|
-000000f0 02 f2 91 0d 39 58 1d 72 61 6e 60 36 96 03 1e 63 |....9X.ran`6...c|
-00000100 e4 d1 4c |..L|
+00000030 6f ec 80 83 61 f2 44 31 c6 93 15 b9 27 68 bc ab |o...a.D1....'h..|
+00000040 b1 7f 48 8d 99 54 9c 9c 2e 36 11 6f 38 e7 3f 79 |..H..T...6.o8.?y|
+00000050 f9 f1 a5 5d 36 9a 1a 4c 7c f2 ad 84 f4 13 a7 be |...]6..L|.......|
+00000060 e4 79 39 c6 31 33 94 81 cf d3 85 2e 29 02 44 a8 |.y9.13......).D.|
+00000070 61 4d 70 c3 dd ed b4 a2 f2 4b 44 c0 d5 af 19 8b |aMp......KD.....|
+00000080 3f e5 fa fa ba dd 2d 14 03 03 00 01 01 16 03 03 |?.....-.........|
+00000090 00 28 00 00 00 00 00 00 00 00 f0 16 42 20 de 60 |.(..........B .`|
+000000a0 a4 a7 12 85 e5 cb b6 53 eb 76 7f 89 62 76 e8 46 |.......S.v..bv.F|
+000000b0 69 a6 bd 1e f5 5e 13 18 1d d3 17 03 03 00 25 00 |i....^........%.|
+000000c0 00 00 00 00 00 00 01 47 51 00 3f dd 64 0c 6f 43 |.......GQ.?.d.oC|
+000000d0 d1 cb 25 22 45 af ee 64 5f a7 6e cf 6c 7e 26 b3 |..%"E..d_.n.l~&.|
+000000e0 7e cd f0 71 15 03 03 00 1a 00 00 00 00 00 00 00 |~..q............|
+000000f0 02 01 f4 16 18 8e 29 27 34 58 c4 9a f8 a7 58 3a |......)'4X....X:|
+00000100 2e 4a 32 |.J2|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-ALPN-NoMatch b/src/crypto/tls/testdata/Server-TLSv12-ALPN-NoMatch
index 90f146b5ba..ced69a2acf 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-ALPN-NoMatch
+++ b/src/crypto/tls/testdata/Server-TLSv12-ALPN-NoMatch
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 e3 01 00 00 df 03 03 fc a5 8d 79 5f |..............y_|
-00000010 01 7f 77 df 86 0f 60 10 0a 88 ad 68 7f 7b 3b 63 |..w...`....h.{;c|
-00000020 46 a9 7e c6 4e 7c 47 b5 00 2f a7 00 00 38 c0 2c |F.~.N|G../...8.,|
+00000000 16 03 01 00 e3 01 00 00 df 03 03 c8 61 61 3d 4e |............aa=N|
+00000010 9a 5e 9e 0c 59 3f 23 e0 d8 ac d9 28 27 41 6a a0 |.^..Y?#....('Aj.|
+00000020 fb 7e d3 5f 20 aa 40 6c df cb 07 00 00 38 c0 2c |.~._ .@l.....8.,|
00000030 c0 30 00 9f cc a9 cc a8 cc aa c0 2b c0 2f 00 9e |.0.........+./..|
00000040 c0 24 c0 28 00 6b c0 23 c0 27 00 67 c0 0a c0 14 |.$.(.k.#.'.g....|
00000050 00 39 c0 09 c0 13 00 33 00 9d 00 9c 00 3d 00 3c |.9.....3.....=.<|
@@ -59,38 +59,38 @@
00000290 84 5c 21 d3 3b e9 fa e7 16 03 03 00 ac 0c 00 00 |.\!.;...........|
000002a0 a8 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 28 da |.... /.}.G.bC.(.|
000002b0 ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 |._.).0..........|
-000002c0 5f 58 cb 3b 74 08 04 00 80 62 db d2 f4 17 c6 f2 |_X.;t....b......|
-000002d0 73 d1 63 50 1f 26 96 af 9d bd cb 11 9a 95 c4 dd |s.cP.&..........|
-000002e0 49 c3 9a 06 a3 8d 2a 1e b9 74 76 22 36 2e fd 08 |I.....*..tv"6...|
-000002f0 a6 d1 9d 2e 20 75 e6 50 59 49 db 3f d9 b1 0e 81 |.... u.PYI.?....|
-00000300 fb 16 25 67 0d 8b 1c af 35 95 59 d4 56 b2 9f 08 |..%g....5.Y.V...|
-00000310 fd 85 68 46 30 59 2b 66 9e 86 b4 35 4c 4a 9f 6f |..hF0Y+f...5LJ.o|
-00000320 8f 2b 8d 9f 19 c2 9a 4e 91 6e fe 56 cc 9b 39 e7 |.+.....N.n.V..9.|
-00000330 8d e2 5e 07 55 16 76 e0 7f 8b aa 0e 36 94 9f 78 |..^.U.v.....6..x|
-00000340 bd 06 a2 65 a3 f5 83 04 97 16 03 03 00 04 0e 00 |...e............|
+000002c0 5f 58 cb 3b 74 04 01 00 80 a6 d5 2b cf 48 32 3e |_X.;t......+.H2>|
+000002d0 09 74 c1 e4 2a 69 49 d7 bc ce 5a b7 55 e5 e1 f4 |.t..*iI...Z.U...|
+000002e0 cc 3f 64 90 8a 58 e6 86 58 8b d7 94 60 d4 4e a9 |.?d..X..X...`.N.|
+000002f0 e4 e1 45 f1 7b 14 79 d0 9f 5c e3 17 79 61 f3 7a |..E.{.y..\..ya.z|
+00000300 0e e6 cc 7c ff d8 61 29 51 eb 36 f6 f1 57 2e c0 |...|..a)Q.6..W..|
+00000310 43 de 54 fd 92 c7 d7 7a 54 77 f3 3f cf 53 b1 1f |C.T....zTw.?.S..|
+00000320 57 53 7c 6d a3 74 b5 de ae 0b 22 1f 2c 3e d0 41 |WS|m.t....".,>.A|
+00000330 04 7f df d8 d8 44 8d 8e 97 27 71 bc ff 6c 7f b6 |.....D...'q..l..|
+00000340 bd 05 17 2c 1f 84 c6 f1 64 16 03 03 00 04 0e 00 |...,....d.......|
00000350 00 00 |..|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 25 10 00 00 21 20 56 69 9c 58 80 3e |....%...! Vi.X.>|
-00000010 72 ee ee b1 05 fd a0 a7 8d 78 9c 5a 7d e0 21 63 |r........x.Z}.!c|
-00000020 d4 19 3c e2 b1 72 92 03 ed 6a 14 03 03 00 01 01 |..<..r...j......|
-00000030 16 03 03 00 28 6b c0 b3 6e 77 df ef 99 2d 7a 93 |....(k..nw...-z.|
-00000040 d5 9d 7f 1e 8c 36 eb 7c bb 32 f9 a1 b0 65 b3 85 |.....6.|.2...e..|
-00000050 fb 33 64 9f 73 10 41 5a 01 6f d1 6b 73 |.3d.s.AZ.o.ks|
+00000000 16 03 03 00 25 10 00 00 21 20 c8 8e d1 4e a9 96 |....%...! ...N..|
+00000010 d4 73 45 b8 11 6e db db 00 f8 c0 c3 0e 96 62 c3 |.sE..n........b.|
+00000020 7c 04 3b 4a 40 d6 f6 81 e9 0d 14 03 03 00 01 01 ||.;J@...........|
+00000030 16 03 03 00 28 69 f9 fd 75 0d 63 bd ff 62 27 7b |....(i..u.c..b'{|
+00000040 b2 28 b6 dc 55 c4 4b 10 f5 34 64 0d 85 a4 58 10 |.(..U.K..4d...X.|
+00000050 ee d6 93 77 00 da 6e ab 5e 9f f4 62 41 |...w..n.^..bA|
>>> Flow 4 (server to client)
00000000 16 03 03 00 82 04 00 00 7e 00 00 00 00 00 78 50 |........~.....xP|
00000010 46 ad c1 db a8 38 86 7b 2b bb fd d0 c3 42 3e 00 |F....8.{+....B>.|
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................|
-00000030 6f ec 80 83 61 59 7e 5a 0d 70 cc 83 b5 c8 ed d4 |o...aY~Z.p......|
-00000040 79 ab 28 49 65 f8 52 5f 78 5a 83 1a d4 b6 76 fa |y.(Ie.R_xZ....v.|
-00000050 b7 e3 ef 12 48 1b 73 42 18 ee 78 5a 4e 05 70 66 |....H.sB..xZN.pf|
-00000060 1a 51 7b 20 e0 33 94 93 4f 86 e2 54 48 67 df 11 |.Q{ .3..O..THg..|
-00000070 ca f2 6d 73 d1 06 3b 88 ef af 91 1c f0 fd 64 4f |..ms..;.......dO|
-00000080 c8 d7 45 cb cc 90 14 14 03 03 00 01 01 16 03 03 |..E.............|
-00000090 00 28 00 00 00 00 00 00 00 00 58 a6 55 c9 de bc |.(........X.U...|
-000000a0 04 23 e7 85 cf 8c 44 d1 da ad c2 73 45 3e 42 f0 |.#....D....sE>B.|
-000000b0 05 58 7e 7b 35 24 1c 86 93 1e 17 03 03 00 25 00 |.X~{5$........%.|
-000000c0 00 00 00 00 00 00 01 c8 90 76 8e 60 ca b3 75 47 |.........v.`..uG|
-000000d0 78 f2 5d a8 62 82 10 0f 3c b5 b6 51 d2 0b 40 40 |x.].b...<..Q..@@|
-000000e0 66 b4 82 11 15 03 03 00 1a 00 00 00 00 00 00 00 |f...............|
-000000f0 02 f4 16 23 56 26 87 e1 22 9f d3 30 e9 fa 99 a5 |...#V&.."..0....|
-00000100 f0 5b 2c |.[,|
+00000030 6f ec 80 83 61 8d 11 1d 31 eb f3 00 20 b3 0f 72 |o...a...1... ..r|
+00000040 a0 7d 10 58 c8 5f da e2 cb 82 74 4d 99 0d bb 75 |.}.X._....tM...u|
+00000050 f3 cb 1a 19 11 ba 70 90 82 9e ab 73 be a9 96 58 |......p....s...X|
+00000060 96 b7 98 07 ba 33 94 81 e5 8e d1 39 08 10 01 df |.....3.....9....|
+00000070 ba dd f7 b1 0c ce 71 96 f6 d2 8a 50 43 9a 56 b9 |......q....PC.V.|
+00000080 2c 29 d7 05 5b 0d ea 14 03 03 00 01 01 16 03 03 |,)..[...........|
+00000090 00 28 00 00 00 00 00 00 00 00 94 0f b0 0f 1a 43 |.(.............C|
+000000a0 e1 77 b5 36 55 21 8a d5 7e ae 37 eb c5 7b dc aa |.w.6U!..~.7..{..|
+000000b0 28 1b 00 2f 31 e2 5e ca 54 89 17 03 03 00 25 00 |(../1.^.T.....%.|
+000000c0 00 00 00 00 00 00 01 eb 0e 33 bd 20 4f 18 db 26 |.........3. O..&|
+000000d0 b3 48 21 a6 87 e2 a4 1f fe 84 ae 89 fe cf 41 20 |.H!...........A |
+000000e0 f9 d4 41 67 15 03 03 00 1a 00 00 00 00 00 00 00 |..Ag............|
+000000f0 02 f3 51 22 2e 4e 9e 87 4a 06 06 2f f6 88 0c cf |..Q".N..J../....|
+00000100 6f 0f 9b |o..|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceECDSA b/src/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceECDSA
index cbf7564050..ce790fc16f 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceECDSA
+++ b/src/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceECDSA
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 cb 01 00 00 c7 03 03 7c ce 63 72 4d |...........|.crM|
-00000010 0b d9 aa 2f b4 22 f4 e3 88 50 10 11 1a d9 ce 5d |.../."...P.....]|
-00000020 db 14 d4 68 61 48 c1 2d 0d ad dd 00 00 38 c0 2c |...haH.-.....8.,|
+00000000 16 03 01 00 cb 01 00 00 c7 03 03 44 af b1 f3 8d |...........D....|
+00000010 81 78 a9 28 a4 31 99 bb 66 17 63 ed 70 88 b7 bb |.x.(.1..f.c.p...|
+00000020 da ef 4d 1d a2 a6 9e 18 96 97 ec 00 00 38 c0 2c |..M..........8.,|
00000030 c0 30 00 9f cc a9 cc a8 cc aa c0 2b c0 2f 00 9e |.0.........+./..|
00000040 c0 24 c0 28 00 6b c0 23 c0 27 00 67 c0 0a c0 14 |.$.(.k.#.'.g....|
00000050 00 39 c0 09 c0 13 00 33 00 9d 00 9c 00 3d 00 3c |.9.....3.....=.<|
@@ -49,39 +49,39 @@
00000210 0e bd 3f a3 8c 25 c1 33 13 83 0d 94 06 bb d4 37 |..?..%.3.......7|
00000220 7a f6 ec 7a c9 86 2e dd d7 11 69 7f 85 7c 56 de |z..z......i..|V.|
00000230 fb 31 78 2b e4 c7 78 0d ae cb be 9e 4e 36 24 31 |.1x+..x.....N6$1|
-00000240 7b 6a 0f 39 95 12 07 8f 2a 16 03 03 00 b7 0c 00 |{j.9....*.......|
-00000250 00 b3 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 28 |..... /.}.G.bC.(|
+00000240 7b 6a 0f 39 95 12 07 8f 2a 16 03 03 00 b6 0c 00 |{j.9....*.......|
+00000250 00 b2 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 28 |..... /.}.G.bC.(|
00000260 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 |.._.).0.........|
-00000270 99 5f 58 cb 3b 74 04 03 00 8b 30 81 88 02 42 01 |._X.;t....0...B.|
-00000280 f1 77 f4 3f e9 ed b7 55 54 25 08 68 ab b9 42 7c |.w.?...UT%.h..B||
-00000290 64 71 dc ce c0 13 23 20 f3 cd b7 68 09 23 6d c9 |dq....# ...h.#m.|
-000002a0 c5 1f f3 3a 46 f1 e3 2b b4 92 6a 1c bd c8 60 7c |...:F..+..j...`||
-000002b0 da 63 0e c7 4f 4f c4 5e aa 30 b4 b1 3a d4 11 09 |.c..OO.^.0..:...|
-000002c0 05 02 42 01 dd dc 50 07 2f 51 6c 75 7f 3f fd a2 |..B...P./Qlu.?..|
-000002d0 68 62 1d 7a 49 78 4e 57 1b bc 3a 4d 02 84 d5 f6 |hb.zIxNW..:M....|
-000002e0 2a 37 28 4e c0 30 2b a5 22 cc 28 d8 e0 66 2b 4d |*7(N.0+.".(..f+M|
-000002f0 2a cd d8 01 3d 76 55 72 56 90 dc d0 99 85 ee 45 |*...=vUrV......E|
-00000300 01 03 91 88 a5 16 03 03 00 04 0e 00 00 00 |..............|
+00000270 99 5f 58 cb 3b 74 04 03 00 8a 30 81 87 02 42 01 |._X.;t....0...B.|
+00000280 96 02 ab 3d 94 2b dc 27 07 6b 1b 59 21 f2 88 3b |...=.+.'.k.Y!..;|
+00000290 de 7a ce 4e d6 a5 47 30 0d 79 ae a9 e0 cf 9c e7 |.z.N..G0.y......|
+000002a0 0b 14 eb 44 bc a3 b9 5b cf 01 f0 2f be 63 3e 9f |...D...[.../.c>.|
+000002b0 63 32 4e ce 4d 4c 70 86 dd 16 09 70 f7 3e 3b f6 |c2N.MLp....p.>;.|
+000002c0 34 02 41 0a 0f a9 75 dd a8 21 40 8f 05 82 2f e0 |4.A...u..!@.../.|
+000002d0 09 37 08 0a b6 a4 8a 1c fd 3e 4d 1b e3 19 e1 4d |.7.......>M....M|
+000002e0 15 90 65 00 2f e0 15 bf 2b 23 b6 2b 44 7a 3f 1a |..e./...+#.+Dz?.|
+000002f0 4c 82 3a 95 b9 ff 37 0a 1e f2 63 e3 b1 71 81 36 |L.:...7...c..q.6|
+00000300 6d 23 3e 53 16 03 03 00 04 0e 00 00 00 |m#>S.........|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 25 10 00 00 21 20 5b 72 c3 fc 0c a5 |....%...! [r....|
-00000010 a3 b1 e6 db 1d e7 f2 4a dd c8 36 97 25 f9 4c 74 |.......J..6.%.Lt|
-00000020 68 04 e5 02 17 ca 67 e2 a6 59 14 03 03 00 01 01 |h.....g..Y......|
-00000030 16 03 03 00 40 f0 40 1c 1a a9 d8 e7 88 c4 9d 6d |....@.@........m|
-00000040 ad bd e7 5c c4 63 1a 06 5a e9 f5 39 6d 15 ac 41 |...\.c..Z..9m..A|
-00000050 2f ed b9 3b f8 68 13 46 20 be 9b f9 be b6 8a cc |/..;.h.F .......|
-00000060 f4 87 31 53 b3 ef 79 4e ce 73 ea a6 45 de 21 3e |..1S..yN.s..E.!>|
-00000070 99 87 6a cb 4d |..j.M|
+00000000 16 03 03 00 25 10 00 00 21 20 e8 92 71 c8 12 80 |....%...! ..q...|
+00000010 88 d0 7f 00 71 76 83 dc e6 e3 4c b6 e2 8a d2 0d |....qv....L.....|
+00000020 61 7e 36 d9 a7 1d 6c 92 75 46 14 03 03 00 01 01 |a~6...l.uF......|
+00000030 16 03 03 00 40 86 48 1a 6f 89 29 b3 8b c1 b6 ad |....@.H.o.).....|
+00000040 b5 6f af eb 32 44 e9 8f c2 43 58 d1 71 ad 1f 13 |.o..2D...CX.q...|
+00000050 2b e3 5c bc d5 07 8a 29 9d 30 40 cd 73 2d 0a 80 |+.\....).0@.s-..|
+00000060 49 82 d5 2a 79 eb a5 3c 2e 69 ee 1a 3a d8 1a 69 |I..*y..<.i..:..i|
+00000070 63 a6 30 8e 3f |c.0.?|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....|
-00000010 00 00 00 00 00 00 00 00 00 00 00 10 1f 05 23 89 |..............#.|
-00000020 1d 50 5f cb 33 09 57 70 32 fc 01 76 f8 e9 dc ec |.P_.3.Wp2..v....|
-00000030 13 b6 70 95 24 55 52 21 ed e6 5e 59 45 9f c9 c0 |..p.$UR!..^YE...|
-00000040 74 6d d1 2f e6 4d 7c 6e 1e 41 4c 17 03 03 00 40 |tm./.M|n.AL....@|
+00000010 00 00 00 00 00 00 00 00 00 00 00 33 ab 9b d6 4a |...........3...J|
+00000020 bb e7 06 b0 d4 7e 1a 7f 78 cb d1 7a 44 26 a7 e6 |.....~..x..zD&..|
+00000030 93 42 ae ec d3 44 0c dd b0 74 1b d8 99 75 a2 69 |.B...D...t...u.i|
+00000040 98 d4 ed 2c b8 a0 26 69 80 1c 7f 17 03 03 00 40 |...,..&i.......@|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
-00000060 e8 04 12 d8 cd fc 76 19 e0 27 c1 f2 12 66 d8 86 |......v..'...f..|
-00000070 a8 25 b6 3f 13 aa 5c c5 43 c5 83 a1 c0 4a 7c c6 |.%.?..\.C....J|.|
-00000080 7b d4 63 86 b8 87 d1 36 af 99 f3 6f 9d 7e 86 37 |{.c....6...o.~.7|
+00000060 a5 0b 57 10 11 ca 9e fb f4 8b 24 86 c7 58 b9 4c |..W.......$..X.L|
+00000070 9a 1d 6a 60 2b 7c b1 21 7e 00 f2 e5 00 6f ab 04 |..j`+|.!~....o..|
+00000080 2f 14 97 ae 70 05 0d 18 31 57 51 4a 0c c7 10 84 |/...p...1WQJ....|
00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........|
-000000a0 00 00 00 00 00 f0 fe 4c 32 8b c2 63 78 6c ba de |.......L2..cxl..|
-000000b0 b3 55 0f e4 32 38 53 5e 2b 32 5c b9 23 4a 84 b7 |.U..28S^+2\.#J..|
-000000c0 6f 2f 86 54 11 |o/.T.|
+000000a0 00 00 00 00 00 d2 56 41 e1 58 30 76 2e 6e 6f 13 |......VA.X0v.no.|
+000000b0 3b 72 5d bf c4 5c ef 63 2e 0a f0 6a 3a 98 ec 97 |;r]..\.c...j:...|
+000000c0 07 b3 08 94 0d |.....|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceRSA b/src/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceRSA
index db7199d9a9..8959740c3b 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceRSA
+++ b/src/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceRSA
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 cb 01 00 00 c7 03 03 39 27 e9 a6 45 |...........9'..E|
-00000010 cf a6 18 8c f0 d1 fb 71 81 b6 bf 16 d7 75 af f2 |.......q.....u..|
-00000020 1e 4f 4c 72 2a ce 66 52 a6 87 32 00 00 38 c0 2c |.OLr*.fR..2..8.,|
+00000000 16 03 01 00 cb 01 00 00 c7 03 03 a6 9c 71 27 48 |.............q'H|
+00000010 24 f6 58 48 c8 2c 32 88 c9 01 eb f0 87 14 ba 7f |$.XH.,2.........|
+00000020 f0 53 2d fd a1 b2 0a 72 e4 48 8e 00 00 38 c0 2c |.S-....r.H...8.,|
00000030 c0 30 00 9f cc a9 cc a8 cc aa c0 2b c0 2f 00 9e |.0.........+./..|
00000040 c0 24 c0 28 00 6b c0 23 c0 27 00 67 c0 0a c0 14 |.$.(.k.#.'.g....|
00000050 00 39 c0 09 c0 13 00 33 00 9d 00 9c 00 3d 00 3c |.9.....3.....=.<|
@@ -57,35 +57,35 @@
00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............|
000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)|
000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;|
-000002c0 74 08 04 00 80 41 cd 5d a0 ba 92 1f 26 47 6d 72 |t....A.]....&Gmr|
-000002d0 33 44 47 a4 80 66 d8 1c 17 93 1e 25 8e c3 8e 95 |3DG..f.....%....|
-000002e0 9c ae b6 99 7e f6 80 3f b1 73 cc c3 db 7a 4b 40 |....~..?.s...zK@|
-000002f0 a1 0b bc ff 0e 4b c1 67 11 b2 ca 33 06 41 f9 ac |.....K.g...3.A..|
-00000300 56 dc f6 26 1b a3 04 2a 28 f9 47 0f 0b 56 05 73 |V..&...*(.G..V.s|
-00000310 93 cb 12 45 4f 6b 93 5d 0f 4c ca d3 f5 64 e2 4a |...EOk.].L...d.J|
-00000320 eb 36 bb 87 3f 71 9b 36 08 99 79 48 fc a6 02 d6 |.6..?q.6..yH....|
-00000330 38 88 09 68 cf 71 e8 d4 51 f8 b1 77 70 42 8b 18 |8..h.q..Q..wpB..|
-00000340 ab cd e1 52 d9 16 03 03 00 04 0e 00 00 00 |...R..........|
+000002c0 74 04 01 00 80 10 af cc 7e b1 33 b1 87 08 e9 d5 |t.......~.3.....|
+000002d0 b0 fc 70 a6 b6 f9 20 92 60 b2 01 90 e3 e2 0b 71 |..p... .`......q|
+000002e0 4c b9 91 4e c7 28 60 cb b5 b7 d1 91 1f 01 f3 93 |L..N.(`.........|
+000002f0 56 5b 14 91 bb e4 95 18 f5 0c 23 47 e6 4e d0 9e |V[........#G.N..|
+00000300 2f 1a 4a d1 f5 08 71 c0 08 70 75 78 c1 c7 89 e4 |/.J...q..pux....|
+00000310 b2 3c b9 49 c8 95 c7 ba 5b b0 04 20 18 b1 5a 3e |.<.I....[.. ..Z>|
+00000320 2b 9f 7b 2b 9c f8 34 69 4b c2 a8 2f d1 73 ec d1 |+.{+..4iK../.s..|
+00000330 c9 22 19 6b bc aa e4 d3 89 73 5a 88 27 75 4a b6 |.".k.....sZ.'uJ.|
+00000340 c3 6d 32 b0 a2 16 03 03 00 04 0e 00 00 00 |.m2...........|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 25 10 00 00 21 20 b5 a5 bc 9f 09 79 |....%...! .....y|
-00000010 25 1a 7b af 52 0f 8a c2 16 a8 20 8d 0c 11 26 11 |%.{.R..... ...&.|
-00000020 32 79 35 b9 2f ee 63 ce b7 49 14 03 03 00 01 01 |2y5./.c..I......|
-00000030 16 03 03 00 40 d8 eb b7 d7 b4 a6 62 a1 8d c6 a5 |....@......b....|
-00000040 5f 15 8e 1f de d9 98 90 3b d8 dd b1 13 7e 49 9b |_.......;....~I.|
-00000050 d4 82 15 b9 a9 31 ac ae eb 77 21 dc 9f e0 8e 5b |.....1...w!....[|
-00000060 d8 ea 09 fc a2 35 64 af 8d 1a fb a3 f1 97 0e 09 |.....5d.........|
-00000070 b4 5b c9 e9 19 |.[...|
+00000000 16 03 03 00 25 10 00 00 21 20 f3 07 eb 86 c5 e2 |....%...! ......|
+00000010 28 7c be 7e 34 8d c5 74 19 0b b3 cc ce ce 90 3f |(|.~4..t.......?|
+00000020 ac 06 c8 9f 79 3d 42 08 e2 01 14 03 03 00 01 01 |....y=B.........|
+00000030 16 03 03 00 40 9b 6d a1 1e ca fb 27 67 ca 7b 57 |....@.m....'g.{W|
+00000040 60 f4 60 95 b4 56 fd 97 cb 58 c5 cb bc 04 87 1d |`.`..V...X......|
+00000050 74 a5 98 ec 3c 6f 25 5a ef c5 af 21 4b 2e 5c 97 |t......F.....|
+00000070 08 62 88 25 1f |.b.%.|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....|
-00000010 00 00 00 00 00 00 00 00 00 00 00 3b 2a 79 f1 0d |...........;*y..|
-00000020 65 b8 4a 2a aa a5 87 60 69 8f 8f 87 4b 21 24 9a |e.J*...`i...K!$.|
-00000030 6e 07 f0 a4 be ce 3d 67 29 85 53 98 fb cf a1 ee |n.....=g).S.....|
-00000040 b0 e0 52 61 c1 16 e5 09 b9 0b 9c 17 03 03 00 40 |..Ra...........@|
+00000010 00 00 00 00 00 00 00 00 00 00 00 8e a1 9a 44 d4 |..............D.|
+00000020 98 c6 5f 46 2f d9 e5 ac 78 b5 91 3f 15 89 6f fb |.._F/...x..?..o.|
+00000030 39 79 65 0b c7 09 c7 fc eb 40 6d 8e 6d b7 8b 94 |9ye......@m.m...|
+00000040 6f 30 5a a6 4c 9d 2a 13 ed f6 f4 17 03 03 00 40 |o0Z.L.*........@|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
-00000060 fe d7 63 a8 10 70 b8 2c 0c 95 da 92 84 2b d3 63 |..c..p.,.....+.c|
-00000070 03 d8 19 94 68 d8 d2 da f7 e2 83 5b 24 78 87 0f |....h......[$x..|
-00000080 ca ce 14 3a 8a d4 da b2 90 eb 6f 0e de 14 30 96 |...:......o...0.|
+00000060 5b 96 f1 fa c4 5b a3 22 74 ef 8c 34 52 50 c6 86 |[....[."t..4RP..|
+00000070 32 19 40 b8 80 54 d9 c2 6a 43 a2 c2 fe 07 dd 37 |2.@..T..jC.....7|
+00000080 89 62 bd 68 6a 1e e7 d9 1f ba 3a 1a 83 13 1f 7c |.b.hj.....:....||
00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........|
-000000a0 00 00 00 00 00 ab e5 6b f9 d3 a6 07 ce 0b 64 7e |.......k......d~|
-000000b0 14 42 d3 17 6a d4 89 2c 37 7d cd ee 77 23 0c 60 |.B..j..,7}..w#.`|
-000000c0 e0 db 35 5e 96 |..5^.|
+000000a0 00 00 00 00 00 92 f0 3e 2e 3c d2 62 ce e8 2e 12 |.......>.<.b....|
+000000b0 4e 1e 77 ba ff 61 97 f9 8e e8 d1 1b a0 00 3f 2c |N.w..a........?,|
+000000c0 8c 5c 10 ac 05 |.\...|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndECDSAGiven b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndECDSAGiven
index c8e4998a7e..b65a7b70f4 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndECDSAGiven
+++ b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndECDSAGiven
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 97 01 00 00 93 03 03 66 1f 74 64 d2 |...........f.td.|
-00000010 fb 53 f5 a4 7e ea ad 25 d8 e9 91 62 49 87 de 60 |.S..~..%...bI..`|
-00000020 0d 30 d5 34 21 7a 34 b4 2f 95 02 00 00 04 00 2f |.0.4!z4./....../|
+00000000 16 03 01 00 97 01 00 00 93 03 03 75 b5 bf db ae |...........u....|
+00000010 ee 3a 8d d7 23 e1 22 9a 42 d9 7a de ac 41 81 60 |.:..#.".B.z..A.`|
+00000020 4d 05 6e f1 11 c5 c0 de 21 46 d2 00 00 04 00 2f |M.n.....!F...../|
00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1|
00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
@@ -51,10 +51,9 @@
00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
-00000290 3b e9 fa e7 16 03 03 00 23 0d 00 00 1f 02 01 40 |;.......#......@|
-000002a0 00 18 08 04 04 03 08 07 08 05 08 06 04 01 05 01 |................|
-000002b0 06 01 05 03 06 03 02 01 02 03 00 00 16 03 03 00 |................|
-000002c0 04 0e 00 00 00 |.....|
+00000290 3b e9 fa e7 16 03 03 00 1d 0d 00 00 19 02 01 40 |;..............@|
+000002a0 00 12 04 01 04 03 08 07 05 01 06 01 05 03 06 03 |................|
+000002b0 02 01 02 03 00 00 16 03 03 00 04 0e 00 00 00 |...............|
>>> Flow 3 (client to server)
00000000 16 03 03 02 0a 0b 00 02 06 00 02 03 00 02 00 30 |...............0|
00000010 82 01 fc 30 82 01 5e 02 09 00 9a 30 84 6c 26 35 |...0..^....0.l&5|
@@ -89,40 +88,40 @@
000001e0 be e8 91 b3 da 1a f5 5d a3 23 f5 26 8b 45 70 8d |.......].#.&.Ep.|
000001f0 65 62 9b 7e 01 99 3d 18 f6 10 9a 38 61 9b 2e 57 |eb.~..=....8a..W|
00000200 e4 fa cc b1 8a ce e2 23 a0 87 f0 e1 67 51 eb 16 |.......#....gQ..|
-00000210 03 03 00 86 10 00 00 82 00 80 2f 1e 5b 62 64 9e |........../.[bd.|
-00000220 68 97 bc 17 8d aa e1 4e c7 cb 48 a1 cf dd bf e7 |h......N..H.....|
-00000230 18 5e e0 6f da 03 68 f0 be 8a e8 4f a6 c6 e1 58 |.^.o..h....O...X|
-00000240 eb 8f 10 82 36 de bf 7a f2 ca eb af 42 9a 4e b2 |....6..z....B.N.|
-00000250 25 36 4f e5 dd 04 a2 93 f0 af 4c ca c7 cc 3e 5c |%6O.......L...>\|
-00000260 5b 90 31 1a a8 e8 d5 a8 db c1 9d 51 ec 6d 36 20 |[.1........Q.m6 |
-00000270 ef 64 41 a7 0e 5a cd 51 9d 0c e4 1d 27 0b 0a 4f |.dA..Z.Q....'..O|
-00000280 2b c3 92 8d ff 9e 6a f7 47 f8 34 5a 24 e6 ce 47 |+.....j.G.4Z$..G|
-00000290 d6 da 88 1f 2c f1 93 ba 0e 3f 16 03 03 00 93 0f |....,....?......|
-000002a0 00 00 8f 04 03 00 8b 30 81 88 02 42 01 c1 a5 6a |.......0...B...j|
-000002b0 ed 3b c8 6e 4c 41 96 db 17 f3 f1 56 8a 9d a4 9e |.;.nLA.....V....|
-000002c0 31 8f f9 a7 78 02 ed bd f4 97 b6 f1 d4 16 ab 22 |1...x.........."|
-000002d0 34 3f 83 72 11 1b 47 b6 e4 03 50 56 1d 9c 21 a2 |4?.r..G...PV..!.|
-000002e0 cf 4a 16 9c 12 86 03 fd f0 5c 9a 2f db fb 02 42 |.J.......\./...B|
-000002f0 01 ae cd 98 fc 91 06 11 d1 99 0c 67 5f dd 1d 2b |...........g_..+|
-00000300 7c a6 b0 af b0 e1 2d 81 32 2e 47 f1 48 f7 9a f3 ||.....-.2.G.H...|
-00000310 9c a2 eb 6a ea b8 02 91 d9 60 9e ab ed 51 af db |...j.....`...Q..|
-00000320 05 3e 36 a9 df 57 ff b5 6b aa e7 8e 24 64 ef 84 |.>6..W..k...$d..|
-00000330 b7 58 14 03 03 00 01 01 16 03 03 00 40 8d cd c6 |.X..........@...|
-00000340 3c 90 dc 8b 6b 94 09 a8 80 1e 8c 4f 70 d6 c2 90 |<...k......Op...|
-00000350 16 35 92 7a ce be a9 c8 17 fc 6b 48 da a5 af bf |.5.z......kH....|
-00000360 9a a5 e0 0f 77 aa b8 5f b5 5d 95 7f a7 b5 a1 4a |....w.._.].....J|
-00000370 8f 90 95 27 df 17 cc 98 34 32 6c 5a 60 |...'....42lZ`|
+00000210 03 03 00 86 10 00 00 82 00 80 6c 1d a3 55 fb a0 |..........l..U..|
+00000220 be 6f 49 64 67 b8 da 1c 27 91 f4 5d d9 9d 7e f0 |.oIdg...'..]..~.|
+00000230 53 86 15 96 93 b2 0d 11 1a cf 3c 76 5e 76 24 ac |S.........wJ._.|
+00000270 5f 51 0d 12 61 19 f6 fe 7d f7 b7 06 0d b1 de 09 |_Q..a...}.......|
+00000280 45 17 4b 2a 15 97 ce 96 c5 f5 27 95 fb e8 c5 67 |E.K*......'....g|
+00000290 5e cb 8c 98 c7 c5 68 41 36 99 16 03 03 00 91 0f |^.....hA6.......|
+000002a0 00 00 8d 04 03 00 89 30 81 86 02 41 48 35 40 6e |.......0...AH5@n|
+000002b0 03 2a 43 fe f8 a9 c5 f9 c7 05 f8 db 13 5e ee bb |.*C..........^..|
+000002c0 a8 59 5b fc b4 5d 0a ec 32 18 d5 a0 01 d5 81 a5 |.Y[..]..2.......|
+000002d0 f3 8e 4f 91 54 c7 8f a1 c1 77 4c 94 5c e4 68 c2 |..O.T....wL.\.h.|
+000002e0 0b 22 e2 70 0c 32 e2 9d 6e 47 e4 0d f7 02 41 2d |.".p.2..nG....A-|
+000002f0 0e bb 28 47 90 23 68 f2 fd 9e 7d 13 f0 ad 40 ed |..(G.#h...}...@.|
+00000300 cb 32 e5 9d 5e a7 e1 12 d7 de 10 bc 93 df cb 03 |.2..^...........|
+00000310 4e 16 5a cf 8f 25 1e 39 ff 7c 9f 59 55 f0 df b4 |N.Z..%.9.|.YU...|
+00000320 ce 43 6d 15 8f e3 ef 76 5d 0d a9 31 a9 24 c6 58 |.Cm....v]..1.$.X|
+00000330 14 03 03 00 01 01 16 03 03 00 40 71 ca 10 08 a9 |..........@q....|
+00000340 1a f1 78 9d 6f 2d 76 1c b0 2a f8 26 d2 f6 89 db |..x.o-v..*.&....|
+00000350 25 50 63 cc bf 12 cb fb 39 93 91 7f 7f f7 e4 fe |%Pc.....9.......|
+00000360 fc 28 d0 01 3b e9 f9 1b 6a 77 db 16 14 71 3d 35 |.(..;...jw...q=5|
+00000370 67 de b8 1d e3 4a 02 bc cf 0a a6 |g....J.....|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....|
-00000010 00 00 00 00 00 00 00 00 00 00 00 f0 c3 7c f0 20 |.............|. |
-00000020 3f 75 d0 c4 b5 2d 76 82 22 9e 8c 8c 6a 83 95 84 |?u...-v."...j...|
-00000030 22 54 20 d6 62 d8 75 69 32 90 e9 d4 07 fa 6a 01 |"T .b.ui2.....j.|
-00000040 15 b8 bc 88 8d 40 ef 18 48 80 25 17 03 03 00 40 |.....@..H.%....@|
+00000010 00 00 00 00 00 00 00 00 00 00 00 0d f1 0c 52 89 |..............R.|
+00000020 61 e6 21 95 8d 6f 5d e9 07 42 23 5f 1c 74 44 57 |a.!..o]..B#_.tDW|
+00000030 38 a3 98 77 f2 62 99 71 d6 fe 03 a3 82 01 7a da |8..w.b.q......z.|
+00000040 a5 fd 12 62 2b d2 1d e4 e2 51 25 17 03 03 00 40 |...b+....Q%....@|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
-00000060 03 32 97 2d 46 23 92 df 55 de 53 b0 91 63 09 c2 |.2.-F#..U.S..c..|
-00000070 21 23 c9 23 fa e6 f2 a3 e0 3e 90 a4 82 d8 6a 36 |!#.#.....>....j6|
-00000080 65 af ee 69 a6 86 41 c8 7e 14 d4 bb 93 7d be 53 |e..i..A.~....}.S|
+00000060 81 82 cc a9 4e 6f 78 41 28 b3 e6 c3 44 62 48 0b |....NoxA(...DbH.|
+00000070 b3 70 f9 f8 7a fc c5 be 36 45 58 41 6f 77 69 40 |.p..z...6EXAowi@|
+00000080 5b 6e fc 69 84 21 eb bc 95 36 e6 48 05 02 37 f5 |[n.i.!...6.H..7.|
00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........|
-000000a0 00 00 00 00 00 b2 2f 21 57 e0 e7 2a 16 8e bb 22 |....../!W..*..."|
-000000b0 7d 1e e1 34 d5 58 90 94 a7 e7 33 f8 df 9f 60 d9 |}..4.X....3...`.|
-000000c0 81 6a 44 0c d3 |.jD..|
+000000a0 00 00 00 00 00 d3 2f 45 d3 65 3b 64 67 43 ef aa |....../E.e;dgC..|
+000000b0 a7 bb 98 a0 99 70 7f 56 c6 13 b2 1b 62 35 62 ea |.....p.V....b5b.|
+000000c0 51 75 94 be 32 |Qu..2|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndEd25519Given b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndEd25519Given
index 51288df50f..0503b9def5 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndEd25519Given
+++ b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndEd25519Given
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 cb 01 00 00 c7 03 03 26 1e 0e df 93 |...........&....|
-00000010 13 67 d7 9a 1f d2 f1 8a 42 a4 04 d1 65 02 17 40 |.g......B...e..@|
-00000020 18 a8 c5 30 ce 23 ae 56 47 8e 1f 00 00 38 c0 2c |...0.#.VG....8.,|
+00000000 16 03 01 00 cb 01 00 00 c7 03 03 ec bb 63 30 5c |.............c0\|
+00000010 ea 49 54 dc 44 f7 80 47 c9 4d ff fa d4 77 44 8a |.IT.D..G.M...wD.|
+00000020 ce 4b bd ce d7 95 b2 0d f7 2e 88 00 00 38 c0 2c |.K...........8.,|
00000030 c0 30 00 9f cc a9 cc a8 cc aa c0 2b c0 2f 00 9e |.0.........+./..|
00000040 c0 24 c0 28 00 6b c0 23 c0 27 00 67 c0 0a c0 14 |.$.(.k.#.'.g....|
00000050 00 39 c0 09 c0 13 00 33 00 9d 00 9c 00 3d 00 3c |.9.....3.....=.<|
@@ -57,18 +57,17 @@
00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............|
000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)|
000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;|
-000002c0 74 08 04 00 80 77 9b ae 6a 97 73 f6 07 89 02 91 |t....w..j.s.....|
-000002d0 79 f1 94 12 c6 60 3a 98 7e a8 1a 2b ed 05 5c e3 |y....`:.~..+..\.|
-000002e0 1c 6e 10 b8 d3 8e 32 32 6f b0 ae 84 bb fb 8b 19 |.n....22o.......|
-000002f0 0e cc ce a6 92 35 ea 79 ee b3 4e 27 04 51 85 30 |.....5.y..N'.Q.0|
-00000300 6c 83 da 21 97 2c 18 80 e8 57 b5 ec 24 2c 43 3d |l..!.,...W..$,C=|
-00000310 70 b8 38 d1 8c 61 e0 60 40 0d 07 db 74 dc 10 ac |p.8..a.`@...t...|
-00000320 7b cd cd 7d 16 0b 14 97 38 01 be 13 a9 04 5e 90 |{..}....8.....^.|
-00000330 f4 f3 c5 85 97 ab 1d 62 fa 2d 08 a4 ae 96 b3 0e |.......b.-......|
-00000340 09 25 cd 4a 18 16 03 03 00 23 0d 00 00 1f 02 01 |.%.J.....#......|
-00000350 40 00 18 08 04 04 03 08 07 08 05 08 06 04 01 05 |@...............|
-00000360 01 06 01 05 03 06 03 02 01 02 03 00 00 16 03 03 |................|
-00000370 00 04 0e 00 00 00 |......|
+000002c0 74 04 01 00 80 94 e2 09 13 e0 7c e8 6d 3b 50 f1 |t.........|.m;P.|
+000002d0 4f f3 58 57 da 87 f4 61 f5 04 fc ec 0d 28 f1 e9 |O.XW...a.....(..|
+000002e0 be 93 20 4a 17 03 17 b1 7f 2c 32 24 2e 02 35 67 |.. J.....,2$..5g|
+000002f0 9f e7 55 0a 6d 3d af ef e3 b2 27 2e ae 12 cd 2c |..U.m=....'....,|
+00000300 d9 e1 60 d6 64 94 f5 f2 42 54 43 23 70 36 fe 8e |..`.d...BTC#p6..|
+00000310 d2 0b a3 cf fd 04 74 6e 55 9b 7a 86 c8 dd 0d 40 |......tnU.z....@|
+00000320 bc b1 4e 05 c2 7f b4 40 3a d9 66 01 af ee fb 54 |..N....@:.f....T|
+00000330 b6 cc e4 5b a2 1a 39 dc 25 7d 5d 8c 37 a1 15 ae |...[..9.%}].7...|
+00000340 ed 16 b5 25 14 16 03 03 00 1d 0d 00 00 19 02 01 |...%............|
+00000350 40 00 12 04 01 04 03 08 07 05 01 06 01 05 03 06 |@...............|
+00000360 03 02 01 02 03 00 00 16 03 03 00 04 0e 00 00 00 |................|
>>> Flow 3 (client to server)
00000000 16 03 03 01 3c 0b 00 01 38 00 01 35 00 01 32 30 |....<...8..5..20|
00000010 82 01 2e 30 81 e1 a0 03 02 01 02 02 10 17 d1 81 |...0............|
@@ -90,23 +89,23 @@
00000110 8a 4e 34 40 39 d6 b3 10 dc 19 fe a0 22 71 b3 f5 |.N4@9......."q..|
00000120 8f a1 58 0d cd f4 f1 85 24 bf e6 3d 14 df df ed |..X.....$..=....|
00000130 0e e1 17 d8 11 a2 60 d0 8a 37 23 2a c2 46 aa 3a |......`..7#*.F.:|
-00000140 08 16 03 03 00 25 10 00 00 21 20 b6 8b 9e fb b5 |.....%...! .....|
-00000150 86 80 f5 41 57 7c 05 ea d3 42 02 24 c9 5d 26 9c |...AW|...B.$.]&.|
-00000160 72 33 19 42 c2 70 a1 91 2c f4 58 16 03 03 00 48 |r3.B.p..,.X....H|
-00000170 0f 00 00 44 08 07 00 40 7d 84 b0 a3 bf d4 ed bc |...D...@}.......|
-00000180 2c 8f 6f 35 47 96 32 25 4b cf 65 5a 08 ae 5a 58 |,.o5G.2%K.eZ..ZX|
-00000190 f4 a2 48 ae 70 95 d1 43 95 53 fb 56 ab 73 da d0 |..H.p..C.S.V.s..|
-000001a0 9a 7d 5e fb 83 36 81 89 6e 64 15 f7 57 16 8c 97 |.}^..6..nd..W...|
-000001b0 70 07 4f 8c 62 0e 54 0c 14 03 03 00 01 01 16 03 |p.O.b.T.........|
-000001c0 03 00 28 54 7e 52 83 b2 61 a1 2f 22 ff 29 f1 6d |..(T~R..a./".).m|
-000001d0 fd 7c f6 ac 25 b5 9d 4e e6 6d aa dc 3b cc ed f5 |.|..%..N.m..;...|
-000001e0 7a 42 da ce ab 76 a2 31 13 07 90 |zB...v.1...|
+00000140 08 16 03 03 00 25 10 00 00 21 20 f1 58 f8 db 86 |.....%...! .X...|
+00000150 a5 97 07 c8 fc c8 c1 fe e4 c9 35 13 44 f8 9b 7f |..........5.D...|
+00000160 4a 22 6a 61 75 70 be 23 76 f4 5f 16 03 03 00 48 |J"jaup.#v._....H|
+00000170 0f 00 00 44 08 07 00 40 fb ab 8f 44 f1 7b cb 95 |...D...@...D.{..|
+00000180 e3 83 4b 85 d0 4f 41 a6 39 f8 ba c1 7c b5 7d f0 |..K..OA.9...|.}.|
+00000190 45 5b 2d e2 90 80 27 1a b9 88 dd 4b 0d bc e8 1b |E[-...'....K....|
+000001a0 d4 fc 69 d1 ac 59 d8 b3 0b b6 f7 ae 76 12 da 80 |..i..Y......v...|
+000001b0 6b 39 98 5b 55 c4 c1 09 14 03 03 00 01 01 16 03 |k9.[U...........|
+000001c0 03 00 28 46 3a 98 32 bf 61 b0 d2 74 f8 f4 65 ef |..(F:.2.a..t..e.|
+000001d0 89 5b f5 ef 49 42 56 67 97 23 f2 18 de 06 30 86 |.[..IBVg.#....0.|
+000001e0 77 66 ac 0a ac 88 98 ab 93 2b 20 |wf.......+ |
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....|
-00000010 00 00 00 22 de 32 e6 4c f8 8c 2b 41 e0 25 cb 48 |...".2.L..+A.%.H|
-00000020 f4 98 1f c0 4a 06 ac db b5 c4 a2 09 44 81 c2 c4 |....J.......D...|
-00000030 f5 c6 b4 17 03 03 00 25 00 00 00 00 00 00 00 01 |.......%........|
-00000040 b0 c7 84 90 55 23 5b 2a cd 67 58 64 cf 43 78 b0 |....U#[*.gXd.Cx.|
-00000050 41 61 36 ff 7b 9f 75 5e 92 90 a7 8e 9d 15 03 03 |Aa6.{.u^........|
-00000060 00 1a 00 00 00 00 00 00 00 02 5b 94 c8 7a 6e 9a |..........[..zn.|
-00000070 f5 23 4b 72 aa e4 c7 62 be 44 78 f5 |.#Kr...b.Dx.|
+00000010 00 00 00 49 81 2d e8 88 dc 52 2a 44 51 18 2e 62 |...I.-...R*DQ..b|
+00000020 28 9e 91 7a 87 b5 fb 46 89 27 01 5e dc b1 12 00 |(..z...F.'.^....|
+00000030 72 fe 34 17 03 03 00 25 00 00 00 00 00 00 00 01 |r.4....%........|
+00000040 ab a1 6a 44 4b 80 a8 2e f4 75 ff 09 9f 11 05 74 |..jDK....u.....t|
+00000050 93 ab 97 de 54 16 36 f9 0a 3c a1 89 c0 15 03 03 |....T.6..<......|
+00000060 00 1a 00 00 00 00 00 00 00 02 2d 63 e8 72 ab 7b |..........-c.r.{|
+00000070 20 de f4 73 05 4a 26 a1 78 7a 1c 02 | ..s.J&.xz..|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven
index bdc4d69e2b..aa27d2c231 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven
+++ b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven
@@ -1,11 +1,14 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 6b 01 00 00 67 03 03 5f 6c 21 71 7b |....k...g.._l!q{|
-00000010 56 1a fb f0 82 41 8b 3f f0 da 02 b6 17 90 f4 37 |V....A.?.......7|
-00000020 71 5c 5d f8 00 15 d5 08 3e 9e d2 00 00 04 00 2f |q\].....>....../|
-00000030 00 ff 01 00 00 3a 00 00 00 0e 00 0c 00 00 09 31 |.....:.........1|
+00000000 16 03 01 00 97 01 00 00 93 03 03 de e6 7c 24 10 |.............|$.|
+00000010 d1 3a 48 8f ba 9a cf 0f 4b 8d 81 8b 07 41 4f bd |.:H.....K....AO.|
+00000020 46 9b c1 dc 24 51 aa 30 83 a2 49 00 00 04 00 2f |F...$Q.0..I..../|
+00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1|
00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
-00000060 00 16 00 00 00 17 00 00 00 0d 00 04 00 02 08 04 |................|
+00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....|
+00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................|
+00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................|
+00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............|
>>> Flow 2 (server to client)
00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
@@ -48,77 +51,36 @@
00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
-00000290 3b e9 fa e7 16 03 03 00 23 0d 00 00 1f 02 01 40 |;.......#......@|
-000002a0 00 18 08 04 04 03 08 07 08 05 08 06 04 01 05 01 |................|
-000002b0 06 01 05 03 06 03 02 01 02 03 00 00 16 03 03 00 |................|
-000002c0 04 0e 00 00 00 |.....|
+00000290 3b e9 fa e7 16 03 03 00 1d 0d 00 00 19 02 01 40 |;..............@|
+000002a0 00 12 04 01 04 03 08 07 05 01 06 01 05 03 06 03 |................|
+000002b0 02 01 02 03 00 00 16 03 03 00 04 0e 00 00 00 |...............|
>>> Flow 3 (client to server)
-00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0|
-00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.|
-00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.|
-00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1|
-00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C|
-00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523|
-00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231|
-00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac|
-00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.|
-00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....|
-000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x|
-000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.|
-000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4|
-000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..|
-000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#|
-000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....|
-00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......|
-00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..|
-00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U|
-00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U|
-00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......|
-00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.|
-00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0|
-00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........|
-00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..|
-00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]|
-000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A|
-000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...|
-000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...|
-000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......|
-000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{|
-000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....|
-00000200 e5 35 16 03 03 00 86 10 00 00 82 00 80 9a cf e4 |.5..............|
-00000210 f4 ff c6 e1 0e f3 ea 25 27 42 8f 64 39 f3 d8 51 |.......%'B.d9..Q|
-00000220 45 cd e5 e5 06 c0 59 31 79 00 1f 59 ac a8 e6 de |E.....Y1y..Y....|
-00000230 60 45 00 e4 31 b9 d8 af b4 9a ff 80 c8 bc a2 f1 |`E..1...........|
-00000240 14 10 48 e0 5b fc c5 04 0f b2 b4 ea ce 24 cb 88 |..H.[........$..|
-00000250 9a 53 e3 e7 94 5a 7c bd 7a f2 fa 12 53 6b 67 53 |.S...Z|.z...SkgS|
-00000260 81 18 59 ce b0 a0 37 d0 cb ed c4 b7 fd de c1 ee |..Y...7.........|
-00000270 9b 77 09 ba fd a4 29 b9 ca 9c 28 f1 82 5f 6a 0c |.w....)...(.._j.|
-00000280 1f 49 4c f4 b5 66 56 31 c5 80 73 46 f1 16 03 03 |.IL..fV1..sF....|
-00000290 00 88 0f 00 00 84 08 04 00 80 89 78 b7 73 5b b3 |...........x.s[.|
-000002a0 35 95 da f6 a1 3c 45 81 0b f7 19 87 ff d6 55 64 |5.....|
-000002d0 cf 4f e7 db 75 a9 8d cd 2f e1 24 1b 26 2a c4 f2 |.O..u.../.$.&*..|
-000002e0 5d 7f 84 22 c0 9f 12 07 8e 49 a9 a3 ca 54 45 e0 |]..".....I...TE.|
-000002f0 38 58 b2 f7 3a c8 d8 08 4e ae 1b da 5f 3c 80 21 |8X..:...N..._<.!|
-00000300 67 3c 28 b1 19 b4 5d b1 d6 f7 79 bd 5a cc 4f f8 |g<(...]...y.Z.O.|
-00000310 b1 16 9c fc 79 53 f2 06 a1 fd 14 03 03 00 01 01 |....yS..........|
-00000320 16 03 03 00 40 f5 e5 0e b1 54 f8 2f f4 3d c3 03 |....@....T./.=..|
-00000330 08 4e 48 67 5c e5 71 de ae 38 3b a8 15 15 99 7c |.NHg\.q..8;....||
-00000340 23 71 0a 3e d3 e2 52 36 ba ac 67 6d 9c b1 24 5b |#q.>..R6..gm..$[|
-00000350 6e be ac 82 e2 9d be 00 15 10 93 b8 3a 13 1f 39 |n...........:..9|
-00000360 f9 a4 69 7d ba |..i}.|
+00000000 16 03 03 00 07 0b 00 00 03 00 00 00 16 03 03 00 |................|
+00000010 86 10 00 00 82 00 80 2e 43 3b 39 9a be ef de 53 |........C;9....S|
+00000020 4a 94 a3 a3 bd 92 93 44 e7 27 be f9 97 c9 1b fd |J......D.'......|
+00000030 22 1b 6a 6c c3 79 87 45 01 a8 e0 ee 34 5a 23 61 |".jl.y.E....4Z#a|
+00000040 25 e4 06 88 fd b5 0d a3 dc e4 64 02 14 7e 47 fb |%.........d..~G.|
+00000050 3b 88 7d 7f a9 e2 63 64 1a 15 db c6 de 03 a0 ed |;.}...cd........|
+00000060 3c 33 b6 2f cc 2a fe 44 8f d7 be 61 0f e5 ea 2f |<3./.*.D...a.../|
+00000070 63 7f c1 fa bc de d3 fd 10 3e 89 48 2c cf ab 57 |c........>.H,..W|
+00000080 ee b4 04 11 8c 2e 2d ec b9 e5 d0 ac e7 b7 4d 60 |......-.......M`|
+00000090 fd fe 7f 88 f1 35 9b 14 03 03 00 01 01 16 03 03 |.....5..........|
+000000a0 00 40 ae 7d 3a a0 36 5b 4c b2 fe d7 3d 8b e8 45 |.@.}:.6[L...=..E|
+000000b0 f3 43 ae c4 d0 62 74 b5 44 38 3e f0 fd 68 f2 0b |.C...bt.D8>..h..|
+000000c0 4a e6 b9 e8 59 4d 84 6a cd a3 83 5a 95 8f 7a a8 |J...YM.j...Z..z.|
+000000d0 32 db b7 cd ef e8 5a dc 25 e5 1b 5f 02 7b e7 02 |2.....Z.%.._.{..|
+000000e0 fd d1 |..|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....|
-00000010 00 00 00 00 00 00 00 00 00 00 00 0c ec ca e3 53 |...............S|
-00000020 35 9f 4d ed ec 1b c4 53 51 42 01 83 7b 4e dd 8b |5.M....SQB..{N..|
-00000030 1c 78 b7 22 46 0b da f3 b4 c2 21 a9 7d 43 b4 53 |.x."F.....!.}C.S|
-00000040 fb 50 8f f6 95 74 16 c7 f9 fe df 17 03 03 00 40 |.P...t.........@|
+00000010 00 00 00 00 00 00 00 00 00 00 00 18 1c 14 83 35 |...............5|
+00000020 c3 40 2a 62 72 5d 6f 23 98 1e 1c cf 3c 1f 76 f0 |.@*br]o#....<.v.|
+00000030 49 cb 62 80 32 e6 d8 6d 95 9b 58 47 2d 65 ff 25 |I.b.2..m..XG-e.%|
+00000040 00 99 db 92 58 e0 e9 09 90 c3 72 17 03 03 00 40 |....X.....r....@|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
-00000060 f0 c3 31 40 61 36 8c a3 28 47 d7 b0 5c 66 b2 e0 |..1@a6..(G..\f..|
-00000070 72 4c 3f f6 91 0a 70 4b 1b ce ce 73 87 42 89 f5 |rL?...pK...s.B..|
-00000080 ce 47 b3 28 17 e7 1b b7 25 7c c1 14 6c 8d 23 40 |.G.(....%|..l.#@|
+00000060 b5 9c b1 d1 30 6e 93 66 69 07 47 f6 31 ad e9 e1 |....0n.fi.G.1...|
+00000070 c5 d4 5c 98 ac 00 41 cd 84 c3 56 61 b1 36 fd ad |..\...A...Va.6..|
+00000080 7f c6 b1 27 1d ef b9 ba 43 a1 7e f4 71 d9 55 6e |...'....C.~.q.Un|
00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........|
-000000a0 00 00 00 00 00 b4 53 25 de b7 d8 e3 15 17 74 79 |......S%......ty|
-000000b0 cf d2 cb 77 c9 f2 d2 17 84 99 6c ff ce 8a 14 80 |...w......l.....|
-000000c0 aa bd bc f6 08 |.....|
+000000a0 00 00 00 00 00 3f 1a f4 80 31 9b 60 c0 28 76 79 |.....?...1.`.(vy|
+000000b0 c1 8f 65 f6 d3 b6 6d 99 6d 11 fa bc a6 b8 bf 7f |..e...m.m.......|
+000000c0 8b ca c5 a1 cd |.....|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndPKCS1v15Given b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndPKCS1v15Given
index 750cff3ab9..1bb602d078 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndPKCS1v15Given
+++ b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndPKCS1v15Given
@@ -1,11 +1,14 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 6b 01 00 00 67 03 03 b7 55 25 a3 57 |....k...g...U%.W|
-00000010 90 c6 59 4a 6e a0 62 cf aa d0 c0 6b 56 d7 a7 a4 |..YJn.b....kV...|
-00000020 75 43 5d c9 c2 e8 96 fd eb f1 e2 00 00 04 00 2f |uC]............/|
-00000030 00 ff 01 00 00 3a 00 00 00 0e 00 0c 00 00 09 31 |.....:.........1|
+00000000 16 03 01 00 97 01 00 00 93 03 03 b1 59 5d 29 7f |............Y]).|
+00000010 90 9c ef 9d ae 0a 91 6c ab 05 fb 58 f7 79 9b c4 |.......l...X.y..|
+00000020 22 e1 ab 55 5c ea d1 24 27 2a 63 00 00 04 00 2f |"..U\..$'*c..../|
+00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1|
00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
-00000060 00 16 00 00 00 17 00 00 00 0d 00 04 00 02 04 01 |................|
+00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....|
+00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................|
+00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................|
+00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............|
>>> Flow 2 (server to client)
00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
@@ -48,10 +51,9 @@
00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
-00000290 3b e9 fa e7 16 03 03 00 23 0d 00 00 1f 02 01 40 |;.......#......@|
-000002a0 00 18 08 04 04 03 08 07 08 05 08 06 04 01 05 01 |................|
-000002b0 06 01 05 03 06 03 02 01 02 03 00 00 16 03 03 00 |................|
-000002c0 04 0e 00 00 00 |.....|
+00000290 3b e9 fa e7 16 03 03 00 1d 0d 00 00 19 02 01 40 |;..............@|
+000002a0 00 12 04 01 04 03 08 07 05 01 06 01 05 03 06 03 |................|
+000002b0 02 01 02 03 00 00 16 03 03 00 04 0e 00 00 00 |...............|
>>> Flow 3 (client to server)
00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0|
00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.|
@@ -85,40 +87,40 @@
000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......|
000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{|
000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....|
-00000200 e5 35 16 03 03 00 86 10 00 00 82 00 80 a2 92 cd |.5..............|
-00000210 ec 2d c5 10 6e 42 8b 0a b3 fc c5 84 c6 b0 9e 61 |.-..nB.........a|
-00000220 6c bd 97 9e 63 7c 94 5f 4c 91 ad c1 c1 5e d7 a4 |l...c|._L....^..|
-00000230 3e 44 23 c0 fd 5b ea ef fa 68 b9 93 a1 83 b6 ed |>D#..[...h......|
-00000240 df 97 1e 39 04 22 d5 8c 44 2f 91 dd fd aa 24 91 |...9."..D/....$.|
-00000250 a3 e3 a7 c3 ab 61 71 80 8d b1 fd b9 fa cc 0e 8d |.....aq.........|
-00000260 66 e1 9a cc da 95 9f aa 00 c9 a1 24 65 54 86 74 |f..........$eT.t|
-00000270 5b ca b6 dc 5b 96 64 ad 60 18 f5 9e 27 dd b1 dc |[...[.d.`...'...|
-00000280 47 5a 32 36 41 86 0e db ab e2 67 7f 04 16 03 03 |GZ26A.....g.....|
-00000290 00 88 0f 00 00 84 04 01 00 80 5d 71 bd f9 35 58 |..........]q..5X|
-000002a0 03 e9 8e 20 e0 bc 70 9e ba ba 82 d9 27 b7 8d 32 |... ..p.....'..2|
-000002b0 c8 9a 57 c5 53 af f6 1f 99 75 4e 3d 58 c1 4d 06 |..W.S....uN=X.M.|
-000002c0 1a c9 a2 1d de a0 73 9a c6 76 0e 93 d1 fa 00 08 |......s..v......|
-000002d0 84 d8 4b 4b 80 59 77 ef fe eb d6 7f 53 6c db e8 |..KK.Yw.....Sl..|
-000002e0 60 51 b5 48 41 ba 97 71 f4 b6 4b 94 e5 bd d5 ce |`Q.HA..q..K.....|
-000002f0 a6 7c ee f2 1f 84 48 4f d2 27 b2 24 73 b3 c3 0f |.|....HO.'.$s...|
-00000300 ea 9f cf 31 de 25 71 1c 91 ec b4 79 2a 47 d0 c3 |...1.%q....y*G..|
-00000310 56 cc 30 54 12 fe 59 a4 55 ab 14 03 03 00 01 01 |V.0T..Y.U.......|
-00000320 16 03 03 00 40 2b 02 10 71 bb 12 3a 19 18 f0 28 |....@+..q..:...(|
-00000330 ea 5e 65 e7 ea d6 64 21 21 b4 c2 04 9b 38 6f 42 |.^e...d!!....8oB|
-00000340 dc f7 92 3d 9a ce 4f 9f bd ee 6d 7b 1c cd d7 4b |...=..O...m{...K|
-00000350 80 ba 72 09 66 3e 73 00 88 1d 28 3c 59 1d 4b 71 |..r.f>s...(....|
+00000200 e5 35 16 03 03 00 86 10 00 00 82 00 80 aa ad 37 |.5.............7|
+00000210 05 40 cc 04 19 d0 de aa 25 9f 20 4e ce 74 f5 70 |.@......%. N.t.p|
+00000220 ae 17 f0 29 a4 37 ac 84 67 06 da 17 9f 26 dc ab |...).7..g....&..|
+00000230 96 c4 13 d6 a5 e5 93 57 70 17 f2 f1 fb 0e a2 e4 |.......Wp.......|
+00000240 85 82 ea 63 ab 6f 6e 1f 0b 12 e7 35 ce b0 79 da |...c.on....5..y.|
+00000250 95 cf de 7d 8b be 5e cc d5 8e 00 02 fe 67 61 b4 |...}..^......ga.|
+00000260 69 2c 09 90 ae 6c df 29 45 67 79 8e fe 91 fb 3e |i,...l.)Egy....>|
+00000270 1e ec 95 11 6c 6a 15 2f 93 59 41 34 8a 35 b0 7c |....lj./.YA4.5.||
+00000280 22 ee bb 99 cc 3d 05 1f 7b 1b 96 f6 bc 16 03 03 |"....=..{.......|
+00000290 00 88 0f 00 00 84 04 01 00 80 a5 b1 55 c7 8c 86 |............U...|
+000002a0 c1 c2 60 2d ad 40 f1 ca 56 25 39 e7 c1 83 7f 16 |..`-.@..V%9.....|
+000002b0 08 6a c9 23 6a 82 73 63 bf 1a 32 de 85 82 2a bc |.j.#j.sc..2...*.|
+000002c0 a0 99 db ea 34 26 27 8f c6 36 b7 53 b5 76 75 2e |....4&'..6.S.vu.|
+000002d0 48 26 bb b0 65 55 68 57 12 cb 9c 93 96 fc 88 fc |H&..eUhW........|
+000002e0 73 56 c1 1e 04 ae 41 aa ad b7 f8 58 7a 55 a9 74 |sV....A....XzU.t|
+000002f0 5b b5 12 08 25 ef c1 0f 4c 39 7b c5 07 d9 34 66 |[...%...L9{...4f|
+00000300 15 d3 76 a2 65 8c 4c ce 9a 89 0f 1f a9 5f d0 93 |..v.e.L......_..|
+00000310 3e ed 92 be 42 4c fe 23 ea 40 14 03 03 00 01 01 |>...BL.#.@......|
+00000320 16 03 03 00 40 89 ff 92 80 9b 37 4b 6f 8f 3a 22 |....@.....7Ko.:"|
+00000330 aa ab 60 1f 4d 49 ba 75 b2 dc 83 06 22 5a 89 5d |..`.MI.u...."Z.]|
+00000340 1f 95 fa 0c 18 80 a0 5a 96 09 93 7b 06 cb 6c aa |.......Z...{..l.|
+00000350 74 79 ea ae 02 e7 a7 c9 44 0b 6d f7 f7 b2 04 8f |ty......D.m.....|
+00000360 6e 46 2d f1 6b |nF-.k|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....|
-00000010 00 00 00 00 00 00 00 00 00 00 00 9a 35 84 25 85 |............5.%.|
-00000020 58 51 15 f1 61 6a f7 92 a7 0e 1a 62 3f 73 08 3c |XQ..aj.....b?s.<|
-00000030 48 e1 f6 75 07 76 4a d4 fc 5d ff 81 d8 39 81 96 |H..u.vJ..]...9..|
-00000040 0d 13 be 17 3a 94 4b 9e 22 bf cc 17 03 03 00 40 |....:.K."......@|
+00000010 00 00 00 00 00 00 00 00 00 00 00 67 84 0f 78 e0 |...........g..x.|
+00000020 91 c8 d4 4b 1c 69 95 f8 6c 30 23 55 2b 04 4b 24 |...K.i..l0#U+.K$|
+00000030 58 0a 46 06 94 00 72 95 77 77 4c d7 82 87 69 0a |X.F...r.wwL...i.|
+00000040 4c 78 8a 12 76 27 ae 65 c9 20 c4 17 03 03 00 40 |Lx..v'.e. .....@|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
-00000060 a4 83 1d d8 97 26 43 9f 99 37 14 4d bf 3a 1e 3e |.....&C..7.M.:.>|
-00000070 0c 30 ff 88 b1 22 0d e6 bc a6 2c ce 16 8c 6d d6 |.0..."....,...m.|
-00000080 c8 90 96 34 bb 63 08 4c 18 d2 f7 d3 63 ab aa 7f |...4.c.L....c...|
+00000060 13 3b e0 4b cd 52 d3 6c 90 91 37 38 1d 9c 75 a2 |.;.K.R.l..78..u.|
+00000070 02 a3 3f 1a 43 6c aa f4 17 da 4e 01 d7 8c 74 5e |..?.Cl....N...t^|
+00000080 f4 d3 61 cf 3c 7f 55 73 17 e7 d1 c3 a0 da 24 c4 |..a.<.Us......$.|
00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........|
-000000a0 00 00 00 00 00 00 35 b2 33 d0 f1 dd 5b dd c7 8e |......5.3...[...|
-000000b0 62 eb cc 0e 7c a0 93 74 d9 65 d3 6e 8c 87 f0 36 |b...|..t.e.n...6|
-000000c0 0a 76 0a d8 63 |.v..c|
+000000a0 00 00 00 00 00 28 75 97 89 88 21 2e fe 9b 81 87 |.....(u...!.....|
+000000b0 2a 37 f0 81 9f 76 a2 27 a4 78 69 30 87 2c 09 6e |*7...v.'.xi0.,.n|
+000000c0 55 90 fb ab b6 |U....|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedNotGiven b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedNotGiven
index 833d331697..5711a3f6b6 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedNotGiven
+++ b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedNotGiven
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 97 01 00 00 93 03 03 af 6e 31 55 9f |............n1U.|
-00000010 fb 22 73 ce a2 0a b6 a3 3e 13 14 83 09 8c e2 98 |."s.....>.......|
-00000020 c3 6f a3 80 79 e4 7c c5 ff 4e a4 00 00 04 00 2f |.o..y.|..N...../|
+00000000 16 03 01 00 97 01 00 00 93 03 03 67 52 bd 6c 6c |...........gR.ll|
+00000010 76 8e 81 75 11 23 27 99 07 bf 64 96 13 0b 85 78 |v..u.#'...d....x|
+00000020 b4 5b b9 b0 a8 b5 fc 87 ef f2 0e 00 00 04 00 2f |.[............./|
00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1|
00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
@@ -51,37 +51,36 @@
00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
-00000290 3b e9 fa e7 16 03 03 00 23 0d 00 00 1f 02 01 40 |;.......#......@|
-000002a0 00 18 08 04 04 03 08 07 08 05 08 06 04 01 05 01 |................|
-000002b0 06 01 05 03 06 03 02 01 02 03 00 00 16 03 03 00 |................|
-000002c0 04 0e 00 00 00 |.....|
+00000290 3b e9 fa e7 16 03 03 00 1d 0d 00 00 19 02 01 40 |;..............@|
+000002a0 00 12 04 01 04 03 08 07 05 01 06 01 05 03 06 03 |................|
+000002b0 02 01 02 03 00 00 16 03 03 00 04 0e 00 00 00 |...............|
>>> Flow 3 (client to server)
00000000 16 03 03 00 07 0b 00 00 03 00 00 00 16 03 03 00 |................|
-00000010 86 10 00 00 82 00 80 5b 78 d7 5b 4f e3 55 1f 34 |.......[x.[O.U.4|
-00000020 60 be e9 68 07 28 c0 42 b1 ff 31 2f ac 41 19 1e |`..h.(.B..1/.A..|
-00000030 5b c3 7a d4 e4 59 49 4a ed be b9 95 6c d5 58 4a |[.z..YIJ....l.XJ|
-00000040 4a f5 ea f7 00 39 8b f0 6a c6 5a 5f 4e 53 40 20 |J....9..j.Z_NS@ |
-00000050 70 88 5a d4 e0 9e 25 a2 d5 50 1e 22 ed 02 14 f9 |p.Z...%..P."....|
-00000060 eb 32 dd d2 9c 66 20 4c 4d a1 97 91 48 6f 39 cf |.2...f LM...Ho9.|
-00000070 ae e4 33 4e d9 4d 96 fa 13 39 1d b4 16 85 08 4a |..3N.M...9.....J|
-00000080 8f dc b6 f3 19 05 de 16 aa 3d 5e 71 e7 38 ff 3d |.........=^q.8.=|
-00000090 77 5b 63 df d2 32 3d 14 03 03 00 01 01 16 03 03 |w[c..2=.........|
-000000a0 00 40 d7 df c5 1f ec 3c 10 77 53 78 8f c7 8a 79 |.@.....<.wSx...y|
-000000b0 17 3a 31 57 6f e3 e8 85 3f 33 75 0a f8 a8 4d cc |.:1Wo...?3u...M.|
-000000c0 70 0a d9 d0 8b 87 b5 d4 74 c8 8d 30 3b 80 bd 8c |p.......t..0;...|
-000000d0 cb 42 6f e9 e5 c9 a6 28 16 6d 7a d8 13 cb 57 30 |.Bo....(.mz...W0|
-000000e0 3d 77 |=w|
+00000010 86 10 00 00 82 00 80 31 7f 5d 8c 38 ee d7 05 14 |.......1.].8....|
+00000020 4c 0f 9d 01 2d 80 e9 71 0a 51 69 7b af 75 43 76 |L...-..q.Qi{.uCv|
+00000030 d7 eb 18 14 11 00 82 df f4 e8 d1 83 5e 32 60 6e |............^2`n|
+00000040 49 6d 1a 3f b2 ac 85 9f f3 3c 3c cd f2 0d a8 e0 |Im.?.....<<.....|
+00000050 06 f3 6f 96 18 a0 76 06 c3 73 89 b4 de 30 ed 7b |..o...v..s...0.{|
+00000060 7e 71 2d 13 88 43 ff a7 42 bb 2c 17 73 5f 67 8f |~q-..C..B.,.s_g.|
+00000070 68 e7 52 84 72 34 08 69 c6 f5 1b e9 2b 42 93 90 |h.R.r4.i....+B..|
+00000080 3f 76 f3 89 9f 70 65 da 9c ce 8c bf a3 38 65 e3 |?v...pe......8e.|
+00000090 cf b9 f9 c6 d9 86 a5 14 03 03 00 01 01 16 03 03 |................|
+000000a0 00 40 e7 dd bf f7 33 bc f2 90 a3 43 fa 43 ec 7e |.@....3....C.C.~|
+000000b0 e6 06 28 c1 3f 83 c5 50 65 6d 6b e7 37 cf e7 4b |..(.?..Pemk.7..K|
+000000c0 85 34 3b df 4f 48 82 30 d0 43 f7 00 c4 3f 03 dd |.4;.OH.0.C...?..|
+000000d0 ef c0 d4 04 48 b4 9b ec f0 65 7c 2a bc 87 24 5f |....H....e|*..$_|
+000000e0 7a d5 |z.|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....|
-00000010 00 00 00 00 00 00 00 00 00 00 00 93 43 99 29 17 |............C.).|
-00000020 5b 96 2e 5b 22 fc 53 47 b2 85 76 46 d9 1a f2 12 |[..[".SG..vF....|
-00000030 58 e0 0e 0d 0f dc 88 a2 0f b1 00 39 ed d7 99 58 |X..........9...X|
-00000040 99 7b c5 ba 91 a3 72 05 1e 9e c2 17 03 03 00 40 |.{....r........@|
+00000010 00 00 00 00 00 00 00 00 00 00 00 da 0a 2a 09 ef |.............*..|
+00000020 39 6c c9 6d cc c3 ae 56 cd e1 a8 47 26 ec 9c b7 |9l.m...V...G&...|
+00000030 50 eb 2e 10 d4 15 3e 5e cc 65 78 2e 47 bf 18 e8 |P.....>^.ex.G...|
+00000040 62 59 bb 7c b7 2c 28 b1 ea 82 10 17 03 03 00 40 |bY.|.,(........@|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
-00000060 f3 ff e7 4d b6 ca 7c 95 ed 96 13 88 70 b3 2c 8b |...M..|.....p.,.|
-00000070 9b 0c 51 77 75 16 b4 c0 df 9f 1a c4 86 68 82 10 |..Qwu........h..|
-00000080 41 c7 1e e5 92 49 ce a3 6f c3 bc 0a 91 04 b6 fa |A....I..o.......|
+00000060 9e 53 10 86 89 0c 8f 14 0c 22 6c 32 33 34 64 83 |.S......."l234d.|
+00000070 28 7c 02 b3 59 b7 b2 60 5a ec f2 a7 1a 21 04 dd |(|..Y..`Z....!..|
+00000080 2a c0 ca 68 07 85 8f 7d 6b da 26 97 52 91 40 e8 |*..h...}k.&.R.@.|
00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........|
-000000a0 00 00 00 00 00 2c e7 ff bb 3a f5 00 08 d3 8c 3f |.....,...:.....?|
-000000b0 89 bf 97 de fc c4 91 59 2f 7b b3 b8 ea d0 b1 05 |.......Y/{......|
-000000c0 ca ff d0 78 9f |...x.|
+000000a0 00 00 00 00 00 f4 ae 69 5a bc af 94 f9 7f 60 d1 |.......iZ.....`.|
+000000b0 36 83 e7 23 13 79 ae c1 5a 3b 35 d0 ed 16 12 ac |6..#.y..Z;5.....|
+000000c0 52 b5 4e eb 31 |R.N.1|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-ExportKeyingMaterial b/src/crypto/tls/testdata/Server-TLSv12-ExportKeyingMaterial
index 7d7ee63861..b777c62415 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-ExportKeyingMaterial
+++ b/src/crypto/tls/testdata/Server-TLSv12-ExportKeyingMaterial
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 cf 01 00 00 cb 03 03 79 bf 0b 29 ec |...........y..).|
-00000010 6a 0b 84 1e 2c d5 bf 30 b7 55 b9 7b 77 69 8f 9a |j...,..0.U.{wi..|
-00000020 71 34 c9 83 d1 af de 50 d5 d6 fc 00 00 38 c0 2c |q4.....P.....8.,|
+00000000 16 03 01 00 cf 01 00 00 cb 03 03 54 13 f1 1a dc |...........T....|
+00000010 39 72 b7 e7 86 ac 83 df 9b 75 9e 71 40 7a 14 b3 |9r.......u.q@z..|
+00000020 fc ad 99 d1 8a 4f d0 d9 a3 f0 3d 00 00 38 c0 2c |.....O....=..8.,|
00000030 c0 30 00 9f cc a9 cc a8 cc aa c0 2b c0 2f 00 9e |.0.........+./..|
00000040 c0 24 c0 28 00 6b c0 23 c0 27 00 67 c0 0a c0 14 |.$.(.k.#.'.g....|
00000050 00 39 c0 09 c0 13 00 33 00 9d 00 9c 00 3d 00 3c |.9.....3.....=.<|
@@ -58,38 +58,38 @@
00000290 84 5c 21 d3 3b e9 fa e7 16 03 03 00 ac 0c 00 00 |.\!.;...........|
000002a0 a8 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 28 da |.... /.}.G.bC.(.|
000002b0 ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 99 |._.).0..........|
-000002c0 5f 58 cb 3b 74 08 04 00 80 36 12 82 aa d1 40 60 |_X.;t....6....@`|
-000002d0 6c fb da 0b 04 f6 23 94 3f 3d 8c a5 f4 fe ed 1f |l.....#.?=......|
-000002e0 be 25 85 94 c9 2f 19 64 52 2b 8a 13 29 52 ae 77 |.%.../.dR+..)R.w|
-000002f0 ca 24 40 f1 31 1c f3 aa 33 29 1f cc b0 a3 8b e6 |.$@.1...3)......|
-00000300 c3 26 90 e4 11 48 e6 91 a6 5d 5e c6 18 8d 4f 2c |.&...H...]^...O,|
-00000310 21 be bc 13 4d de bb 68 42 0b e1 29 3e 8e fc b9 |!...M..hB..)>...|
-00000320 45 ed c4 87 ed 62 1d 04 c0 4f d5 f5 94 62 65 07 |E....b...O...be.|
-00000330 8c f0 00 3d 47 f6 f5 93 e3 a9 69 ce 79 8a e5 24 |...=G.....i.y..$|
-00000340 01 d4 28 e6 f5 f5 a9 7e ab 16 03 03 00 04 0e 00 |..(....~........|
+000002c0 5f 58 cb 3b 74 04 01 00 80 8e 2b 18 d7 2c 6d 91 |_X.;t.....+..,m.|
+000002d0 12 b3 ba 39 20 4f 43 60 08 d3 63 6e 55 01 50 3c |...9 OC`..cnU.P<|
+000002e0 2b 6d 09 ca 27 d6 f7 42 d1 74 19 e1 6b 06 93 06 |+m..'..B.t..k...|
+000002f0 6e e6 c4 23 cc 1b c8 de 8f 30 c2 4d 22 36 10 df |n..#.....0.M"6..|
+00000300 32 cb f3 4e ec 9a b1 d6 63 7d 11 4e 58 d2 b7 7a |2..N....c}.NX..z|
+00000310 70 31 4b 92 3e 27 ba f0 85 ca 7d 43 c7 68 04 6a |p1K.>'....}C.h.j|
+00000320 fa c4 ac c1 16 8b 18 c9 2e 94 2e c2 a6 f3 f0 f3 |................|
+00000330 fb 8a 21 6d 4f 3d bc 0f fa 21 fd d5 78 57 6c 38 |..!mO=...!..xWl8|
+00000340 09 48 64 d6 ca b6 31 3c 39 16 03 03 00 04 0e 00 |.Hd...1<9.......|
00000350 00 00 |..|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 25 10 00 00 21 20 ea 09 8a 21 18 89 |....%...! ...!..|
-00000010 7d 4f ee 95 8e 6c 1a 07 22 59 e7 f9 05 41 2a c2 |}O...l.."Y...A*.|
-00000020 ad 51 71 9c a4 0e 08 eb 49 71 14 03 03 00 01 01 |.Qq.....Iq......|
-00000030 16 03 03 00 28 6a ab 19 f6 b6 cb 70 34 ee 73 d2 |....(j.....p4.s.|
-00000040 05 bf 99 37 44 b7 f9 1e b1 8a 3d f9 13 bd 0c 77 |...7D.....=....w|
-00000050 02 b0 64 08 f9 d9 f2 96 b4 5b 87 ff 0b |..d......[...|
+00000000 16 03 03 00 25 10 00 00 21 20 af 4c 6e 57 5e f7 |....%...! .LnW^.|
+00000010 49 e2 89 33 f9 47 59 7c 81 5c 63 74 cd 27 6a 65 |I..3.GY|.\ct.'je|
+00000020 b6 55 d1 72 ad 60 08 d0 c6 6a 14 03 03 00 01 01 |.U.r.`...j......|
+00000030 16 03 03 00 28 69 f2 a5 05 8c a5 a7 5f 8f 8b cf |....(i......_...|
+00000040 7a 18 fb f4 45 5e 1f f8 ba 60 2e fa c6 8c c6 57 |z...E^...`.....W|
+00000050 89 ac 8a 85 71 00 21 65 f3 a6 99 5d 3b |....q.!e...];|
>>> Flow 4 (server to client)
00000000 16 03 03 00 82 04 00 00 7e 00 00 00 00 00 78 50 |........~.....xP|
00000010 46 ad c1 db a8 38 86 7b 2b bb fd d0 c3 42 3e 00 |F....8.{+....B>.|
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................|
-00000030 6f ec 80 83 61 db f0 ce 92 57 a1 db 00 84 5e 78 |o...a....W....^x|
-00000040 0e f7 97 3e f5 f0 e8 73 d6 b0 a7 28 8f bb 24 b1 |...>...s...(..$.|
-00000050 a9 3f 60 a3 7a f2 c1 a6 12 0e 69 3b 72 89 dd 36 |.?`.z.....i;r..6|
-00000060 d8 ff 80 5d 71 33 94 32 01 77 ce 77 5e ac b8 05 |...]q3.2.w.w^...|
-00000070 69 68 e5 81 51 4d 52 f6 e9 c5 cd 70 56 23 3c aa |ih..QMR....pV#<.|
-00000080 2e c6 a2 d6 e3 5f 29 14 03 03 00 01 01 16 03 03 |....._).........|
-00000090 00 28 00 00 00 00 00 00 00 00 59 27 e3 e7 05 60 |.(........Y'...`|
-000000a0 03 68 93 6d 28 1d 8e 7f f1 c8 a6 eb b4 57 a5 22 |.h.m(........W."|
-000000b0 98 ce 7e 56 00 44 fe d5 5e 26 17 03 03 00 25 00 |..~V.D..^&....%.|
-000000c0 00 00 00 00 00 00 01 9d 87 53 e9 29 e4 d7 45 29 |.........S.)..E)|
-000000d0 ef 71 a6 7e b8 99 d4 4f 08 da 11 6b 9b d2 20 b9 |.q.~...O...k.. .|
-000000e0 c4 ae 7f 84 15 03 03 00 1a 00 00 00 00 00 00 00 |................|
-000000f0 02 06 17 a2 45 91 d0 b0 50 aa 8f a2 f1 8b 48 cf |....E...P.....H.|
-00000100 40 87 a4 |@..|
+00000030 6f ec 80 83 61 0d 24 39 c2 e0 e0 85 93 37 1f 40 |o...a.$9.....7.@|
+00000040 0a 0e a7 45 0e 81 37 6c 7a 11 ed e6 c0 f1 69 23 |...E..7lz.....i#|
+00000050 df 14 01 ff ff 52 2f ac da 15 14 5b a2 07 c8 bc |.....R/....[....|
+00000060 82 4f 2b 5b 71 33 94 09 17 b4 83 76 62 b7 46 9d |.O+[q3.....vb.F.|
+00000070 6f 0d de c2 8b a8 ce 6e 2e df f4 a3 59 fc af f2 |o......n....Y...|
+00000080 fe 3f 1e d6 75 b5 63 14 03 03 00 01 01 16 03 03 |.?..u.c.........|
+00000090 00 28 00 00 00 00 00 00 00 00 ae 8b f0 21 94 08 |.(...........!..|
+000000a0 ec aa a6 f5 40 81 5a a2 42 f7 0a 9b 6b e6 8d 7a |....@.Z.B...k..z|
+000000b0 44 e1 85 41 fc 83 f0 e1 c0 c2 17 03 03 00 25 00 |D..A..........%.|
+000000c0 00 00 00 00 00 00 01 c4 a7 e5 72 e4 09 d0 21 b8 |..........r...!.|
+000000d0 99 ae f0 6a 2c 1c a4 ca ae 44 79 92 ae 25 f8 37 |...j,....Dy..%.7|
+000000e0 d8 49 f3 21 15 03 03 00 1a 00 00 00 00 00 00 00 |.I.!............|
+000000f0 02 76 b5 79 33 82 76 50 e3 2b 03 e9 b8 14 2d 51 |.v.y3.vP.+....-Q|
+00000100 ac f9 6d |..m|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-P256 b/src/crypto/tls/testdata/Server-TLSv12-P256
index 5295d60a8d..4e302b374c 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-P256
+++ b/src/crypto/tls/testdata/Server-TLSv12-P256
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 8f 01 00 00 8b 03 03 e8 ef f7 4f 44 |..............OD|
-00000010 1a 63 08 10 fe aa 68 d5 75 18 f5 6c de 83 50 d2 |.c....h.u..l..P.|
-00000020 bb 86 6e 48 d0 cb 97 c4 56 46 9f 00 00 04 c0 2f |..nH....VF...../|
+00000000 16 03 01 00 8f 01 00 00 8b 03 03 b1 a0 04 30 1e |..............0.|
+00000010 a1 09 cb 31 c4 1a 15 e7 a6 06 b5 fb 51 da d6 01 |...1........Q...|
+00000020 dc c0 cc 17 85 e5 c4 c6 b1 da be 00 00 04 c0 2f |.............../|
00000030 00 ff 01 00 00 5e 00 00 00 0e 00 0c 00 00 09 31 |.....^.........1|
00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
00000050 00 0a 00 04 00 02 00 17 00 16 00 00 00 17 00 00 |................|
@@ -56,30 +56,30 @@
000002b0 5b 12 2e 8f 09 67 fd a7 24 20 3e b2 56 1c ce 97 |[....g..$ >.V...|
000002c0 28 5e f8 2b 2d 4f 9e f1 07 9f 6c 4b 5b 83 56 e2 |(^.+-O....lK[.V.|
000002d0 32 42 e9 58 b6 d7 49 a6 b5 68 1a 41 03 56 6b dc |2B.X..I..h.A.Vk.|
-000002e0 5a 89 08 04 00 80 b8 fd 6d 56 36 b6 b3 8a 6c cb |Z.......mV6...l.|
-000002f0 6b 52 79 28 45 97 1e 97 1b 7f 96 2e e0 b0 23 af |kRy(E.........#.|
-00000300 cb 13 cf dc e6 11 2b 04 88 08 56 2d a4 3a b1 7e |......+...V-.:.~|
-00000310 79 b5 de 25 35 6b 82 98 d9 9e be 99 d4 37 bf 19 |y..%5k.......7..|
-00000320 bb 0e 25 86 b6 19 e8 58 de ab 63 ed 3c 09 d6 6b |..%....X..c.<..k|
-00000330 f5 da 16 e6 75 5d e7 7b e5 54 1b de 03 1d cd fb |....u].{.T......|
-00000340 3d 9f 24 cc ff 07 d2 cb f2 0b 4a 61 57 ec 84 dd |=.$.......JaW...|
-00000350 92 44 da 71 a2 31 ba 2e 68 19 2b ee 90 19 12 a5 |.D.q.1..h.+.....|
-00000360 59 53 28 9d 0a 87 16 03 03 00 04 0e 00 00 00 |YS(............|
+000002e0 5a 89 04 01 00 80 bb 79 4d c9 d6 77 df 13 46 e6 |Z......yM..w..F.|
+000002f0 82 30 7a 03 2e 58 a8 bf 2a 53 c4 58 0a 9a 9a 0f |.0z..X..*S.X....|
+00000300 72 51 a9 91 5b f7 88 f1 de 28 1d 56 79 2c da 89 |rQ..[....(.Vy,..|
+00000310 a4 de 25 65 20 f7 a1 a4 b1 ff 3c 5a cd 67 24 9b |..%e .....>> Flow 3 (client to server)
-00000000 16 03 03 00 46 10 00 00 42 41 04 01 9c 4d 77 6b |....F...BA...Mwk|
-00000010 ce 2f a7 9e 8b ae ba 9d f2 6d c8 9e 0e 54 07 c9 |./.......m...T..|
-00000020 6d e3 58 67 c6 a8 9a a5 c2 f7 27 26 84 36 e1 6f |m.Xg......'&.6.o|
-00000030 e3 a1 89 50 7c e0 e6 88 06 b9 94 16 d8 23 cb 2e |...P|........#..|
-00000040 ff 62 67 1e 93 cb d6 1d f5 43 79 14 03 03 00 01 |.bg......Cy.....|
-00000050 01 16 03 03 00 28 83 36 85 d0 b7 23 5e 7d 0a 33 |.....(.6...#^}.3|
-00000060 41 0f bd 31 4d a0 32 6a c2 67 93 cc 8f 41 f5 bd |A..1M.2j.g...A..|
-00000070 b2 57 af 5c 90 d6 17 24 be 76 6b b4 13 ca |.W.\...$.vk...|
+00000000 16 03 03 00 46 10 00 00 42 41 04 1b 28 eb 97 c5 |....F...BA..(...|
+00000010 63 cc e1 64 31 f9 b3 5c 61 d8 d9 28 f9 1e 9a 4b |c..d1..\a..(...K|
+00000020 09 2a 5a b9 64 42 15 d3 06 80 64 67 93 63 e2 c6 |.*Z.dB....dg.c..|
+00000030 51 05 3c 8b 32 41 c2 a0 5a db 73 ba 77 86 7f 1b |Q.<.2A..Z.s.w...|
+00000040 2e b4 33 9c 20 0a 40 3a c6 90 f1 14 03 03 00 01 |..3. .@:........|
+00000050 01 16 03 03 00 28 56 75 52 fe f7 13 79 b6 c6 ba |.....(VuR...y...|
+00000060 f1 6a 6d f2 3d 2c 8c c2 70 3e 19 ba 32 34 88 02 |.jm.=,..p>..24..|
+00000070 73 d7 d5 db b9 52 21 32 34 fb 7e e8 17 49 |s....R!24.~..I|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....|
-00000010 00 00 00 80 6a 93 5b 7d 70 3c bc 7c f8 d6 4e 51 |....j.[}p<.|..NQ|
-00000020 5e 34 52 13 06 c4 aa 8c ed b5 9f aa c6 db c0 0d |^4R.............|
-00000030 67 97 36 17 03 03 00 25 00 00 00 00 00 00 00 01 |g.6....%........|
-00000040 d6 24 e8 21 4b 2c fb 5e 79 2d ca 7b 6d 44 dd 2d |.$.!K,.^y-.{mD.-|
-00000050 aa 3a 33 ee ea 6f e3 b7 cd c5 c3 1d 4a 15 03 03 |.:3..o......J...|
-00000060 00 1a 00 00 00 00 00 00 00 02 4f 71 74 9e 63 ad |..........Oqt.c.|
-00000070 d7 61 b9 c7 47 d6 44 9f b3 3d 49 34 |.a..G.D..=I4|
+00000010 00 00 00 41 e9 67 42 6b 79 56 59 80 41 c2 3a b9 |...A.gBkyVY.A.:.|
+00000020 b2 3a 06 0e 31 76 18 ba 86 a4 2d 1a 71 19 f3 f1 |.:..1v....-.q...|
+00000030 a3 bc b3 17 03 03 00 25 00 00 00 00 00 00 00 01 |.......%........|
+00000040 57 ee 6f 74 4b 56 28 ca 71 34 c0 85 0e 26 db 9c |W.otKV(.q4...&..|
+00000050 bb 8f 3c 3f 02 a3 d4 07 61 6e 20 93 5e 15 03 03 |......an .^...|
+00000060 00 1a 00 00 00 00 00 00 00 02 6e 3c 15 67 e9 53 |..........n<.g.S|
+00000070 1d 86 d8 3a ea 6b ac fc 42 bb db 8e |...:.k..B...|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-RSA-3DES b/src/crypto/tls/testdata/Server-TLSv12-RSA-3DES
index 8d1cadf85a..7bff8eceb0 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-RSA-3DES
+++ b/src/crypto/tls/testdata/Server-TLSv12-RSA-3DES
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 97 01 00 00 93 03 03 48 e2 22 70 f7 |...........H."p.|
-00000010 9a 24 ce 92 69 d1 ff fc c0 c9 ba b2 da 8e 83 7a |.$..i..........z|
-00000020 6e 8d 24 60 e2 e2 81 76 e6 72 37 00 00 04 00 0a |n.$`...v.r7.....|
+00000000 16 03 01 00 97 01 00 00 93 03 03 ed c3 64 89 19 |.............d..|
+00000010 3b fd 11 f4 d8 c9 2a d5 a8 8b 18 b5 92 cb ff c1 |;.....*.........|
+00000020 10 9a b1 a7 e4 d5 bc 78 39 29 30 00 00 04 00 0a |.......x9)0.....|
00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1|
00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
@@ -53,27 +53,27 @@
00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
00000290 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 86 10 00 00 82 00 80 20 44 e6 19 b2 |........... D...|
-00000010 c5 9f 95 af 90 29 b2 5c e9 c5 29 8c a2 bd 72 49 |.....).\..)...rI|
-00000020 8d c8 ea e8 cc bd 65 d9 1c fe 95 f0 60 0e ee 13 |......e.....`...|
-00000030 ea 7b bf 59 3c 08 21 07 73 b7 04 16 a7 a5 98 2e |.{.Y<.!.s.......|
-00000040 ab ee db c3 83 ea c8 b2 07 3e 76 a0 8f d4 8f df |.........>v.....|
-00000050 70 91 b7 ed 12 54 e2 e7 68 cb ed 26 be 84 a9 24 |p....T..h..&...$|
-00000060 fb 89 48 49 4e 9b 14 98 82 ab 64 0c a5 a0 ec 1d |..HIN.....d.....|
-00000070 96 b7 83 c3 14 cb de a5 97 d1 86 28 b6 d4 65 5d |...........(..e]|
-00000080 0b 45 04 37 02 53 8c 96 5d f8 d3 14 03 03 00 01 |.E.7.S..].......|
-00000090 01 16 03 03 00 30 04 43 06 c4 96 f5 f6 23 5d 46 |.....0.C.....#]F|
-000000a0 ec 3d f4 18 44 3f f8 d2 e9 74 37 22 56 df f2 35 |.=..D?...t7"V..5|
-000000b0 3d a0 8d 8a 80 be 4e 40 66 28 4c 37 aa f7 43 cf |=.....N@f(L7..C.|
-000000c0 9e 29 83 7b 39 28 |.).{9(|
+00000000 16 03 03 00 86 10 00 00 82 00 80 a3 a7 b7 b2 3e |...............>|
+00000010 ee 37 62 8e 5b b3 d5 2e e2 0e b9 24 70 95 4c 4c |.7b.[......$p.LL|
+00000020 52 e5 9f a3 e2 79 7f a1 dc 93 1f 89 2e f8 a2 8e |R....y..........|
+00000030 7b d8 82 6c 89 57 64 44 e9 61 66 aa 8d 42 ff d1 |{..l.WdD.af..B..|
+00000040 7f 62 21 55 78 e9 da 87 18 d5 51 dc 91 39 6b b9 |.b!Ux.....Q..9k.|
+00000050 8f ec 76 57 f7 03 62 fa 54 36 0c 18 ad 7c 1c 5d |..vW..b.T6...|.]|
+00000060 ce fd b4 97 c3 98 15 fc b5 e5 55 6b aa d5 d5 d4 |..........Uk....|
+00000070 17 9c a7 55 ee 8d d1 85 2e 92 10 32 67 72 d5 27 |...U.......2gr.'|
+00000080 0d aa b3 a9 5a ec d3 8c df d4 7f 14 03 03 00 01 |....Z...........|
+00000090 01 16 03 03 00 30 8a 3c 9c 7d dd 50 68 ff 79 dc |.....0.<.}.Ph.y.|
+000000a0 f4 b4 a7 73 8e de 93 01 85 a4 0c 9c cb 9a 2d 4d |...s..........-M|
+000000b0 34 95 63 d7 73 9f c5 89 e0 81 8f a2 bd c1 3b e4 |4.c.s.........;.|
+000000c0 5a fe 5a ef 6a 75 |Z.Z.ju|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 30 00 00 00 00 00 |..........0.....|
-00000010 00 00 00 27 75 8a 8d 43 68 0e af 19 6d d2 63 1c |...'u..Ch...m.c.|
-00000020 44 51 0b 86 4c fc 16 1c 77 f8 96 1e 72 3d b9 45 |DQ..L...w...r=.E|
-00000030 40 cc 70 bc 72 a3 d3 ff f6 e5 3f 17 03 03 00 30 |@.p.r.....?....0|
-00000040 00 00 00 00 00 00 00 00 f4 cf bc 55 e6 d7 4f d2 |...........U..O.|
-00000050 8f ae 52 8d 16 d0 44 9a c9 39 5b a7 69 bb 04 96 |..R...D..9[.i...|
-00000060 c9 d9 0c 92 a0 da b4 52 c5 dd 20 cb 4b 8c ad 51 |.......R.. .K..Q|
-00000070 15 03 03 00 20 00 00 00 00 00 00 00 00 43 52 b5 |.... ........CR.|
-00000080 d2 98 37 93 69 73 49 27 08 75 76 54 e7 39 b3 4c |..7.isI'.uvT.9.L|
-00000090 da 48 84 00 20 |.H.. |
+00000010 00 00 00 f1 00 85 78 65 64 6e 44 50 3e 34 30 87 |......xednDP>40.|
+00000020 b8 c2 b4 ed 76 e2 65 0a 4c 21 68 46 ca ae 97 ea |....v.e.L!hF....|
+00000030 a2 46 38 b3 65 b8 63 45 8f aa 4c 17 03 03 00 30 |.F8.e.cE..L....0|
+00000040 00 00 00 00 00 00 00 00 fd 9f bb a9 e3 72 fd 5f |.............r._|
+00000050 5b b7 2d 34 e5 4c 19 f4 ef 1c ce 71 0f d3 0d a6 |[.-4.L.....q....|
+00000060 5f f2 ca b4 3b f8 eb c7 20 85 e7 92 41 8c c8 08 |_...;... ...A...|
+00000070 15 03 03 00 20 00 00 00 00 00 00 00 00 3b b8 8c |.... ........;..|
+00000080 09 40 aa 11 20 a9 ee f7 e4 bb 80 a2 e6 5d e5 04 |.@.. ........]..|
+00000090 98 65 e8 bd 85 |.e...|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-RSA-AES b/src/crypto/tls/testdata/Server-TLSv12-RSA-AES
index e4d773d4c4..25f1269e3a 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-RSA-AES
+++ b/src/crypto/tls/testdata/Server-TLSv12-RSA-AES
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 97 01 00 00 93 03 03 41 7b 60 d8 f5 |...........A{`..|
-00000010 1c 4a 95 f9 03 de 94 0c b6 34 94 3c 6e 82 f2 de |.J.......4....B...=.`.\!.|
00000290 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 86 10 00 00 82 00 80 15 eb 41 72 e4 |.............Ar.|
-00000010 cf 0f 8b bb 9a ea aa 2a f1 dc 2e c9 db d8 cf bd |.......*........|
-00000020 5e fb 86 30 98 b4 22 62 a5 32 d0 e6 3d 38 49 1a |^..0.."b.2..=8I.|
-00000030 70 6f fa d3 81 c0 8d 00 c6 cd 80 b6 ed 26 8b 98 |po...........&..|
-00000040 3a 26 8b 8e 88 ba 61 a6 8e 19 5a 0e 51 bb 4e 9e |:&....a...Z.Q.N.|
-00000050 a9 21 09 77 cf 42 eb 26 90 3a 08 bb c5 89 88 2c |.!.w.B.&.:.....,|
-00000060 19 db b3 1c 7a d0 60 76 be 9a d5 0c ec df dd 11 |....z.`v........|
-00000070 9e a0 85 a5 36 3d 07 f7 36 47 52 92 cd 84 7b 2e |....6=..6GR...{.|
-00000080 13 18 47 58 8a 00 4b 39 59 bb da 14 03 03 00 01 |..GX..K9Y.......|
-00000090 01 16 03 03 00 40 16 0e 0a 79 db 54 11 36 73 af |.....@...y.T.6s.|
-000000a0 eb cb 9d e8 b4 42 1a f8 94 f0 fb d1 60 f8 9f 9d |.....B......`...|
-000000b0 ba 87 f6 27 ef 54 e4 f9 f7 1f a7 61 f5 82 1a 40 |...'.T.....a...@|
-000000c0 96 81 f6 14 db 89 ec 8b 0c 37 ba 11 55 94 d3 df |.........7..U...|
-000000d0 df 8d 61 ec a7 43 |..a..C|
+00000000 16 03 03 00 86 10 00 00 82 00 80 c7 bb d2 ee 1a |................|
+00000010 38 b1 7b 2f ad ec e6 63 d3 11 f9 69 b6 7e b9 58 |8.{/...c...i.~.X|
+00000020 79 37 c9 6e e5 6b 1e ce e5 b7 1f 69 ec 2c 71 94 |y7.n.k.....i.,q.|
+00000030 f7 27 16 66 14 24 bd bb ca ac 80 20 68 46 6e b8 |.'.f.$..... hFn.|
+00000040 3e f4 82 07 0a b7 0c 74 a5 66 1a 86 48 52 6e 80 |>......t.f..HRn.|
+00000050 a1 88 a3 12 8c c9 ef fc 5c 90 a8 f5 2f 0a 69 ba |........\.../.i.|
+00000060 ce 73 48 ca 25 ea be 3c 9f 1b b6 1c e9 d7 1d bf |.sH.%..<........|
+00000070 38 0d 6f a1 ed c0 22 16 40 51 2e c3 78 5b 69 8a |8.o...".@Q..x[i.|
+00000080 91 30 5b 15 b1 a5 c5 ea 5f 34 38 14 03 03 00 01 |.0[....._48.....|
+00000090 01 16 03 03 00 40 78 f5 31 97 86 f4 48 5c 74 8f |.....@x.1...H\t.|
+000000a0 ac b9 49 42 cb 83 e6 d9 bc a4 6f cc 3f f3 54 66 |..IB......o.?.Tf|
+000000b0 93 01 2c 1a e3 b4 08 09 f8 41 d4 fe 2d fa ab a9 |..,......A..-...|
+000000c0 f1 47 39 13 82 11 9e 7f 04 78 08 df 13 74 97 6c |.G9......x...t.l|
+000000d0 ba ac a8 26 90 2e |...&..|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....|
-00000010 00 00 00 00 00 00 00 00 00 00 00 ef 1a ed 92 e1 |................|
-00000020 e1 81 1e a8 e1 ff 2b 2b 64 89 17 55 2d ce eb be |......++d..U-...|
-00000030 17 a6 b8 a7 55 8a c4 3b 8a 5a c7 56 7c b5 90 c9 |....U..;.Z.V|...|
-00000040 19 bc 13 07 50 91 42 2a 46 13 d1 17 03 03 00 40 |....P.B*F......@|
+00000010 00 00 00 00 00 00 00 00 00 00 00 53 48 ab 5a 17 |...........SH.Z.|
+00000020 07 e4 14 04 4d 96 ae 33 b7 e7 6b 37 10 34 98 66 |....M..3..k7.4.f|
+00000030 b8 38 6b 30 53 17 3e af 80 34 a6 29 0c 3b 8b 05 |.8k0S.>..4.).;..|
+00000040 53 d6 53 fb 65 e3 ec 05 16 f2 c7 17 03 03 00 40 |S.S.e..........@|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
-00000060 9e fe 95 fa 67 a5 af 14 f0 80 fd 65 65 ac 0a 91 |....g......ee...|
-00000070 4a 1d 4a c3 de 3f 35 a7 de 10 94 55 b0 8f be e6 |J.J..?5....U....|
-00000080 76 a2 74 4c 89 47 b9 10 8f 78 a9 01 6b ac bb d9 |v.tL.G...x..k...|
+00000060 46 14 e6 50 23 20 15 9f a4 cc 39 69 43 e7 35 ea |F..P# ....9iC.5.|
+00000070 3c c3 71 a6 65 dc ba 66 7b 3e b8 8d bc cc 1b f5 |<.q.e..f{>......|
+00000080 2b 65 55 9b 35 c7 30 08 ff 0b 7c b7 bb 75 f1 5c |+eU.5.0...|..u.\|
00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........|
-000000a0 00 00 00 00 00 36 ce 1a 97 3e e3 0e 62 74 70 10 |.....6...>..btp.|
-000000b0 ec a5 30 16 1f 2d e0 5b c9 38 4d fb 61 2e 45 35 |..0..-.[.8M.a.E5|
-000000c0 4b 69 da 43 39 |Ki.C9|
+000000a0 00 00 00 00 00 83 b1 d6 5e 78 d8 7d 8f 22 a2 c9 |........^x.}."..|
+000000b0 81 2d 47 ed 7e a5 65 10 af a0 b4 01 be b3 70 a8 |.-G.~.e.......p.|
+000000c0 9f 5a 07 87 f5 |.Z...|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-RSA-AES-GCM b/src/crypto/tls/testdata/Server-TLSv12-RSA-AES-GCM
index 01f961208f..9f48c75bab 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-RSA-AES-GCM
+++ b/src/crypto/tls/testdata/Server-TLSv12-RSA-AES-GCM
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 97 01 00 00 93 03 03 d3 6a 87 ad b2 |............j...|
-00000010 a0 59 86 0e 34 86 c1 b3 c9 64 17 92 aa 87 04 05 |.Y..4....d......|
-00000020 32 d4 2e aa a1 48 94 87 82 a7 ab 00 00 04 c0 2f |2....H........./|
+00000000 16 03 01 00 97 01 00 00 93 03 03 6d 19 64 2c f0 |...........m.d,.|
+00000010 95 79 38 26 9b e3 db b3 97 ce f8 9c 46 62 08 15 |.y8&........Fb..|
+00000020 a0 f0 7f 20 38 52 bb 27 f8 3b 60 00 00 04 c0 2f |... 8R.'.;`..../|
00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1|
00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
@@ -54,28 +54,28 @@
00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............|
000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)|
000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;|
-000002c0 74 08 04 00 80 65 2f 82 18 27 04 84 db 3d c6 5e |t....e/..'...=.^|
-000002d0 6b 33 f9 87 59 e1 06 0c ce a7 3a f9 bd e7 54 47 |k3..Y.....:...TG|
-000002e0 03 58 f7 0b a3 16 6a 47 4b 61 b6 d9 0d 04 c8 95 |.X....jGKa......|
-000002f0 f5 d5 e5 0f 1b d2 26 3b c5 67 c0 87 dd a5 da a8 |......&;.g......|
-00000300 e1 7e 52 a1 6a 0d 10 e8 dd 2e 09 39 21 3e a2 0f |.~R.j......9!>..|
-00000310 a2 00 e4 a1 a6 df a8 3f 5d 1b d7 22 f8 b8 b5 32 |.......?].."...2|
-00000320 31 3a 36 16 9e 6c ab f1 d5 25 ae 3c 4a 11 c8 ae |1:6..l...%..cuo.....|
-00000340 11 40 c9 7f ca 16 03 03 00 04 0e 00 00 00 |.@............|
+000002c0 74 04 01 00 80 99 cc 0d 3d 25 73 2d 21 00 0d 42 |t.......=%s-!..B|
+000002d0 d1 6f 9e ba f4 04 58 30 5f a0 33 e9 b0 3a 69 6d |.o....X0_.3..:im|
+000002e0 e2 a1 f2 74 f7 09 e7 ef fb cd 56 22 93 1c 56 8e |...t......V"..V.|
+000002f0 8f 87 4b 1d 54 f6 34 fd e6 e0 2f 85 88 9a ab c9 |..K.T.4.../.....|
+00000300 b5 38 cd f3 44 20 7a 68 fd bf 10 ea 14 7e ae 21 |.8..D zh.....~.!|
+00000310 12 ad eb 91 2f 99 44 fb cf 9e fe 21 19 9f d1 a0 |..../.D....!....|
+00000320 37 19 9e 48 92 0e 80 b7 51 95 45 ee 75 86 f9 52 |7..H....Q.E.u..R|
+00000330 5a f8 67 65 56 af 4d f8 ca 92 8f b7 2a f5 be c1 |Z.geV.M.....*...|
+00000340 04 e0 03 e1 b6 16 03 03 00 04 0e 00 00 00 |..............|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 25 10 00 00 21 20 d1 f3 61 78 d1 34 |....%...! ..ax.4|
-00000010 36 b4 9f 5e e5 24 1e 48 02 be f0 13 c2 3d b0 ce |6..^.$.H.....=..|
-00000020 fb 96 39 6b 96 76 aa 87 18 41 14 03 03 00 01 01 |..9k.v...A......|
-00000030 16 03 03 00 28 27 e1 50 92 20 e1 2c 98 b6 15 8f |....('.P. .,....|
-00000040 dd bd 26 98 04 12 5d cb 29 66 ab 2d 37 f3 8e eb |..&...].)f.-7...|
-00000050 3e 14 3b cf 4d 99 c4 2e ea 7c 04 a5 45 |>.;.M....|..E|
+00000000 16 03 03 00 25 10 00 00 21 20 20 74 90 bd 53 18 |....%...! t..S.|
+00000010 33 c6 a5 bf 51 71 f7 d7 c3 0c 7f 89 ad b3 73 7b |3...Qq........s{|
+00000020 48 2f c1 ef 85 32 03 73 28 3b 14 03 03 00 01 01 |H/...2.s(;......|
+00000030 16 03 03 00 28 94 4f 85 68 15 57 b4 8f f4 21 a7 |....(.O.h.W...!.|
+00000040 e5 be 84 7d 3a e0 29 bd 99 20 24 d0 6b 9c 72 3a |...}:.).. $.k.r:|
+00000050 fc f9 5d 1c 7e cb dd 7a 3b 7c 53 e6 3a |..].~..z;|S.:|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....|
-00000010 00 00 00 88 39 9d c1 8d 8c bb c4 79 ba a5 2a bd |....9......y..*.|
-00000020 34 62 bf 66 85 b5 cd 2e f7 1e 6e b4 96 1c f6 b3 |4b.f......n.....|
-00000030 13 ba c9 17 03 03 00 25 00 00 00 00 00 00 00 01 |.......%........|
-00000040 c3 ca b5 57 11 26 ec 18 be 00 6c 8b 79 a5 ed f7 |...W.&....l.y...|
-00000050 7d ae 42 ff a2 8b fb 68 d0 08 0f 2e d1 15 03 03 |}.B....h........|
-00000060 00 1a 00 00 00 00 00 00 00 02 58 ad 11 d2 74 5c |..........X...t\|
-00000070 17 f2 60 e5 d9 fa 0e 47 5a 48 31 f7 |..`....GZH1.|
+00000010 00 00 00 e3 4f 34 0e 47 ae f2 62 e3 aa 62 f3 37 |....O4.G..b..b.7|
+00000020 cf 78 ba 1d 8a 3c d8 29 0c 3c 9d 0c fa ff fd 9b |.x...<.).<......|
+00000030 65 1b 3f 17 03 03 00 25 00 00 00 00 00 00 00 01 |e.?....%........|
+00000040 fd e1 49 0e 0d 9f a1 51 9e 19 5c 80 a5 15 dc 05 |..I....Q..\.....|
+00000050 ca f0 46 b3 da 03 5a 32 da 4e 2e 3d 33 15 03 03 |..F...Z2.N.=3...|
+00000060 00 1a 00 00 00 00 00 00 00 02 51 78 d9 14 6e a8 |..........Qx..n.|
+00000070 f4 62 60 6d db e0 d5 8c c5 17 ac aa |.b`m........|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-RSA-AES256-GCM-SHA384 b/src/crypto/tls/testdata/Server-TLSv12-RSA-AES256-GCM-SHA384
index 83a37e0587..f6e5856f9c 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-RSA-AES256-GCM-SHA384
+++ b/src/crypto/tls/testdata/Server-TLSv12-RSA-AES256-GCM-SHA384
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 97 01 00 00 93 03 03 39 40 da f7 9f |...........9@...|
-00000010 e9 66 91 25 2a d0 74 e1 71 4b 74 ff 47 41 5e f4 |.f.%*.t.qKt.GA^.|
-00000020 d2 71 d0 3e 96 8e 8e 31 ee 81 8b 00 00 04 c0 30 |.q.>...1.......0|
+00000000 16 03 01 00 97 01 00 00 93 03 03 5e 39 96 57 2e |...........^9.W.|
+00000010 de 43 bd 55 30 40 20 95 29 a0 38 7f 69 a3 02 4d |.C.U0@ .).8.i..M|
+00000020 df 59 4b 17 f1 d6 0b 2e 87 62 af 00 00 04 c0 30 |.YK......b.....0|
00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1|
00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
@@ -54,28 +54,28 @@
00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............|
000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)|
000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;|
-000002c0 74 08 04 00 80 67 b9 f4 b4 4e 00 7c 40 80 f1 77 |t....g...N.|@..w|
-000002d0 2e 09 f6 04 17 bb ab f6 e1 13 03 b3 b6 71 22 0b |.............q".|
-000002e0 38 49 98 65 54 db 3b e0 71 17 2a f3 d4 2a 0d 7e |8I.eT.;.q.*..*.~|
-000002f0 af 56 37 ea a9 1e df 45 24 fd 90 ad 5e 3c aa 2e |.V7....E$...^<..|
-00000300 98 74 b5 dc b5 22 0e 77 70 66 2f 6e d7 49 f6 a1 |.t...".wpf/n.I..|
-00000310 93 c9 0a ce 45 2b 55 bb 02 a3 b1 1d 5f 45 08 cd |....E+U....._E..|
-00000320 4d 34 9e ef 27 f2 f0 af a8 bd 14 60 45 df b4 54 |M4..'......`E..T|
-00000330 2c 6f c8 c8 dc f1 07 9a e8 f3 f3 40 1d 29 39 9e |,o.........@.)9.|
-00000340 a0 28 3a 19 de 16 03 03 00 04 0e 00 00 00 |.(:...........|
+000002c0 74 04 01 00 80 c0 53 9b 58 b3 88 7a 7d 7d 0f 8c |t.....S.X..z}}..|
+000002d0 c4 10 e3 13 92 ae b4 87 ae a5 e2 2f f9 f0 db a0 |.........../....|
+000002e0 55 72 00 2f 29 eb 12 13 f7 bf 4b 44 be f2 85 f2 |Ur./).....KD....|
+000002f0 00 2d 2c 6a 14 21 44 d5 f8 78 99 67 07 db 27 74 |.-,j.!D..x.g..'t|
+00000300 32 9d 75 8d 7e f5 c2 9b 3e ce 3b aa f4 3a 1d 2d |2.u.~...>.;..:.-|
+00000310 69 e3 0b 1e a0 95 d9 dc 47 73 42 14 7c 13 60 1f |i.......GsB.|.`.|
+00000320 73 a9 0f 3b 64 33 18 67 b0 a3 69 f7 da 1d cd d0 |s..;d3.g..i.....|
+00000330 ea 65 9d 79 af aa a6 7f ea ba 8a c7 d7 3f 80 76 |.e.y.........?.v|
+00000340 73 b0 c4 41 30 16 03 03 00 04 0e 00 00 00 |s..A0.........|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 25 10 00 00 21 20 73 eb 70 45 10 e4 |....%...! s.pE..|
-00000010 a7 a6 35 b2 51 59 1e 6d 65 9a 0e d4 5a c2 39 13 |..5.QY.me...Z.9.|
-00000020 81 83 41 f8 60 0c 6b 0e 7f 4c 14 03 03 00 01 01 |..A.`.k..L......|
-00000030 16 03 03 00 28 44 ed a7 2b dc 7a 00 b5 26 bd 56 |....(D..+.z..&.V|
-00000040 0d b7 47 f3 2c d8 b7 c5 f6 21 3a e6 1f b8 fd 3a |..G.,....!:....:|
-00000050 f8 44 65 0d 6e fd b8 32 cf dd f5 25 ce |.De.n..2...%.|
+00000000 16 03 03 00 25 10 00 00 21 20 75 56 9a 51 e6 99 |....%...! uV.Q..|
+00000010 e2 7f 36 c6 3e 7b e0 17 2a 28 73 77 24 6c e9 af |..6.>{..*(sw$l..|
+00000020 76 68 30 6a 07 4f 49 26 45 6d 14 03 03 00 01 01 |vh0j.OI&Em......|
+00000030 16 03 03 00 28 8e 42 ee 25 3a e2 8a 1a 51 f1 0c |....(.B.%:...Q..|
+00000040 5b ce d2 2f 2b 86 c6 0f 10 d2 e2 44 da d8 4f 88 |[../+......D..O.|
+00000050 b5 2b 9c 9f 21 06 da 76 93 06 42 43 1f |.+..!..v..BC.|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....|
-00000010 00 00 00 cb e9 44 b4 25 7e a5 9d ed 8e 8b 5c 4c |.....D.%~.....\L|
-00000020 b9 c4 85 5b 9b 03 02 34 2c 61 40 fe 4a 84 9d 42 |...[...4,a@.J..B|
-00000030 67 67 53 17 03 03 00 25 00 00 00 00 00 00 00 01 |ggS....%........|
-00000040 ec a1 21 b6 85 61 d1 35 71 50 c1 6d 4d 32 81 3f |..!..a.5qP.mM2.?|
-00000050 24 38 1d 8a 45 f7 9e 14 3b be e9 ec 37 15 03 03 |$8..E...;...7...|
-00000060 00 1a 00 00 00 00 00 00 00 02 f7 76 a1 1b bb 55 |...........v...U|
-00000070 aa 1d 10 c2 07 61 b3 0d 54 2d 6b e4 |.....a..T-k.|
+00000010 00 00 00 7c d4 b3 85 ea 5e 0c 8d 81 0c 7c 99 90 |...|....^....|..|
+00000020 5f fd cc 32 b5 d8 fd 0c 0a 9c 93 a5 35 4d a8 50 |_..2........5M.P|
+00000030 a8 6f 73 17 03 03 00 25 00 00 00 00 00 00 00 01 |.os....%........|
+00000040 49 5c 12 84 e7 cb a4 fb b1 55 be 89 79 5c a8 df |I\.......U..y\..|
+00000050 ab 0a e1 1b 98 e6 0f 40 fb f4 47 1f e1 15 03 03 |.......@..G.....|
+00000060 00 1a 00 00 00 00 00 00 00 02 e7 17 b1 82 70 75 |..............pu|
+00000070 42 d5 8f 2e 29 4b b3 a1 a2 3f c2 f8 |B...)K...?..|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-RSA-RC4 b/src/crypto/tls/testdata/Server-TLSv12-RSA-RC4
index da549aa32e..78ea1ff929 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-RSA-RC4
+++ b/src/crypto/tls/testdata/Server-TLSv12-RSA-RC4
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 97 01 00 00 93 03 03 c7 7f 29 46 41 |.............)FA|
-00000010 08 97 7c 3f 77 e0 11 8f 14 30 23 3e fa fc ca f3 |..|?w....0#>....|
-00000020 45 10 83 10 1f 8f 25 b6 9d c1 4d 00 00 04 00 05 |E.....%...M.....|
+00000000 16 03 01 00 97 01 00 00 93 03 03 32 12 2b 12 44 |...........2.+.D|
+00000010 4f 0c 98 c0 fc f6 44 06 3a b1 64 89 a5 8b f4 e4 |O.....D.:.d.....|
+00000020 73 e1 60 1e 51 38 92 f3 83 f3 9f 00 00 04 00 05 |s.`.Q8..........|
00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1|
00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
@@ -53,23 +53,23 @@
00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
00000290 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 86 10 00 00 82 00 80 d1 b0 57 28 da |.............W(.|
-00000010 7a f8 46 7c c2 24 0d e0 04 48 33 d4 bc d7 f0 d0 |z.F|.$...H3.....|
-00000020 85 fb ff 22 27 20 91 42 19 55 7b ef d8 fd 72 42 |..."' .B.U{...rB|
-00000030 75 e6 71 e4 9f 67 30 72 68 b6 0e 00 34 d3 2f b8 |u.q..g0rh...4./.|
-00000040 23 1b 00 43 17 68 fd 0f 90 ee 97 16 23 36 90 02 |#..C.h......#6..|
-00000050 5c 71 10 03 80 ea 74 ef a4 5a ac e4 9f 48 f0 76 |\q....t..Z...H.v|
-00000060 62 43 17 05 7c 8f 59 1d 16 b1 97 48 99 8d 66 5e |bC..|.Y....H..f^|
-00000070 83 20 b3 02 e4 ac 73 52 b2 24 21 06 5a 49 89 df |. ....sR.$!.ZI..|
-00000080 4b ad 4e f4 a9 7b 0c 3a b1 39 5d 14 03 03 00 01 |K.N..{.:.9].....|
-00000090 01 16 03 03 00 24 8b de 7e 10 53 71 e0 0b 68 f6 |.....$..~.Sq..h.|
-000000a0 36 67 66 c2 b9 0a c0 3e 39 0d ab 2e eb 5e eb 06 |6gf....>9....^..|
-000000b0 a6 45 2b d7 48 8f c0 5e f3 a0 |.E+.H..^..|
+00000000 16 03 03 00 86 10 00 00 82 00 80 85 ad 31 da a9 |.............1..|
+00000010 fd 0f 5c ca aa 28 d1 08 7d 76 b4 5b b2 09 f4 e0 |..\..(..}v.[....|
+00000020 65 3a 82 7e f8 03 5f c9 82 ae fb 04 f8 f1 dc bc |e:.~.._.........|
+00000030 b9 2f e8 b4 4c b0 5a de c8 99 88 99 0b 03 ed 7f |./..L.Z.........|
+00000040 e4 84 a0 6b 6d 55 1e f6 ea 9f 5a 55 1e 5c e5 f1 |...kmU....ZU.\..|
+00000050 f4 8a f3 7b 7c 20 fc 4b 5d 31 98 c3 bb ce ba 6a |...{| .K]1.....j|
+00000060 e8 e5 58 a1 db 5a 84 7d ef cd 17 52 2f 66 31 d2 |..X..Z.}...R/f1.|
+00000070 27 e4 29 1c 9e e0 39 a9 e0 7f 5f 25 d7 49 95 28 |'.)...9..._%.I.(|
+00000080 08 67 1e 25 5f 12 39 b0 a5 63 85 14 03 03 00 01 |.g.%_.9..c......|
+00000090 01 16 03 03 00 24 88 e9 9e 1d 16 8f f7 6e b1 c9 |.....$.......n..|
+000000a0 06 dc 50 e7 40 da 21 84 de 97 e6 a2 8d 78 96 9a |..P.@.!......x..|
+000000b0 39 9d aa 91 43 15 0f cf f4 e9 |9...C.....|
>>> Flow 4 (server to client)
-00000000 14 03 03 00 01 01 16 03 03 00 24 ee dc 70 d2 3a |..........$..p.:|
-00000010 f1 9c c6 c8 01 01 84 4f 3c 95 a3 ac 7a 78 92 3d |.......O<...zx.=|
-00000020 8c 05 a1 db 34 fe 92 f2 9e f3 81 a1 33 a5 7f 17 |....4.......3...|
-00000030 03 03 00 21 6e a9 f8 f9 99 0b c1 f5 8a d0 ab 93 |...!n...........|
-00000040 15 4d 2f 24 1c 0b 43 77 cf 14 60 87 b0 8d f7 80 |.M/$..Cw..`.....|
-00000050 c0 69 ea f6 9e 15 03 03 00 16 ef 09 73 d8 06 ec |.i..........s...|
-00000060 b8 02 14 9c d3 39 32 d4 3d 94 ec 17 79 1d a9 d3 |.....92.=...y...|
+00000000 14 03 03 00 01 01 16 03 03 00 24 c5 34 41 0f 31 |..........$.4A.1|
+00000010 5a 94 d7 4b a9 0a 4e bf b9 22 ec 76 2c 1f f5 e9 |Z..K..N..".v,...|
+00000020 6b 7b 26 df 41 62 91 b6 dc db 23 2b 8d 3d 49 17 |k{&.Ab....#+.=I.|
+00000030 03 03 00 21 72 31 77 51 94 c5 d4 eb 7c 18 ab 87 |...!r1wQ....|...|
+00000040 29 43 3b c5 78 aa 5c 4a 06 d3 42 5c 61 39 86 12 |)C;.x.\J..B\a9..|
+00000050 b1 ae f6 f7 97 15 03 03 00 16 8a 0e 1d 5c e0 18 |.............\..|
+00000060 12 93 ac 6c 69 32 59 b8 15 88 82 1c 97 f3 5b 9c |...li2Y.......[.|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-RSA-RSAPKCS1v15 b/src/crypto/tls/testdata/Server-TLSv12-RSA-RSAPKCS1v15
index 6d98a309ee..2c5237153a 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-RSA-RSAPKCS1v15
+++ b/src/crypto/tls/testdata/Server-TLSv12-RSA-RSAPKCS1v15
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 91 01 00 00 8d 03 03 c1 6b f6 4d 77 |............k.Mw|
-00000010 95 dc 8a 54 04 62 4a b4 dc e3 06 51 b8 88 4e 9f |...T.bJ....Q..N.|
-00000020 9a f5 2b 87 82 51 df e9 54 c7 93 00 00 2a c0 30 |..+..Q..T....*.0|
+00000000 16 03 01 00 91 01 00 00 8d 03 03 96 d3 ee ca ff |................|
+00000010 77 00 8c e4 14 3a ee 2a bb 39 8c 62 72 c7 ae 46 |w....:.*.9.br..F|
+00000020 8c 7e 8e 90 96 f1 c3 27 4d 37 3f 00 00 2a c0 30 |.~.....'M7?..*.0|
00000030 00 9f cc a8 cc aa c0 2f 00 9e c0 28 00 6b c0 27 |......./...(.k.'|
00000040 00 67 c0 14 00 39 c0 13 00 33 00 9d 00 9c 00 3d |.g...9...3.....=|
00000050 00 3c 00 35 00 2f 00 ff 01 00 00 3a 00 00 00 0e |.<.5./.....:....|
@@ -54,28 +54,28 @@
00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............|
000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)|
000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;|
-000002c0 74 04 01 00 80 15 c5 ee da 37 f8 6d b8 9e 7c 68 |t........7.m..|h|
-000002d0 b2 08 2a 8d 79 6c 6e 95 4e b5 6f 8e 84 24 31 d4 |..*.yln.N.o..$1.|
-000002e0 e7 8c 6c 7e 9c 58 a4 fe 18 59 aa f7 0d 7d ff 7a |..l~.X...Y...}.z|
-000002f0 f2 b0 eb b6 d3 4f fa 3f 36 0d 2e 43 8e d7 96 14 |.....O.?6..C....|
-00000300 99 a0 34 6a 51 cf 49 48 2f 6a 69 3b e4 ec 8b 61 |..4jQ.IH/ji;...a|
-00000310 a1 f4 ea 20 c5 72 90 b1 c6 54 75 42 4e f6 1f 12 |... .r...TuBN...|
-00000320 da e1 98 36 01 02 30 b4 75 7b 4f 4b f1 4f ac 20 |...6..0.u{OK.O. |
-00000330 ac c8 d2 0f 8f 2a 00 09 b8 2c ab 9e 5f b2 ce 25 |.....*...,.._..%|
-00000340 e3 a3 27 9d 53 16 03 03 00 04 0e 00 00 00 |..'.S.........|
+000002c0 74 04 01 00 80 c9 24 3c 3d dd 65 45 f8 e4 92 b9 |t.....$<=.eE....|
+000002d0 2b 03 c2 9f f5 73 1f 84 dd 9b da 82 2b 44 7c f1 |+....s......+D|.|
+000002e0 7c 55 d8 53 39 e9 d9 ea f1 6a 23 7f b0 aa 30 94 ||U.S9....j#...0.|
+000002f0 37 b7 06 59 1a fc 09 ba d9 68 f7 c8 96 5d 80 e1 |7..Y.....h...]..|
+00000300 7c f4 1b 36 0a 8a dd 2e c5 d0 27 da 4a 75 98 fb ||..6......'.Ju..|
+00000310 43 51 3f 8e 95 0d 7b 42 93 8a d5 dc 55 59 ef 69 |CQ?...{B....UY.i|
+00000320 91 82 a3 d8 7e 54 a4 7b 05 17 06 58 21 62 79 b7 |....~T.{...X!by.|
+00000330 67 bd ac 8c 9e 23 73 01 17 49 4b 5d 24 7a 29 0b |g....#s..IK]$z).|
+00000340 05 ec 24 1e cb 16 03 03 00 04 0e 00 00 00 |..$...........|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 25 10 00 00 21 20 fe 11 76 84 dd 42 |....%...! ..v..B|
-00000010 d9 fd ad 50 81 7e 62 d4 38 cb b3 5d ec c8 5a 7a |...P.~b.8..]..Zz|
-00000020 40 d9 10 23 2f e6 c7 a8 95 3b 14 03 03 00 01 01 |@..#/....;......|
-00000030 16 03 03 00 28 61 18 1a 65 0c 24 59 01 fe 28 fc |....(a..e.$Y..(.|
-00000040 4f 7f d9 c5 6d b7 bf 9c 5c 8b dc 91 e7 48 40 72 |O...m...\....H@r|
-00000050 06 4d 49 a4 4d 32 e2 10 b9 36 a4 06 a6 |.MI.M2...6...|
+00000000 16 03 03 00 25 10 00 00 21 20 8e 76 7a 64 15 47 |....%...! .vzd.G|
+00000010 60 08 88 f8 3c ca 23 ce e3 f1 52 18 e0 94 6f 7a |`...<.#...R...oz|
+00000020 be 7b 39 c6 42 eb 14 d9 f3 7a 14 03 03 00 01 01 |.{9.B....z......|
+00000030 16 03 03 00 28 a8 16 b6 f4 4e 1e f1 5a 8a 04 a5 |....(....N..Z...|
+00000040 4b a0 40 b1 9f 7e e7 42 22 45 01 03 52 5a 11 53 |K.@..~.B"E..RZ.S|
+00000050 c1 1f a7 19 14 c0 9c d8 53 c3 41 ae 6f |........S.A.o|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....|
-00000010 00 00 00 6c 7b 84 e6 84 d3 31 8e 6a 3e e7 7e f2 |...l{....1.j>.~.|
-00000020 94 16 6c 6f 01 a9 2d f7 de 5d 94 b2 9c 4b f0 51 |..lo..-..]...K.Q|
-00000030 70 9e 3c 17 03 03 00 25 00 00 00 00 00 00 00 01 |p.<....%........|
-00000040 94 ca c5 e7 58 20 7d 3b 74 9d e0 97 a2 dd 63 ab |....X };t.....c.|
-00000050 33 08 2f 16 69 59 ba 0e 82 52 75 98 eb 15 03 03 |3./.iY...Ru.....|
-00000060 00 1a 00 00 00 00 00 00 00 02 fc 38 72 72 09 6a |...........8rr.j|
-00000070 ee c0 61 39 50 71 ad d3 ec a9 d1 0e |..a9Pq......|
+00000010 00 00 00 e8 93 95 10 51 dd 7c d1 07 72 73 c1 9d |.......Q.|..rs..|
+00000020 6b 2a 47 ce f5 56 3f e0 2f c4 41 97 ea 6d 83 07 |k*G..V?./.A..m..|
+00000030 3f 80 f5 17 03 03 00 25 00 00 00 00 00 00 00 01 |?......%........|
+00000040 44 c5 ed 59 85 39 66 98 bb de 1a d3 03 f3 29 94 |D..Y.9f.......).|
+00000050 4a 53 bd 25 bc 0a 23 11 10 68 c7 15 ad 15 03 03 |JS.%..#..h......|
+00000060 00 1a 00 00 00 00 00 00 00 02 c8 a1 07 6c d8 6a |.............l.j|
+00000070 cc f8 6a 5b d1 8c 32 93 71 23 c8 71 |..j[..2.q#.q|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-RSA-RSAPSS b/src/crypto/tls/testdata/Server-TLSv12-RSA-RSAPSS
index 5ec0f25a17..c260afe296 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-RSA-RSAPSS
+++ b/src/crypto/tls/testdata/Server-TLSv12-RSA-RSAPSS
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 91 01 00 00 8d 03 03 0f 06 da 7d 85 |..............}.|
-00000010 33 d8 3c c3 ad c5 19 f8 06 d8 f6 02 80 9a fb 8c |3.<.............|
-00000020 55 a5 6b 67 c4 6e 68 11 74 61 28 00 00 2a c0 30 |U.kg.nh.ta(..*.0|
+00000000 16 03 01 00 91 01 00 00 8d 03 03 de a3 85 5b 56 |..............[V|
+00000010 34 e4 d0 57 07 66 8d 3c 39 00 eb 27 02 22 c9 f3 |4..W.f.<9..'."..|
+00000020 23 a6 5e 08 3a 6d 06 09 8f d9 00 00 00 2a c0 30 |#.^.:m.......*.0|
00000030 00 9f cc a8 cc aa c0 2f 00 9e c0 28 00 6b c0 27 |......./...(.k.'|
00000040 00 67 c0 14 00 39 c0 13 00 33 00 9d 00 9c 00 3d |.g...9...3.....=|
00000050 00 3c 00 35 00 2f 00 ff 01 00 00 3a 00 00 00 0e |.<.5./.....:....|
@@ -51,31 +51,4 @@
00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
-00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............|
-000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)|
-000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;|
-000002c0 74 08 04 00 80 49 30 b1 a5 47 19 7f a7 35 61 cb |t....I0..G...5a.|
-000002d0 dc 41 47 f0 6a 96 e1 63 48 d9 4f d3 a4 ac 06 46 |.AG.j..cH.O....F|
-000002e0 f2 8d 07 95 25 c6 61 59 4a df 35 2e ce dd 71 7e |....%.aYJ.5...q~|
-000002f0 1e d6 f4 9f 43 93 84 35 6a 98 41 45 16 ee cb 14 |....C..5j.AE....|
-00000300 dd bb 52 27 08 d5 a2 39 e7 6e f6 d6 e4 c6 bd f3 |..R'...9.n......|
-00000310 b6 9b 6d 61 30 2a 07 c6 04 39 87 fd 99 00 15 78 |..ma0*...9.....x|
-00000320 3d bf 20 8c b9 52 fb 5d c7 b7 77 78 fb 77 2a ac |=. ..R.]..wx.w*.|
-00000330 f5 3e e5 4b 8f 4d 9b ca c2 33 1c 66 3c cb e0 1f |.>.K.M...3.f<...|
-00000340 81 36 78 39 70 16 03 03 00 04 0e 00 00 00 |.6x9p.........|
->>> Flow 3 (client to server)
-00000000 16 03 03 00 25 10 00 00 21 20 79 9a e7 42 96 52 |....%...! y..B.R|
-00000010 f6 52 7d 10 9a 36 9b aa a7 2f 96 be 5b 0a 3b 40 |.R}..6.../..[.;@|
-00000020 d9 32 3a 0b 17 7b 8d 92 7c 7b 14 03 03 00 01 01 |.2:..{..|{......|
-00000030 16 03 03 00 28 92 3e da 41 d2 87 60 b3 e1 4f f7 |....(.>.A..`..O.|
-00000040 bb b7 09 50 47 2e 05 d5 fe f6 ed 94 ba 3b 60 aa |...PG........;`.|
-00000050 38 2d b2 38 c7 07 64 63 dd ca 1a 8e ae |8-.8..dc.....|
->>> Flow 4 (server to client)
-00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....|
-00000010 00 00 00 8e c6 6e 45 21 eb 35 11 7a b5 74 d7 f7 |.....nE!.5.z.t..|
-00000020 67 53 15 23 9d 61 a1 bc 20 10 c8 8e 7e ee 45 fc |gS.#.a.. ...~.E.|
-00000030 60 13 20 17 03 03 00 25 00 00 00 00 00 00 00 01 |`. ....%........|
-00000040 bf f9 63 b5 b1 39 70 43 c7 62 38 be d1 f5 0d a5 |..c..9pC.b8.....|
-00000050 87 91 95 71 ab 03 c2 08 d0 38 dc 70 9a 15 03 03 |...q.....8.p....|
-00000060 00 1a 00 00 00 00 00 00 00 02 0c 6f b1 f5 45 6d |...........o..Em|
-00000070 44 2c 1f ec a4 fa 5c c1 aa 23 1e 82 |D,....\..#..|
+00000290 3b e9 fa e7 15 03 03 00 02 02 28 |;.........(|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-SNI b/src/crypto/tls/testdata/Server-TLSv12-SNI
index f1c35527d2..380db2abb2 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-SNI
+++ b/src/crypto/tls/testdata/Server-TLSv12-SNI
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 99 01 00 00 95 03 03 4d 04 34 4d c9 |...........M.4M.|
-00000010 52 17 f0 1c 49 b6 2b d1 a0 16 a2 04 f4 d3 7c ca |R...I.+.......|.|
-00000020 3d 4e 41 44 3d de 29 60 32 d6 a7 00 00 04 00 2f |=NAD=.)`2....../|
+00000000 16 03 01 00 99 01 00 00 95 03 03 dd e8 cc 23 63 |..............#c|
+00000010 70 38 e5 f9 db 6c 77 0b be e9 53 ad 06 97 cb 02 |p8...lw...S.....|
+00000020 d4 a7 bc d2 68 80 bf b8 0c 51 bc 00 00 04 00 2f |....h....Q...../|
00000030 00 ff 01 00 00 68 00 00 00 10 00 0e 00 00 0b 73 |.....h.........s|
00000040 6e 69 74 65 73 74 2e 63 6f 6d 00 0b 00 04 03 00 |nitest.com......|
00000050 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 |................|
@@ -53,31 +53,31 @@
00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
00000290 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 86 10 00 00 82 00 80 ca 5a ef 73 b7 |............Z.s.|
-00000010 e2 11 b7 9a 45 22 8f 0d 44 ca 44 77 c0 ec 67 95 |....E"..D.Dw..g.|
-00000020 cc 63 2a 55 65 69 34 93 a2 64 fa f8 c0 db 56 91 |.c*Uei4..d....V.|
-00000030 d2 50 d4 a8 8c 89 13 e6 c0 ce 2b 26 46 cb ea 39 |.P........+&F..9|
-00000040 66 4c 89 58 8d 8a da 9c bd 16 b3 28 40 a1 6f f8 |fL.X.......(@.o.|
-00000050 f7 f5 d9 9f d1 cd 44 ca b5 ed 19 ea ec fa 97 2d |......D........-|
-00000060 87 a5 c2 a8 1e f0 0c 70 fd fc a7 e7 1b dc 0c 99 |.......p........|
-00000070 d0 1f 6d 68 df 64 8f cb ce 7b 3e 38 ab 9d b3 ba |..mh.d...{>8....|
-00000080 66 a4 17 60 d6 fd ab 1d d8 a2 b4 14 03 03 00 01 |f..`............|
-00000090 01 16 03 03 00 40 31 e3 94 eb 85 21 63 5e 29 b8 |.....@1....!c^).|
-000000a0 2b 9a 42 d1 4d f1 3c e8 df 66 ed 6f 61 42 aa 46 |+.B.M.<..f.oaB.F|
-000000b0 c0 4b 33 27 93 94 c5 6a 6c 94 f9 ba 6a 81 11 b1 |.K3'...jl...j...|
-000000c0 be 21 00 97 d9 84 9d ee fd fd 79 18 ad 07 7a a8 |.!........y...z.|
-000000d0 d3 89 e3 2a b0 f0 |...*..|
+00000000 16 03 03 00 86 10 00 00 82 00 80 88 3a 3f eb 46 |............:?.F|
+00000010 28 cd 34 8f 95 5a 1e f8 c9 09 7d b0 97 9c 84 62 |(.4..Z....}....b|
+00000020 20 fd c7 cd 2e 09 27 2e bb b7 1c b6 e1 05 7b f4 | .....'.......{.|
+00000030 cc 52 14 ee 6c 9b 18 4e 31 5a 4d be 8c 84 e3 6c |.R..l..N1ZM....l|
+00000040 27 ca e9 c4 e9 da 9a 84 cc 7c b5 87 27 e1 be 1c |'........|..'...|
+00000050 7a 70 3b 2a 71 a4 7d c5 4b ab 28 0e 4b ff 1f c4 |zp;*q.}.K.(.K...|
+00000060 d0 08 0b 9b ce e6 b8 ae a2 a9 c5 c9 0a 73 1d a0 |.............s..|
+00000070 88 18 11 55 61 e1 1b 83 82 93 19 bb dc 29 f9 aa |...Ua........)..|
+00000080 44 e0 b0 3b b9 dd 73 98 52 42 7b 14 03 03 00 01 |D..;..s.RB{.....|
+00000090 01 16 03 03 00 40 a4 e7 a1 51 63 e2 d7 df 93 32 |.....@...Qc....2|
+000000a0 01 f2 f1 14 a0 a3 1c 04 f1 c6 19 8c ab cb 51 b5 |..............Q.|
+000000b0 78 12 a4 43 08 62 14 ff 5c a0 5f aa 61 d8 c3 2c |x..C.b..\._.a..,|
+000000c0 c8 af 05 f8 83 ff fb 6a d9 a7 06 a9 ea b0 92 f5 |.......j........|
+000000d0 75 5a bc e7 57 c3 |uZ..W.|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....|
-00000010 00 00 00 00 00 00 00 00 00 00 00 98 ae 81 aa e9 |................|
-00000020 4e 1f 93 59 89 05 a2 98 c3 17 dd e1 9d 9a 12 7d |N..Y...........}|
-00000030 30 c6 6c b4 a6 f3 b7 b2 c5 df dc 9d 81 99 ce 29 |0.l............)|
-00000040 4b 75 04 9e d3 82 06 fa 22 1f a2 17 03 03 00 40 |Ku......"......@|
+00000010 00 00 00 00 00 00 00 00 00 00 00 63 e2 4a 8d 77 |...........c.J.w|
+00000020 d8 d9 50 ae ba b0 44 d9 e2 7d 97 52 e6 65 07 5e |..P...D..}.R.e.^|
+00000030 a1 03 19 a7 f6 a2 af 89 00 99 da 98 29 43 43 47 |............)CCG|
+00000040 9b 3c 8f 03 1a 36 27 e3 d8 db b7 17 03 03 00 40 |.<...6'........@|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
-00000060 dc 0e 49 1a ad 28 b6 c1 f2 27 ae bf 94 45 57 15 |..I..(...'...EW.|
-00000070 74 33 ae 3a f0 ee e5 76 7e 72 6c d9 56 64 88 58 |t3.:...v~rl.Vd.X|
-00000080 0b 96 35 a9 83 2e 4e 82 f8 a4 f8 f5 5b 08 6f 79 |..5...N.....[.oy|
+00000060 c2 6b 34 e5 79 04 14 ec cf 14 4c 71 14 02 0d b3 |.k4.y.....Lq....|
+00000070 29 31 ec d8 40 81 12 15 8e 17 8a 42 33 1a 82 9a |)1..@......B3...|
+00000080 be e9 6c dc dc 49 56 7a fd 13 0a 20 37 79 e4 71 |..l..IVz... 7y.q|
00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........|
-000000a0 00 00 00 00 00 63 55 cb 53 f8 b1 48 85 33 aa c6 |.....cU.S..H.3..|
-000000b0 aa 60 c4 d0 b6 bb cc 85 3e a9 92 f9 be 53 8b 8b |.`......>....S..|
-000000c0 3e 9c ee 8f f4 |>....|
+000000a0 00 00 00 00 00 4d 29 ee b6 bf f8 71 69 4e 96 a4 |.....M)....qiN..|
+000000b0 5d 06 0e ef a9 aa 3f 16 19 c9 5d 8e 89 4f d2 cb |].....?...]..O..|
+000000c0 17 1a e1 b0 63 |....c|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificate b/src/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificate
index f407ffd0b5..3e08bd4067 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificate
+++ b/src/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificate
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 99 01 00 00 95 03 03 9d e8 44 6f ac |.............Do.|
-00000010 b8 f3 4e 96 5e c0 2a 81 4d 71 2e 0e 8a a0 2f 88 |..N.^.*.Mq..../.|
-00000020 4a 87 39 d2 ed 94 0b 41 ad 2b bf 00 00 04 00 2f |J.9....A.+...../|
+00000000 16 03 01 00 99 01 00 00 95 03 03 78 fd 27 cc 09 |...........x.'..|
+00000010 5e 07 db a2 78 ba 7a 4d a9 7f 74 f5 d1 6e a7 d2 |^...x.zM..t..n..|
+00000020 bc f2 ee 22 2d 68 e7 59 c4 9c bc 00 00 04 00 2f |..."-h.Y......./|
00000030 00 ff 01 00 00 68 00 00 00 10 00 0e 00 00 0b 73 |.....h.........s|
00000040 6e 69 74 65 73 74 2e 63 6f 6d 00 0b 00 04 03 00 |nitest.com......|
00000050 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 |................|
@@ -53,31 +53,31 @@
00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
00000290 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 86 10 00 00 82 00 80 a4 d5 09 e3 4c |...............L|
-00000010 78 eb 7d 76 4f 7f cf c7 2b 9d d1 fe 8f 5e a2 6b |x.}vO...+....^.k|
-00000020 83 82 cb 93 37 63 47 ec 38 48 42 2a 3e e1 bf 6b |....7cG.8HB*>..k|
-00000030 02 0a 8c b8 07 a7 11 5d fd cc 6d dc 3b ed 26 24 |.......]..m.;.&$|
-00000040 18 64 ed 2e 98 93 49 45 ea 49 be 3f 12 43 47 c0 |.d....IE.I.?.CG.|
-00000050 c3 ef 25 e0 be 06 f2 e5 fe 9f 3e c7 e6 23 90 d1 |..%.......>..#..|
-00000060 2e 6f fc e2 72 ba a2 c2 e9 94 ab 7e ca 59 fa 93 |.o..r......~.Y..|
-00000070 40 4a 48 39 f9 5e 5f ac 60 a0 94 61 1c 6e 10 1e |@JH9.^_.`..a.n..|
-00000080 30 44 1d 28 cb 2b b9 7f 00 dd 23 14 03 03 00 01 |0D.(.+....#.....|
-00000090 01 16 03 03 00 40 81 02 8e b2 b5 e2 b2 0a 95 9e |.....@..........|
-000000a0 1e 65 4a 63 98 5b f0 30 4b 63 0a 74 87 58 20 fb |.eJc.[.0Kc.t.X .|
-000000b0 2f 58 f8 10 a5 5f 4e b9 19 21 96 5f 13 8d d6 ed |/X..._N..!._....|
-000000c0 a3 39 92 e5 4c 0f 31 c3 df 51 2d bb 7c 29 54 34 |.9..L.1..Q-.|)T4|
-000000d0 f6 68 fb f2 49 2d |.h..I-|
+00000000 16 03 03 00 86 10 00 00 82 00 80 1f 30 ae eb ce |............0...|
+00000010 57 b4 1c 5d f9 d0 5c 62 1e 89 6f b8 92 e3 c5 ef |W..]..\b..o.....|
+00000020 ad cb 1b c2 86 e2 4e b5 88 4a d1 77 9d 89 07 87 |......N..J.w....|
+00000030 43 a1 90 41 70 3e 5e b6 59 29 9c 05 79 8f 97 92 |C..Ap>^.Y)..y...|
+00000040 77 6a 81 30 ec 30 ca e9 5e 66 10 6b 33 85 c8 c4 |wj.0.0..^f.k3...|
+00000050 4f 9a 0d 8e 4b cb d2 d8 93 9c 9c b8 91 95 15 01 |O...K...........|
+00000060 40 7c 61 cb bf a7 8e a9 ca dc 3e 78 ca 27 17 86 |@|a.......>x.'..|
+00000070 40 50 c5 44 03 ad 87 7a dc 36 76 f5 79 6d 45 df |@P.D...z.6v.ymE.|
+00000080 01 c1 d4 4f b0 d8 6a 2c fe 18 71 14 03 03 00 01 |...O..j,..q.....|
+00000090 01 16 03 03 00 40 bc 90 46 f6 24 2f 68 47 7b 21 |.....@..F.$/hG{!|
+000000a0 01 91 67 d4 94 39 c0 8e 9f d4 75 dc f6 3a ac 22 |..g..9....u..:."|
+000000b0 4a a8 44 c9 ea 90 02 9b fa 5c d5 17 5c 3d 81 bb |J.D......\..\=..|
+000000c0 90 72 29 5d 92 d8 b1 2d b7 a6 18 d1 7b 78 f4 7d |.r)]...-....{x.}|
+000000d0 66 f8 2b 9c b1 90 |f.+...|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....|
-00000010 00 00 00 00 00 00 00 00 00 00 00 3a 54 5f df 8a |...........:T_..|
-00000020 c4 53 fb 18 31 f5 72 47 fd ef 38 84 72 80 81 88 |.S..1.rG..8.r...|
-00000030 45 69 81 aa c8 0d d7 4a 95 e9 cf ea b0 0e 07 3b |Ei.....J.......;|
-00000040 9c f5 b3 47 00 58 55 e3 06 e1 a3 17 03 03 00 40 |...G.XU........@|
+00000010 00 00 00 00 00 00 00 00 00 00 00 c6 d9 32 9f b9 |.............2..|
+00000020 e8 94 29 d3 62 fb ce 1d de 4e de be e4 bd 58 86 |..).b....N....X.|
+00000030 96 07 c9 8e 34 77 b5 ca 18 67 39 d4 4c 33 c8 f0 |....4w...g9.L3..|
+00000040 4f 6b a2 22 c7 c1 1e 73 a7 9f 91 17 03 03 00 40 |Ok."...s.......@|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
-00000060 dd c3 b2 95 87 4d fb ae ee 0e cd 78 ac f3 2d 06 |.....M.....x..-.|
-00000070 f1 a1 86 91 a3 d3 8f f6 66 b6 1c 6d 3f 6b 5b ba |........f..m?k[.|
-00000080 4c c8 b2 5e bf 46 2b 05 bd 17 51 29 bd 1a 91 39 |L..^.F+...Q)...9|
+00000060 74 73 d2 d5 5c 5d d7 0d 83 0f c6 8b bd 7c f6 31 |ts..\].......|.1|
+00000070 2e cf 9d 01 14 f8 91 59 3d 2b 2f 4b 12 3f 72 1f |.......Y=+/K.?r.|
+00000080 31 05 95 c9 a6 ab a4 15 b5 f3 a3 5c 68 15 f3 2f |1..........\h../|
00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........|
-000000a0 00 00 00 00 00 17 b0 ba 69 00 94 0c 79 3f f7 39 |........i...y?.9|
-000000b0 be a6 4b 52 b6 5e c7 c1 98 f5 04 b2 78 1f 92 4f |..KR.^......x..O|
-000000c0 4f 50 2d 59 2d |OP-Y-|
+000000a0 00 00 00 00 00 78 71 a1 35 b1 2b e1 5d 85 d7 9b |.....xq.5.+.]...|
+000000b0 77 b2 39 20 a9 86 4c 99 0c 96 0d bc 50 f6 a2 ab |w.9 ..L.....P...|
+000000c0 04 80 30 1b 08 |..0..|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificateNotFound b/src/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificateNotFound
index 4139c92aa0..6fbad262a1 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificateNotFound
+++ b/src/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificateNotFound
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 99 01 00 00 95 03 03 cf 60 be 69 fc |............`.i.|
-00000010 d8 3d f8 5e 5a 67 1d 86 93 9a b1 58 4e ca 35 d8 |.=.^Zg.....XN.5.|
-00000020 2d 92 56 f8 74 b0 9a 96 20 75 46 00 00 04 00 2f |-.V.t... uF..../|
+00000000 16 03 01 00 99 01 00 00 95 03 03 d9 85 58 6e 7f |.............Xn.|
+00000010 2d b4 cd f0 04 75 ef 4a 41 8a f9 2e 87 ae 63 c8 |-....u.JA.....c.|
+00000020 59 4b a2 4c 4f 46 c4 15 91 2e 7c 00 00 04 00 2f |YK.LOF....|..../|
00000030 00 ff 01 00 00 68 00 00 00 10 00 0e 00 00 0b 73 |.....h.........s|
00000040 6e 69 74 65 73 74 2e 63 6f 6d 00 0b 00 04 03 00 |nitest.com......|
00000050 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 |................|
@@ -53,31 +53,31 @@
00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
00000290 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 86 10 00 00 82 00 80 aa e3 c3 d5 76 |...............v|
-00000010 d7 f7 da d5 93 39 8f 6d c2 6a ed dc b1 69 c9 2e |.....9.m.j...i..|
-00000020 74 55 e3 2a c8 7d 03 f5 a6 6a 4e 04 b1 7f 14 86 |tU.*.}...jN.....|
-00000030 4c 5a 0d 55 00 dc 58 2b b6 34 bb 51 b0 d6 df ff |LZ.U..X+.4.Q....|
-00000040 ab 0e 1a a8 df b1 58 de 73 9d 94 e4 d1 26 28 df |......X.s....&(.|
-00000050 64 09 fd b0 bc d5 9e 85 0d e8 0c ff 1a 5c 87 47 |d............\.G|
-00000060 57 d0 3e a8 46 c6 5d c4 57 5c 95 c1 ca 91 69 c3 |W.>.F.].W\....i.|
-00000070 26 2f 93 0a f8 56 51 10 e9 ff f2 82 4f 21 54 30 |&/...VQ.....O!T0|
-00000080 d3 87 fd e9 e6 a1 05 53 d0 b4 10 14 03 03 00 01 |.......S........|
-00000090 01 16 03 03 00 40 1f 6b ca bc 42 19 fe c6 64 cf |.....@.k..B...d.|
-000000a0 6f de ff 54 28 56 de 1a 99 fb 19 d7 4a 5e 34 97 |o..T(V......J^4.|
-000000b0 f6 38 99 17 16 fb 06 ae 88 fb a6 07 2f 01 7b 54 |.8........../.{T|
-000000c0 63 8a 4a c1 6b ee 4e 61 4e c1 46 b5 d6 8f 51 a9 |c.J.k.NaN.F...Q.|
-000000d0 fb 07 9b 88 27 20 |....' |
+00000000 16 03 03 00 86 10 00 00 82 00 80 5a 46 e5 a3 fb |...........ZF...|
+00000010 1d 57 11 df 01 db d8 df 8c 2f 25 4a 23 7a 62 38 |.W......./%J#zb8|
+00000020 49 b7 fa 2c 96 94 38 62 b5 9e db 5b 84 d8 8c 24 |I..,..8b...[...$|
+00000030 ec 80 e8 f7 c6 bf 8f fc ba 2c 46 f6 ea e6 be 02 |.........,F.....|
+00000040 fb 43 2c 97 82 6e 0e ce 1d 16 39 80 09 97 da 65 |.C,..n....9....e|
+00000050 4a ad 87 02 2c f3 6a ce 44 c0 c3 16 ef 67 86 62 |J...,.j.D....g.b|
+00000060 14 1a 85 7a 82 a7 b8 6f 55 8f 1e fb 5d 2d a8 cb |...z...oU...]-..|
+00000070 ec 77 0d b0 b3 1b a1 99 c9 51 e8 63 98 1a 31 f4 |.w.......Q.c..1.|
+00000080 b2 17 b5 bf 57 fb 23 47 ee 1e d3 14 03 03 00 01 |....W.#G........|
+00000090 01 16 03 03 00 40 61 a2 82 3b 6f c3 f6 8b 1d 93 |.....@a..;o.....|
+000000a0 42 f6 81 a4 e1 3b bd ab 6f d1 9d 04 a6 be f4 1b |B....;..o.......|
+000000b0 c7 0b 63 c5 d2 4d 8b 69 41 5a 65 8d 8d b1 83 92 |..c..M.iAZe.....|
+000000c0 2d d6 6c c5 45 c7 99 83 89 b7 d5 a1 ae 1b 33 05 |-.l.E.........3.|
+000000d0 d5 00 9f cb 79 50 |....yP|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....|
-00000010 00 00 00 00 00 00 00 00 00 00 00 62 37 c3 c7 5e |...........b7..^|
-00000020 7a 8c 16 99 2d a4 21 cd 44 ab ae ff 52 d4 a9 6f |z...-.!.D...R..o|
-00000030 fe 58 9a 61 2e ed 51 47 8b 9f f1 ca be b9 46 78 |.X.a..QG......Fx|
-00000040 9a fc d0 38 45 da a9 41 fd 51 8f 17 03 03 00 40 |...8E..A.Q.....@|
+00000010 00 00 00 00 00 00 00 00 00 00 00 29 51 0e ac ef |...........)Q...|
+00000020 7b ef 53 95 05 d9 4f 28 97 a2 d6 ff 44 e1 0f fb |{.S...O(....D...|
+00000030 ed e2 ac f4 6c 46 5f 91 07 ba f0 8f 37 37 8d 77 |....lF_.....77.w|
+00000040 7d a8 32 f5 4c f8 fd fc 86 ed 02 17 03 03 00 40 |}.2.L..........@|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
-00000060 7d aa 32 6f 59 1c d9 83 fe 11 2f ff b7 92 fb 22 |}.2oY...../...."|
-00000070 c0 9c 77 d6 73 66 da 10 f1 36 61 34 0f e6 e9 77 |..w.sf...6a4...w|
-00000080 8a 5c c1 8c ba 36 9d cc 8d 3f 48 03 2c c1 a5 1e |.\...6...?H.,...|
+00000060 2d 65 8c 14 51 77 fb 37 61 b0 37 2b 74 8b 9e 8d |-e..Qw.7a.7+t...|
+00000070 7e 72 c9 af 46 eb 05 72 8a b4 42 dc e9 6c df 01 |~r..F..r..B..l..|
+00000080 d2 c6 eb 48 f9 a9 a1 fd 6f 58 b2 76 95 13 df 29 |...H....oX.v...)|
00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........|
-000000a0 00 00 00 00 00 29 14 57 d1 dc f3 ab 63 40 92 00 |.....).W....c@..|
-000000b0 31 3b d5 36 a8 3c e3 cf b5 64 ee b7 e9 36 86 75 |1;.6.<...d...6.u|
-000000c0 6e d8 91 29 f0 |n..).|
+000000a0 00 00 00 00 00 81 a1 ed 82 f3 3d d4 ea af 32 0d |..........=...2.|
+000000b0 b2 b4 ab 7e 94 1b 88 95 8b 72 22 57 b1 35 96 12 |...~.....r"W.5..|
+000000c0 45 57 68 d7 dc |EWh..|
diff --git a/src/crypto/tls/testdata/Server-TLSv12-X25519 b/src/crypto/tls/testdata/Server-TLSv12-X25519
index f8e6ab38d1..ca3e49b93b 100644
--- a/src/crypto/tls/testdata/Server-TLSv12-X25519
+++ b/src/crypto/tls/testdata/Server-TLSv12-X25519
@@ -1,7 +1,7 @@
>>> Flow 1 (client to server)
-00000000 16 03 01 00 8f 01 00 00 8b 03 03 77 a6 19 8a 94 |...........w....|
-00000010 4a 1a d4 51 10 98 c3 22 5d 5d 76 2d 4f 27 ea e8 |J..Q..."]]v-O'..|
-00000020 61 d0 10 7a 08 43 23 42 b0 e0 12 00 00 04 c0 2f |a..z.C#B......./|
+00000000 16 03 01 00 8f 01 00 00 8b 03 03 48 6b c4 66 fd |...........Hk.f.|
+00000010 74 9f 73 e7 c8 4c 12 5b 6a e0 3d a6 5b ed f7 78 |t.s..L.[j.=.[..x|
+00000020 f1 93 b3 1b 1f ee 2e bc 85 f7 4e 00 00 04 c0 2f |..........N..../|
00000030 00 ff 01 00 00 5e 00 00 00 0e 00 0c 00 00 09 31 |.....^.........1|
00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
00000050 00 0a 00 04 00 02 00 1d 00 16 00 00 00 17 00 00 |................|
@@ -54,28 +54,28 @@
00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............|
000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)|
000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;|
-000002c0 74 08 04 00 80 0f e7 f4 b4 b9 f2 83 95 26 d7 70 |t............&.p|
-000002d0 5f b2 e3 5e 42 86 b6 67 0a df 4e 60 2d d2 91 be |_..^B..g..N`-...|
-000002e0 2c ba c1 24 9c 57 29 eb aa df 52 e5 8e 5f 9c ab |,..$.W)...R.._..|
-000002f0 9c 88 c5 8a 92 fd b6 d5 e2 6b 0d ea 1c de 73 22 |.........k....s"|
-00000300 a1 51 05 e0 b6 87 e1 e4 2b 8e 1d 06 26 53 37 4e |.Q......+...&S7N|
-00000310 c7 8f 05 4a 0c 48 69 d3 7b f8 44 33 7b 2b 54 f5 |...J.Hi.{.D3{+T.|
-00000320 d9 a8 70 f3 6d b5 1c e4 4d 53 5f 0d 29 76 92 d3 |..p.m...MS_.)v..|
-00000330 63 19 25 b0 8c c6 31 13 e4 b5 d5 d0 b9 47 ed 54 |c.%...1......G.T|
-00000340 28 82 6c 04 a9 16 03 03 00 04 0e 00 00 00 |(.l...........|
+000002c0 74 04 01 00 80 6f 80 d8 15 ba df d3 5d d9 71 5f |t....o......].q_|
+000002d0 25 f0 4f 03 1f 62 11 f4 33 91 34 08 6e d0 49 b9 |%.O..b..3.4.n.I.|
+000002e0 45 a6 37 85 73 36 c6 e7 45 c0 63 c9 66 0f b1 ae |E.7.s6..E.c.f...|
+000002f0 86 33 b6 2a 24 d3 87 39 c8 62 da 0b 5d ae b0 74 |.3.*$..9.b..]..t|
+00000300 0d b9 36 6b 1b 97 86 d8 65 fa 46 75 6f ef d9 87 |..6k....e.Fuo...|
+00000310 6d b9 91 bb dc 47 42 23 c8 70 2a ba 65 0b 77 df |m....GB#.p*.e.w.|
+00000320 57 6d 89 22 d8 36 f5 69 14 bc e1 c7 4c 80 22 0a |Wm.".6.i....L.".|
+00000330 53 11 90 e0 61 30 48 29 2d 7c cf 17 94 a8 47 77 |S...a0H)-|....Gw|
+00000340 24 17 21 ec 04 16 03 03 00 04 0e 00 00 00 |$.!...........|
>>> Flow 3 (client to server)
-00000000 16 03 03 00 25 10 00 00 21 20 a4 db 55 a3 5a 6f |....%...! ..U.Zo|
-00000010 af bf a2 53 ad 81 4d ea ef c0 d7 02 5d 42 9f ee |...S..M.....]B..|
-00000020 34 ff bf 08 c9 13 56 8c e3 26 14 03 03 00 01 01 |4.....V..&......|
-00000030 16 03 03 00 28 bd 32 89 70 2a eb 54 d1 ae 60 08 |....(.2.p*.T..`.|
-00000040 4e 05 c9 e8 bb a7 fc 96 56 1a ba c7 51 a5 4d 2a |N.......V...Q.M*|
-00000050 de da 6e a9 97 82 aa 37 44 00 4a 1f 0a |..n....7D.J..|
+00000000 16 03 03 00 25 10 00 00 21 20 a0 e5 33 b9 5e e5 |....%...! ..3.^.|
+00000010 11 68 48 53 f1 06 5b ea c7 2b 21 60 d1 ec e4 aa |.hHS..[..+!`....|
+00000020 15 b9 38 bb c5 4d e4 c7 cf 17 14 03 03 00 01 01 |..8..M..........|
+00000030 16 03 03 00 28 41 1f 89 64 4d bb 36 48 36 97 d7 |....(A..dM.6H6..|
+00000040 1c 9c 44 9b 60 77 1e 73 87 7c f5 47 e4 e2 cd f8 |..D.`w.s.|.G....|
+00000050 fc 76 fe f3 38 34 4f ab 4a ce 55 66 6e |.v..84O.J.Ufn|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....|
-00000010 00 00 00 7e 16 80 9b 85 03 3b 19 35 dc 22 75 4d |...~.....;.5."uM|
-00000020 08 36 ad ee 24 f2 75 de fe c2 c6 ba 91 62 1d 29 |.6..$.u......b.)|
-00000030 68 53 d3 17 03 03 00 25 00 00 00 00 00 00 00 01 |hS.....%........|
-00000040 65 36 ef c0 52 ae be bc 94 af 01 d6 c1 a8 2c 04 |e6..R.........,.|
-00000050 3c 83 a2 88 61 7f 41 c0 76 ec aa 52 8d 15 03 03 |<...a.A.v..R....|
-00000060 00 1a 00 00 00 00 00 00 00 02 4a dd b0 50 cf 59 |..........J..P.Y|
-00000070 01 67 74 45 f2 ae 47 f1 38 ef 51 04 |.gtE..G.8.Q.|
+00000010 00 00 00 44 d3 59 7d fc 8a 85 c2 67 f6 b2 6c 43 |...D.Y}....g..lC|
+00000020 5a 77 c0 96 a4 69 0f ec f6 fa 27 00 4c 04 e1 23 |Zw...i....'.L..#|
+00000030 c5 1e d9 17 03 03 00 25 00 00 00 00 00 00 00 01 |.......%........|
+00000040 3f 7f d6 e8 bb 6c 7f 1c d2 97 38 88 15 40 9c e5 |?....l....8..@..|
+00000050 1f 0b ac 83 e7 8b 57 0d 6b 62 22 0b 8e 15 03 03 |......W.kb".....|
+00000060 00 1a 00 00 00 00 00 00 00 02 d8 e7 53 15 ab a7 |............S...|
+00000070 e4 62 10 fd 48 be f5 c8 09 98 92 ad |.b..H.......|
diff --git a/src/database/sql/convert.go b/src/database/sql/convert.go
index 7a3b5fa7da..4c056a1eda 100644
--- a/src/database/sql/convert.go
+++ b/src/database/sql/convert.go
@@ -288,6 +288,11 @@ func convertAssignRows(dest, src interface{}, rows *Rows) error {
*d = s.AppendFormat((*d)[:0], time.RFC3339Nano)
return nil
}
+ case decimalDecompose:
+ switch d := dest.(type) {
+ case decimalCompose:
+ return d.Compose(s.Decompose(nil))
+ }
case nil:
switch d := dest.(type) {
case *interface{}:
@@ -553,3 +558,42 @@ func callValuerValue(vr driver.Valuer) (v driver.Value, err error) {
}
return vr.Value()
}
+
+// decimal composes or decomposes a decimal value to and from individual parts.
+// There are four parts: a boolean negative flag, a form byte with three possible states
+// (finite=0, infinite=1, NaN=2), a base-2 big-endian integer
+// coefficient (also known as a significand) as a []byte, and an int32 exponent.
+// These are composed into a final value as "decimal = (neg) (form=finite) coefficient * 10 ^ exponent".
+// A zero length coefficient is a zero value.
+// The big-endian integer coefficent stores the most significant byte first (at coefficent[0]).
+// If the form is not finite the coefficient and exponent should be ignored.
+// The negative parameter may be set to true for any form, although implementations are not required
+// to respect the negative parameter in the non-finite form.
+//
+// Implementations may choose to set the negative parameter to true on a zero or NaN value,
+// but implementations that do not differentiate between negative and positive
+// zero or NaN values should ignore the negative parameter without error.
+// If an implementation does not support Infinity it may be converted into a NaN without error.
+// If a value is set that is larger than what is supported by an implementation,
+// an error must be returned.
+// Implementations must return an error if a NaN or Infinity is attempted to be set while neither
+// are supported.
+//
+// NOTE(kardianos): This is an experimental interface. See https://golang.org/issue/30870
+type decimal interface {
+ decimalDecompose
+ decimalCompose
+}
+
+type decimalDecompose interface {
+ // Decompose returns the internal decimal state in parts.
+ // If the provided buf has sufficient capacity, buf may be returned as the coefficient with
+ // the value set and length set as appropriate.
+ Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32)
+}
+
+type decimalCompose interface {
+ // Compose sets the internal decimal value from parts. If the value cannot be
+ // represented then an error should be returned.
+ Compose(form byte, negative bool, coefficient []byte, exponent int32) error
+}
diff --git a/src/database/sql/convert_test.go b/src/database/sql/convert_test.go
index 412f0b1823..8a82891c25 100644
--- a/src/database/sql/convert_test.go
+++ b/src/database/sql/convert_test.go
@@ -494,3 +494,107 @@ func TestDriverArgs(t *testing.T) {
}
}
}
+
+type dec struct {
+ form byte
+ neg bool
+ coefficient [16]byte
+ exponent int32
+}
+
+func (d dec) Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32) {
+ coef := make([]byte, 16)
+ copy(coef, d.coefficient[:])
+ return d.form, d.neg, coef, d.exponent
+}
+
+func (d *dec) Compose(form byte, negative bool, coefficient []byte, exponent int32) error {
+ switch form {
+ default:
+ return fmt.Errorf("unknown form %d", form)
+ case 1, 2:
+ d.form = form
+ d.neg = negative
+ return nil
+ case 0:
+ }
+ d.form = form
+ d.neg = negative
+ d.exponent = exponent
+
+ // This isn't strictly correct, as the extra bytes could be all zero,
+ // ignore this for this test.
+ if len(coefficient) > 16 {
+ return fmt.Errorf("coefficent too large")
+ }
+ copy(d.coefficient[:], coefficient)
+
+ return nil
+}
+
+type decFinite struct {
+ neg bool
+ coefficient [16]byte
+ exponent int32
+}
+
+func (d decFinite) Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32) {
+ coef := make([]byte, 16)
+ copy(coef, d.coefficient[:])
+ return 0, d.neg, coef, d.exponent
+}
+
+func (d *decFinite) Compose(form byte, negative bool, coefficient []byte, exponent int32) error {
+ switch form {
+ default:
+ return fmt.Errorf("unknown form %d", form)
+ case 1, 2:
+ return fmt.Errorf("unsupported form %d", form)
+ case 0:
+ }
+ d.neg = negative
+ d.exponent = exponent
+
+ // This isn't strictly correct, as the extra bytes could be all zero,
+ // ignore this for this test.
+ if len(coefficient) > 16 {
+ return fmt.Errorf("coefficent too large")
+ }
+ copy(d.coefficient[:], coefficient)
+
+ return nil
+}
+
+func TestDecimal(t *testing.T) {
+ list := []struct {
+ name string
+ in decimalDecompose
+ out dec
+ err bool
+ }{
+ {name: "same", in: dec{exponent: -6}, out: dec{exponent: -6}},
+
+ // Ensure reflection is not used to assign the value by using different types.
+ {name: "diff", in: decFinite{exponent: -6}, out: dec{exponent: -6}},
+
+ {name: "bad-form", in: dec{form: 200}, err: true},
+ }
+ for _, item := range list {
+ t.Run(item.name, func(t *testing.T) {
+ out := dec{}
+ err := convertAssign(&out, item.in)
+ if item.err {
+ if err == nil {
+ t.Fatalf("unexpected nil error")
+ }
+ return
+ }
+ if err != nil {
+ t.Fatalf("unexpected error: %v", err)
+ }
+ if !reflect.DeepEqual(out, item.out) {
+ t.Fatalf("got %#v want %#v", out, item.out)
+ }
+ })
+ }
+}
diff --git a/src/database/sql/driver/types.go b/src/database/sql/driver/types.go
index 8b3cb6c8f6..24c3a45483 100644
--- a/src/database/sql/driver/types.go
+++ b/src/database/sql/driver/types.go
@@ -38,6 +38,7 @@ type ValueConverter interface {
// themselves to a driver Value.
type Valuer interface {
// Value returns a driver Value.
+ // Value must not panic.
Value() (Value, error)
}
@@ -179,6 +180,8 @@ func IsValue(v interface{}) bool {
switch v.(type) {
case []byte, bool, float64, int64, string, time.Time:
return true
+ case decimalDecompose:
+ return true
}
return false
}
@@ -235,7 +238,8 @@ func (defaultConverter) ConvertValue(v interface{}) (Value, error) {
return v, nil
}
- if vr, ok := v.(Valuer); ok {
+ switch vr := v.(type) {
+ case Valuer:
sv, err := callValuerValue(vr)
if err != nil {
return nil, err
@@ -244,6 +248,10 @@ func (defaultConverter) ConvertValue(v interface{}) (Value, error) {
return nil, fmt.Errorf("non-Value type %T returned from Value", sv)
}
return sv, nil
+
+ // For now, continue to prefer the Valuer interface over the decimal decompose interface.
+ case decimalDecompose:
+ return vr, nil
}
rv := reflect.ValueOf(v)
@@ -280,3 +288,10 @@ func (defaultConverter) ConvertValue(v interface{}) (Value, error) {
}
return nil, fmt.Errorf("unsupported type %T, a %s", v, rv.Kind())
}
+
+type decimalDecompose interface {
+ // Decompose returns the internal decimal state into parts.
+ // If the provided buf has sufficient capacity, buf may be returned as the coefficient with
+ // the value set and length set as appropriate.
+ Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32)
+}
diff --git a/src/database/sql/driver/types_test.go b/src/database/sql/driver/types_test.go
index 0379bf8892..4c2996da85 100644
--- a/src/database/sql/driver/types_test.go
+++ b/src/database/sql/driver/types_test.go
@@ -57,6 +57,7 @@ var valueConverterTests = []valueConverterTest{
{DefaultParameterConverter, bs{1}, []byte{1}, ""},
{DefaultParameterConverter, s("a"), "a", ""},
{DefaultParameterConverter, is{1}, nil, "unsupported type driver.is, a slice of int"},
+ {DefaultParameterConverter, dec{exponent: -6}, dec{exponent: -6}, ""},
}
func TestValueConverters(t *testing.T) {
@@ -79,3 +80,16 @@ func TestValueConverters(t *testing.T) {
}
}
}
+
+type dec struct {
+ form byte
+ neg bool
+ coefficient [16]byte
+ exponent int32
+}
+
+func (d dec) Decompose(buf []byte) (form byte, negative bool, coefficient []byte, exponent int32) {
+ coef := make([]byte, 16)
+ copy(coef, d.coefficient[:])
+ return d.form, d.neg, coef, d.exponent
+}
diff --git a/src/database/sql/sql.go b/src/database/sql/sql.go
index 27adf69122..5c5b7dc7e9 100644
--- a/src/database/sql/sql.go
+++ b/src/database/sql/sql.go
@@ -1792,6 +1792,8 @@ type Conn struct {
done int32
}
+// grabConn takes a context to implement stmtConnGrabber
+// but the context is not used.
func (c *Conn) grabConn(context.Context) (*driverConn, releaseConn, error) {
if atomic.LoadInt32(&c.done) != 0 {
return nil, nil, ErrConnDone
@@ -1856,6 +1858,39 @@ func (c *Conn) PrepareContext(ctx context.Context, query string) (*Stmt, error)
return c.db.prepareDC(ctx, dc, release, c, query)
}
+// Raw executes f exposing the underlying driver connection for the
+// duration of f. The driverConn must not be used outside of f.
+//
+// Once f returns and err is nil, the Conn will continue to be usable
+// until Conn.Close is called.
+func (c *Conn) Raw(f func(driverConn interface{}) error) (err error) {
+ var dc *driverConn
+ var release releaseConn
+
+ // grabConn takes a context to implement stmtConnGrabber, but the context is not used.
+ dc, release, err = c.grabConn(nil)
+ if err != nil {
+ return
+ }
+ fPanic := true
+ dc.Mutex.Lock()
+ defer func() {
+ dc.Mutex.Unlock()
+
+ // If f panics fPanic will remain true.
+ // Ensure an error is passed to release so the connection
+ // may be discarded.
+ if fPanic {
+ err = driver.ErrBadConn
+ }
+ release(err)
+ }()
+ err = f(dc.ci)
+ fPanic = false
+
+ return
+}
+
// BeginTx starts a transaction.
//
// The provided context is used until the transaction is committed or rolled back.
diff --git a/src/database/sql/sql_test.go b/src/database/sql/sql_test.go
index 260374d413..f68cefe43a 100644
--- a/src/database/sql/sql_test.go
+++ b/src/database/sql/sql_test.go
@@ -1339,6 +1339,54 @@ func TestConnQuery(t *testing.T) {
}
}
+func TestConnRaw(t *testing.T) {
+ db := newTestDB(t, "people")
+ defer closeDB(t, db)
+
+ ctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
+ conn, err := db.Conn(ctx)
+ if err != nil {
+ t.Fatal(err)
+ }
+ conn.dc.ci.(*fakeConn).skipDirtySession = true
+ defer conn.Close()
+
+ sawFunc := false
+ err = conn.Raw(func(dc interface{}) error {
+ sawFunc = true
+ if _, ok := dc.(*fakeConn); !ok {
+ return fmt.Errorf("got %T want *fakeConn", dc)
+ }
+ return nil
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !sawFunc {
+ t.Fatal("Raw func not called")
+ }
+
+ func() {
+ defer func() {
+ x := recover()
+ if x == nil {
+ t.Fatal("expected panic")
+ }
+ conn.closemu.Lock()
+ closed := conn.dc == nil
+ conn.closemu.Unlock()
+ if !closed {
+ t.Fatal("expected connection to be closed after panic")
+ }
+ }()
+ err = conn.Raw(func(dc interface{}) error {
+ panic("Conn.Raw panic should return an error")
+ })
+ t.Fatal("expected panic from Raw func")
+ }()
+}
+
func TestCursorFake(t *testing.T) {
db := newTestDB(t, "people")
defer closeDB(t, db)
@@ -3558,7 +3606,7 @@ type nvcConn struct {
skipNamedValueCheck bool
}
-type decimal struct {
+type decimalInt struct {
value int
}
@@ -3582,7 +3630,7 @@ func (c *nvcConn) CheckNamedValue(nv *driver.NamedValue) error {
nv.Value = "OUT:*string"
}
return nil
- case decimal, []int64:
+ case decimalInt, []int64:
return nil
case doNotInclude:
return driver.ErrRemoveArgument
@@ -3611,13 +3659,13 @@ func TestNamedValueChecker(t *testing.T) {
}
o1 := ""
- _, err = db.ExecContext(ctx, "INSERT|keys|dec1=?A,str1=?,out1=?O1,array1=?", Named("A", decimal{123}), "hello", Named("O1", Out{Dest: &o1}), []int64{42, 128, 707}, doNotInclude{})
+ _, err = db.ExecContext(ctx, "INSERT|keys|dec1=?A,str1=?,out1=?O1,array1=?", Named("A", decimalInt{123}), "hello", Named("O1", Out{Dest: &o1}), []int64{42, 128, 707}, doNotInclude{})
if err != nil {
t.Fatal("exec insert", err)
}
var (
str1 string
- dec1 decimal
+ dec1 decimalInt
arr1 []int64
)
err = db.QueryRowContext(ctx, "SELECT|keys|dec1,str1,array1|").Scan(&dec1, &str1, &arr1)
@@ -3627,7 +3675,7 @@ func TestNamedValueChecker(t *testing.T) {
list := []struct{ got, want interface{} }{
{o1, "from-server"},
- {dec1, decimal{123}},
+ {dec1, decimalInt{123}},
{str1, "hello"},
{arr1, []int64{42, 128, 707}},
}
@@ -3660,7 +3708,7 @@ func TestNamedValueCheckerSkip(t *testing.T) {
t.Fatal("exec create", err)
}
- _, err = db.ExecContext(ctx, "INSERT|keys|dec1=?A", Named("A", decimal{123}))
+ _, err = db.ExecContext(ctx, "INSERT|keys|dec1=?A", Named("A", decimalInt{123}))
if err == nil {
t.Fatalf("expected error with bad argument, got %v", err)
}
diff --git a/src/debug/macho/macho.go b/src/debug/macho/macho.go
index 7bc1950bfd..49e107eed3 100644
--- a/src/debug/macho/macho.go
+++ b/src/debug/macho/macho.go
@@ -3,7 +3,12 @@
// license that can be found in the LICENSE file.
// Mach-O header data structures
-// http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html
+// Originally at:
+// http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html (since deleted by Apply)
+// Archived copy at:
+// https://web.archive.org/web/20090819232456/http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachORuntime/index.html
+// For cloned PDF see:
+// https://github.com/aidansteele/osx-abi-macho-file-format-reference
package macho
diff --git a/src/errors/example_test.go b/src/errors/example_test.go
index d7dd782bef..5dc8841237 100644
--- a/src/errors/example_test.go
+++ b/src/errors/example_test.go
@@ -5,9 +5,7 @@
package errors_test
import (
- "errors"
"fmt"
- "os"
"time"
)
@@ -34,17 +32,3 @@ func Example() {
}
// Output: 1989-03-15 22:30:00 +0000 UTC: the file system has gone away
}
-
-func ExampleAs() {
- if _, err := os.Open("non-existing"); err != nil {
- var pathError *os.PathError
- if errors.As(err, &pathError) {
- fmt.Println("Failed at path:", pathError.Path)
- } else {
- fmt.Println(err)
- }
- }
-
- // Output:
- // Failed at path: non-existing
-}
diff --git a/src/errors/wrap.go b/src/errors/wrap.go
index 760a08a4ef..666d1ff207 100644
--- a/src/errors/wrap.go
+++ b/src/errors/wrap.go
@@ -47,15 +47,16 @@ func Is(err, target error) bool {
}
}
-// As finds the first error in err's chain that matches the type to which target
-// points, and if so, sets the target to its value and returns true. An error
-// matches a type if it is assignable to the target type, or if it has a method
-// As(interface{}) bool such that As(target) returns true. As will panic if
-// target is not a non-nil pointer to a type which implements error or is of
-// interface type. As returns false if error is nil.
+// As finds the first error in err's chain that matches target, and if so, sets
+// target to that error value and returns true.
//
-// The As method should set the target to its value and return true if err
-// matches the type to which target points.
+// An error matches target if the error's concrete value is assignable to the value
+// pointed to by target, or if the error has a method As(interface{}) bool such that
+// As(target) returns true. In the latter case, the As method is responsible for
+// setting target.
+//
+// As will panic if target is not a non-nil pointer to either a type that implements
+// error, or to any interface type. As returns false if err is nil.
func As(err error, target interface{}) bool {
if target == nil {
panic("errors: target cannot be nil")
diff --git a/src/errors/wrap_test.go b/src/errors/wrap_test.go
index 2055316756..590c1857e3 100644
--- a/src/errors/wrap_test.go
+++ b/src/errors/wrap_test.go
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"os"
+ "reflect"
"testing"
)
@@ -60,6 +61,8 @@ type poser struct {
f func(error) bool
}
+var poserPathErr = &os.PathError{Op: "poser"}
+
func (p *poser) Error() string { return p.msg }
func (p *poser) Is(err error) bool { return p.f(err) }
func (p *poser) As(err interface{}) bool {
@@ -67,9 +70,9 @@ func (p *poser) As(err interface{}) bool {
case **poser:
*x = p
case *errorT:
- *x = errorT{}
+ *x = errorT{"poser"}
case **os.PathError:
- *x = &os.PathError{}
+ *x = poserPathErr
default:
return false
}
@@ -82,58 +85,74 @@ func TestAs(t *testing.T) {
var timeout interface{ Timeout() bool }
var p *poser
_, errF := os.Open("non-existing")
+ poserErr := &poser{"oh no", nil}
testCases := []struct {
err error
target interface{}
match bool
+ want interface{} // value of target on match
}{{
nil,
&errP,
false,
+ nil,
}, {
- wrapped{"pittied the fool", errorT{}},
+ wrapped{"pitied the fool", errorT{"T"}},
&errT,
true,
+ errorT{"T"},
}, {
errF,
&errP,
true,
+ errF,
}, {
errorT{},
&errP,
false,
+ nil,
}, {
wrapped{"wrapped", nil},
&errT,
false,
+ nil,
}, {
&poser{"error", nil},
&errT,
true,
+ errorT{"poser"},
}, {
&poser{"path", nil},
&errP,
true,
+ poserPathErr,
}, {
- &poser{"oh no", nil},
+ poserErr,
&p,
true,
+ poserErr,
}, {
errors.New("err"),
&timeout,
false,
+ nil,
}, {
errF,
&timeout,
true,
+ errF,
}, {
wrapped{"path error", errF},
&timeout,
true,
+ errF,
}}
for i, tc := range testCases {
name := fmt.Sprintf("%d:As(Errorf(..., %v), %v)", i, tc.err, tc.target)
+ // Clear the target pointer, in case it was set in a previous test.
+ rtarget := reflect.ValueOf(tc.target)
+ rtarget.Elem().Set(reflect.Zero(reflect.TypeOf(tc.target).Elem()))
t.Run(name, func(t *testing.T) {
match := errors.As(tc.err, tc.target)
if match != tc.match {
@@ -142,8 +161,8 @@ func TestAs(t *testing.T) {
if !match {
return
}
- if tc.target == nil {
- t.Fatalf("non-nil result after match")
+ if got := rtarget.Elem().Interface(); got != tc.want {
+ t.Fatalf("got %#v, want %#v", got, tc.want)
}
})
}
@@ -193,9 +212,9 @@ func TestUnwrap(t *testing.T) {
}
}
-type errorT struct{}
+type errorT struct{ s string }
-func (errorT) Error() string { return "errorT" }
+func (e errorT) Error() string { return fmt.Sprintf("errorT(%s)", e.s) }
type wrapped struct {
msg string
@@ -218,3 +237,17 @@ func (errorUncomparable) Is(target error) bool {
_, ok := target.(errorUncomparable)
return ok
}
+
+func ExampleAs() {
+ if _, err := os.Open("non-existing"); err != nil {
+ var pathError *os.PathError
+ if errors.As(err, &pathError) {
+ fmt.Println("Failed at path:", pathError.Path)
+ } else {
+ fmt.Println(err)
+ }
+ }
+
+ // Output:
+ // Failed at path: non-existing
+}
diff --git a/src/go.mod b/src/go.mod
index 12a85bc8c7..2e0fec4b15 100644
--- a/src/go.mod
+++ b/src/go.mod
@@ -3,8 +3,8 @@ module std
go 1.12
require (
- golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f
- golang.org/x/net v0.0.0-20190514140710-3ec191127204
- golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f // indirect
+ golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8
+ golang.org/x/net v0.0.0-20190607172144-d5cec3884524
+ golang.org/x/sys v0.0.0-20190529130038-5219a1e1c5f8 // indirect
golang.org/x/text v0.3.2 // indirect
)
diff --git a/src/go.sum b/src/go.sum
index 4985320126..f6e979df2b 100644
--- a/src/go.sum
+++ b/src/go.sum
@@ -1,19 +1,13 @@
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d h1:adrbvkTDn9rGnXg2IJDKozEpXXLZN89pdIA+Syt4/u0=
-golang.org/x/crypto v0.0.0-20190424203555-c05e17bb3b2d/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
-golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo=
-golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU=
+golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6 h1:FP8hkuE6yUEaJnK7O2eTuejKWwW+Rhfj80dQ2JcKxCU=
-golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190514140710-3ec191127204 h1:4yG6GqBtw9C+UrLp6s2wtSniayy/Vd/3F7ffLE427XI=
-golang.org/x/net v0.0.0-20190514140710-3ec191127204/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190607172144-d5cec3884524 h1:A4fHjHFi2zGH4/ziDBluIhhGzT/kAuTD1lKHLAztlG8=
+golang.org/x/net v0.0.0-20190607172144-d5cec3884524/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20190425145619-16072639606e h1:4ktJgTV34+N3qOZUc5fAaG3Pb11qzMm3PkAoTAgUZ2I=
-golang.org/x/sys v0.0.0-20190425145619-16072639606e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f h1:Xab8gg26GrI/x3RNdVhVkHHM1XLyGeRBEvz4Q5x4YW8=
-golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190529130038-5219a1e1c5f8 h1:2WjIC11WRITGlVWmyLXKjzIVj1ZwoWZ//tadeUUV6/o=
+golang.org/x/sys v0.0.0-20190529130038-5219a1e1c5f8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
diff --git a/src/go/internal/gccgoimporter/parser.go b/src/go/internal/gccgoimporter/parser.go
index 64a4042a45..76f30bb9ca 100644
--- a/src/go/internal/gccgoimporter/parser.go
+++ b/src/go/internal/gccgoimporter/parser.go
@@ -268,6 +268,10 @@ func (p *parser) parseField(pkg *types.Package) (field *types.Var, tag string) {
// Param = Name ["..."] Type .
func (p *parser) parseParam(pkg *types.Package) (param *types.Var, isVariadic bool) {
name := p.parseName()
+ // Ignore names invented for inlinable functions.
+ if strings.HasPrefix(name, "p.") || strings.HasPrefix(name, "r.") || strings.HasPrefix(name, "$ret") {
+ name = ""
+ }
if p.tok == '<' && p.scanner.Peek() == 'e' {
// EscInfo = "" . (optional and ignored)
p.next()
@@ -293,7 +297,14 @@ func (p *parser) parseParam(pkg *types.Package) (param *types.Var, isVariadic bo
// Var = Name Type .
func (p *parser) parseVar(pkg *types.Package) *types.Var {
name := p.parseName()
- return types.NewVar(token.NoPos, pkg, name, p.parseType(pkg))
+ v := types.NewVar(token.NoPos, pkg, name, p.parseType(pkg))
+ if name[0] == '.' || name[0] == '<' {
+ // This is an unexported variable,
+ // or a variable defined in a different package.
+ // We only want to record exported variables.
+ return nil
+ }
+ return v
}
// Conversion = "convert" "(" Type "," ConstValue ")" .
@@ -547,10 +558,12 @@ func (p *parser) parseNamedType(nlist []int) types.Type {
for p.tok == scanner.Ident {
p.expectKeyword("func")
if p.tok == '/' {
- // Skip a /*nointerface*/ comment.
+ // Skip a /*nointerface*/ or /*asm ID */ comment.
p.expect('/')
p.expect('*')
- p.expect(scanner.Ident)
+ if p.expect(scanner.Ident) == "asm" {
+ p.parseUnquotedString()
+ }
p.expect('*')
p.expect('/')
}
@@ -736,15 +749,29 @@ func (p *parser) parseFunctionType(pkg *types.Package, nlist []int) *types.Signa
// Func = Name FunctionType [InlineBody] .
func (p *parser) parseFunc(pkg *types.Package) *types.Func {
- name := p.parseName()
- if strings.ContainsRune(name, '$') {
- // This is a Type$equal or Type$hash function, which we don't want to parse,
- // except for the types.
- p.discardDirectiveWhileParsingTypes(pkg)
- return nil
+ if p.tok == '/' {
+ // Skip an /*asm ID */ comment.
+ p.expect('/')
+ p.expect('*')
+ if p.expect(scanner.Ident) == "asm" {
+ p.parseUnquotedString()
+ }
+ p.expect('*')
+ p.expect('/')
}
+
+ name := p.parseName()
f := types.NewFunc(token.NoPos, pkg, name, p.parseFunctionType(pkg, nil))
p.skipInlineBody()
+
+ if name[0] == '.' || name[0] == '<' || strings.ContainsRune(name, '$') {
+ // This is an unexported function,
+ // or a function defined in a different package,
+ // or a type$equal or type$hash function.
+ // We only want to record exported functions.
+ return nil
+ }
+
return f
}
@@ -765,7 +792,9 @@ func (p *parser) parseInterfaceType(pkg *types.Package, nlist []int) types.Type
embeddeds = append(embeddeds, p.parseType(pkg))
} else {
method := p.parseFunc(pkg)
- methods = append(methods, method)
+ if method != nil {
+ methods = append(methods, method)
+ }
}
p.expect(';')
}
@@ -1057,22 +1086,6 @@ func (p *parser) parsePackageInit() PackageInit {
return PackageInit{Name: name, InitFunc: initfunc, Priority: priority}
}
-// Throw away tokens until we see a ';'. If we see a '<', attempt to parse as a type.
-func (p *parser) discardDirectiveWhileParsingTypes(pkg *types.Package) {
- for {
- switch p.tok {
- case '\n', ';':
- return
- case '<':
- p.parseType(pkg)
- case scanner.EOF:
- p.error("unexpected EOF")
- default:
- p.next()
- }
- }
-}
-
// Create the package if we have parsed both the package path and package name.
func (p *parser) maybeCreatePackage() {
if p.pkgname != "" && p.pkgpath != "" {
@@ -1210,7 +1223,9 @@ func (p *parser) parseDirective() {
case "var":
p.next()
v := p.parseVar(p.pkg)
- p.pkg.Scope().Insert(v)
+ if v != nil {
+ p.pkg.Scope().Insert(v)
+ }
p.expectEOL()
case "const":
diff --git a/src/html/template/context.go b/src/html/template/context.go
index 7ab3d1fed6..f7d4849928 100644
--- a/src/html/template/context.go
+++ b/src/html/template/context.go
@@ -26,7 +26,11 @@ type context struct {
}
func (c context) String() string {
- return fmt.Sprintf("{%v %v %v %v %v %v %v}", c.state, c.delim, c.urlPart, c.jsCtx, c.attr, c.element, c.err)
+ var err error
+ if c.err != nil {
+ err = c.err
+ }
+ return fmt.Sprintf("{%v %v %v %v %v %v %v}", c.state, c.delim, c.urlPart, c.jsCtx, c.attr, c.element, err)
}
// eq reports whether two contexts are equal.
diff --git a/src/html/template/template.go b/src/html/template/template.go
index 4641a37da3..75437879e2 100644
--- a/src/html/template/template.go
+++ b/src/html/template/template.go
@@ -440,9 +440,10 @@ func parseFiles(t *Template, filenames ...string) (*Template, error) {
return t, nil
}
-// ParseGlob creates a new Template and parses the template definitions from the
-// files identified by the pattern, which must match at least one file. The
-// returned template will have the (base) name and (parsed) contents of the
+// ParseGlob creates a new Template and parses the template definitions from
+// the files identified by the pattern. The files are matched according to the
+// semantics of filepath.Match, and the pattern must match at least one file.
+// The returned template will have the (base) name and (parsed) contents of the
// first file matched by the pattern. ParseGlob is equivalent to calling
// ParseFiles with the list of files matched by the pattern.
//
@@ -453,10 +454,10 @@ func ParseGlob(pattern string) (*Template, error) {
}
// ParseGlob parses the template definitions in the files identified by the
-// pattern and associates the resulting templates with t. The pattern is
-// processed by filepath.Glob and must match at least one file. ParseGlob is
-// equivalent to calling t.ParseFiles with the list of files matched by the
-// pattern.
+// pattern and associates the resulting templates with t. The files are matched
+// according to the semantics of filepath.Match, and the pattern must match at
+// least one file. ParseGlob is equivalent to calling t.ParseFiles with the
+// list of files matched by the pattern.
//
// When parsing multiple files with the same name in different directories,
// the last one mentioned will be the one that results.
diff --git a/src/image/draw/draw.go b/src/image/draw/draw.go
index 3ff1828dc0..932a544483 100644
--- a/src/image/draw/draw.go
+++ b/src/image/draw/draw.go
@@ -90,8 +90,8 @@ func clip(dst Image, r *image.Rectangle, src image.Image, sp *image.Point, mask
}
}
-func processBackward(dst Image, r image.Rectangle, src image.Image, sp image.Point) bool {
- return image.Image(dst) == src &&
+func processBackward(dst image.Image, r image.Rectangle, src image.Image, sp image.Point) bool {
+ return dst == src &&
r.Overlaps(r.Add(sp.Sub(r.Min))) &&
(sp.Y < r.Min.Y || (sp.Y == r.Min.Y && sp.X < r.Min.X))
}
diff --git a/src/internal/testenv/testenv.go b/src/internal/testenv/testenv.go
index 8f69fe0da5..c27fcfa208 100644
--- a/src/internal/testenv/testenv.go
+++ b/src/internal/testenv/testenv.go
@@ -19,6 +19,7 @@ import (
"runtime"
"strconv"
"strings"
+ "sync"
"testing"
)
@@ -146,6 +147,24 @@ func MustHaveExec(t testing.TB) {
}
}
+var execPaths sync.Map // path -> error
+
+// MustHaveExecPath checks that the current system can start the named executable
+// using os.StartProcess or (more commonly) exec.Command.
+// If not, MustHaveExecPath calls t.Skip with an explanation.
+func MustHaveExecPath(t testing.TB, path string) {
+ MustHaveExec(t)
+
+ err, found := execPaths.Load(path)
+ if !found {
+ _, err = exec.LookPath(path)
+ err, _ = execPaths.LoadOrStore(path, err)
+ }
+ if err != nil {
+ t.Skipf("skipping test: %s: %s", path, err)
+ }
+}
+
// HasExternalNetwork reports whether the current system can use
// external (non-localhost) networks.
func HasExternalNetwork() bool {
diff --git a/src/math/example_test.go b/src/math/example_test.go
index 25d6975903..364891324a 100644
--- a/src/math/example_test.go
+++ b/src/math/example_test.go
@@ -135,3 +135,41 @@ func ExampleRoundToEven() {
// 12.0
// 12.0
}
+
+func ExampleLog() {
+ x := math.Log(1)
+ fmt.Printf("%.1f\n", x)
+
+ y := math.Log(2.7183)
+ fmt.Printf("%.1f\n", y)
+ // Output:
+ // 0.0
+ // 1.0
+}
+
+func ExampleLog2() {
+ fmt.Printf("%.1f", math.Log2(256))
+ // Output: 8.0
+}
+
+func ExampleLog10() {
+ fmt.Printf("%.1f", math.Log10(100))
+ // Output: 2.0
+}
+
+func ExampleMod() {
+ c := math.Mod(7, 4)
+ fmt.Printf("%.1f", c)
+ // Output: 3.0
+}
+
+func ExampleAbs() {
+ x := math.Abs(-2)
+ fmt.Printf("%.1f\n", x)
+
+ y := math.Abs(2)
+ fmt.Printf("%.1f\n", y)
+ // Output:
+ // 2.0
+ // 2.0
+}
diff --git a/src/net/cgo_darwin_stub.go b/src/net/cgo_darwin_stub.go
deleted file mode 100644
index 544df7fd6c..0000000000
--- a/src/net/cgo_darwin_stub.go
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright 2019 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.
-
-// +build !netgo,!cgo
-// +build darwin
-
-package net
-
-import (
- "context"
- "errors"
- "sync"
-
- "golang.org/x/net/dns/dnsmessage"
-)
-
-type addrinfoErrno int
-
-func (eai addrinfoErrno) Error() string { return "" }
-func (eai addrinfoErrno) Temporary() bool { return false }
-func (eai addrinfoErrno) Timeout() bool { return false }
-
-func cgoLookupHost(ctx context.Context, name string) (addrs []string, err error, completed bool) {
- resources, err := resolverGetResources(ctx, name, int32(dnsmessage.TypeALL), int32(dnsmessage.ClassINET))
- if err != nil {
- return
- }
- addrs, err = parseHostsFromResources(resources)
- if err != nil {
- return
- }
- return addrs, nil, true
-}
-
-func cgoLookupPort(ctx context.Context, network, service string) (port int, err error, completed bool) {
- port, err = goLookupPort(network, service) // we can just use netgo lookup
- return port, err, err == nil
-}
-
-func cgoLookupIP(ctx context.Context, network, name string) (addrs []IPAddr, err error, completed bool) {
-
- var resources []dnsmessage.Resource
- switch ipVersion(network) {
- case '4':
- resources, err = resolverGetResources(ctx, name, int32(dnsmessage.TypeA), int32(dnsmessage.ClassINET))
- case '6':
- resources, err = resolverGetResources(ctx, name, int32(dnsmessage.TypeAAAA), int32(dnsmessage.ClassINET))
- default:
- resources, err = resolverGetResources(ctx, name, int32(dnsmessage.TypeALL), int32(dnsmessage.ClassINET))
- }
- if err != nil {
- return
- }
-
- addrs, err = parseIPsFromResources(resources)
- if err != nil {
- return
- }
-
- return addrs, nil, true
-}
-
-func cgoLookupCNAME(ctx context.Context, name string) (cname string, err error, completed bool) {
- resources, err := resolverGetResources(ctx, name, int32(dnsmessage.TypeCNAME), int32(dnsmessage.ClassINET))
- if err != nil {
- return
- }
- cname, err = parseCNAMEFromResources(resources)
- if err != nil {
- return "", err, false
- }
- return cname, nil, true
-}
-
-func cgoLookupPTR(ctx context.Context, addr string) (ptrs []string, err error, completed bool) {
- resources, err := resolverGetResources(ctx, addr, int32(dnsmessage.TypePTR), int32(dnsmessage.ClassINET))
- if err != nil {
- return
- }
- ptrs, err = parsePTRsFromResources(resources)
- if err != nil {
- return
- }
- return ptrs, nil, true
-}
-
-var (
- resInitOnce sync.Once
- errCode int32
-)
-
-// resolverGetResources will make a call to the 'res_search' routine in libSystem
-// and parse the output as a slice of resource resources which can then be parsed
-func resolverGetResources(ctx context.Context, hostname string, rtype, class int32) ([]dnsmessage.Resource, error) {
-
- resInitOnce.Do(func() {
- errCode = res_init()
- })
- if errCode < 0 {
- return nil, errors.New("could not initialize name resolver data")
- }
-
- var byteHostname = []byte(hostname)
- var responseBuffer [512]byte
- var size int32
-
- size, errCode = res_search(&byteHostname[0], class, rtype, &responseBuffer[0], int32(len(responseBuffer)))
- if errCode != 0 {
- return nil, errors.New("could not complete domain resolution return code " + string(errCode))
- }
- if size == 0 {
- return nil, errors.New("received empty response")
- }
-
- var msg dnsmessage.Message
- err := msg.Unpack(responseBuffer[:])
- if err != nil {
- return nil, err
- }
-
- var dnsParser dnsmessage.Parser
- if _, err := dnsParser.Start(responseBuffer[:]); err != nil {
- return nil, err
- }
-
- var resources []dnsmessage.Resource
- for {
- r, err := dnsParser.Answer()
- if err == dnsmessage.ErrSectionDone {
- break
- }
- if err != nil {
- return nil, err
- }
- resources = append(resources, r)
- }
- return resources, nil
-}
-
-func parseHostsFromResources(resources []dnsmessage.Resource) ([]string, error) {
- var answers []string
-
- for i := range resources {
- switch resources[i].Header.Type {
- case dnsmessage.TypeA:
- b := resources[i].Body.(*dnsmessage.AResource)
- answers = append(answers, string(b.A[:]))
- case dnsmessage.TypeAAAA:
- b := resources[i].Body.(*dnsmessage.AAAAResource)
- answers = append(answers, string(b.AAAA[:]))
- default:
- return nil, errors.New("could not parse an A or AAAA response from message buffer")
- }
- }
- return answers, nil
-}
-
-func parseIPsFromResources(resources []dnsmessage.Resource) ([]IPAddr, error) {
- var answers []IPAddr
-
- for i := range resources {
- switch resources[i].Header.Type {
- case dnsmessage.TypeA:
- b := resources[i].Body.(*dnsmessage.AResource)
- ip := parseIPv4(string(b.A[:]))
- answers = append(answers, IPAddr{IP: ip})
- case dnsmessage.TypeAAAA:
- b := resources[i].Body.(*dnsmessage.AAAAResource)
- ip, zone := parseIPv6Zone(string(b.AAAA[:]))
- answers = append(answers, IPAddr{IP: ip, Zone: zone})
- default:
- return nil, errors.New("could not parse an A or AAAA response from message buffer")
- }
- }
- return answers, nil
-}
-
-func parseCNAMEFromResources(resources []dnsmessage.Resource) (string, error) {
- if len(resources) == 0 {
- return "", errors.New("no CNAME record received")
- }
- c, ok := resources[0].Body.(*dnsmessage.CNAMEResource)
- if !ok {
- return "", errors.New("could not parse CNAME record")
- }
- return c.CNAME.String(), nil
-}
-
-func parsePTRsFromResources(resources []dnsmessage.Resource) ([]string, error) {
- var answers []string
- for i := range resources {
- switch resources[i].Header.Type {
- case dnsmessage.TypePTR:
- p := resources[0].Body.(*dnsmessage.PTRResource)
- answers = append(answers, p.PTR.String())
- default:
- return nil, errors.New("could not parse a PTR response from message buffer")
-
- }
- }
- return answers, nil
-}
-
-// res_init and res_search are defined in runtime/lookup_darwin.go
-
-func res_init() int32
-
-func res_search(dname *byte, class int32, rtype int32, answer *byte, anslen int32) (int32, int32)
diff --git a/src/net/cgo_stub.go b/src/net/cgo_stub.go
index aa15ab4dc1..041f8af129 100644
--- a/src/net/cgo_stub.go
+++ b/src/net/cgo_stub.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
// +build !cgo netgo
-// +build !darwin
package net
diff --git a/src/net/conf.go b/src/net/conf.go
index 1c88f096ba..971b1a399a 100644
--- a/src/net/conf.go
+++ b/src/net/conf.go
@@ -70,11 +70,6 @@ func initConfVal() {
// their own DNS requests. So always use cgo instead, which
// avoids that.
if runtime.GOOS == "darwin" {
- // Normally we force netGo to be true if building without cgo enabled.
- // On Darwin, we can call libc even if cgo is not enabled, so only set netGo to true
- // if explicitly requested.
- confVal.netGo = dnsMode == "go"
-
confVal.forceCgoLookupHost = true
return
}
diff --git a/src/net/dnsclient_unix_test.go b/src/net/dnsclient_unix_test.go
index 1b67494e51..98304d36ea 100644
--- a/src/net/dnsclient_unix_test.go
+++ b/src/net/dnsclient_unix_test.go
@@ -589,6 +589,8 @@ func TestGoLookupIPOrderFallbackToFile(t *testing.T) {
if err != nil {
t.Fatal(err)
}
+ defer conf.teardown()
+
if err := conf.writeAndUpdate([]string{}); err != nil {
t.Fatal(err)
}
@@ -620,7 +622,6 @@ func TestGoLookupIPOrderFallbackToFile(t *testing.T) {
t.Errorf("%s: address doesn't match expectation. got %v, want %v", name, got, want)
}
}
- defer conf.teardown()
}
// Issue 12712.
diff --git a/src/net/http/client_test.go b/src/net/http/client_test.go
index 2f031e2f9b..de490bc607 100644
--- a/src/net/http/client_test.go
+++ b/src/net/http/client_test.go
@@ -1292,7 +1292,7 @@ func testClientTimeout_Headers(t *testing.T, h2 bool) {
donec := make(chan bool, 1)
cst := newClientServerTest(t, h2, HandlerFunc(func(w ResponseWriter, r *Request) {
<-donec
- }))
+ }), optQuietLog)
defer cst.close()
// Note that we use a channel send here and not a close.
// The race detector doesn't know that we're waiting for a timeout
diff --git a/src/net/http/export_test.go b/src/net/http/export_test.go
index b6965c239e..f0dfa8cd33 100644
--- a/src/net/http/export_test.go
+++ b/src/net/http/export_test.go
@@ -33,6 +33,7 @@ var (
ExportHttp2ConfigureServer = http2ConfigureServer
Export_shouldCopyHeaderOnRedirect = shouldCopyHeaderOnRedirect
Export_writeStatusLine = writeStatusLine
+ Export_is408Message = is408Message
)
const MaxWriteWaitBeforeConnReuse = maxWriteWaitBeforeConnReuse
@@ -244,3 +245,18 @@ func ExportSetH2GoawayTimeout(d time.Duration) (restore func()) {
}
func (r *Request) ExportIsReplayable() bool { return r.isReplayable() }
+
+// ExportCloseTransportConnsAbruptly closes all idle connections from
+// tr in an abrupt way, just reaching into the underlying Conns and
+// closing them, without telling the Transport or its persistConns
+// that it's doing so. This is to simulate the server closing connections
+// on the Transport.
+func ExportCloseTransportConnsAbruptly(tr *Transport) {
+ tr.idleMu.Lock()
+ for _, pcs := range tr.idleConn {
+ for _, pc := range pcs {
+ pc.conn.Close()
+ }
+ }
+ tr.idleMu.Unlock()
+}
diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go
index 0cfdc4e822..173622fc8b 100644
--- a/src/net/http/h2_bundle.go
+++ b/src/net/http/h2_bundle.go
@@ -3832,7 +3832,20 @@ func http2ConfigureServer(s *Server, conf *http2Server) error {
if http2testHookOnConn != nil {
http2testHookOnConn()
}
+ // The TLSNextProto interface predates contexts, so
+ // the net/http package passes down its per-connection
+ // base context via an exported but unadvertised
+ // method on the Handler. This is for internal
+ // net/http<=>http2 use only.
+ var ctx context.Context
+ type baseContexter interface {
+ BaseContext() context.Context
+ }
+ if bc, ok := h.(baseContexter); ok {
+ ctx = bc.BaseContext()
+ }
conf.ServeConn(c, &http2ServeConnOpts{
+ Context: ctx,
Handler: h,
BaseConfig: hs,
})
@@ -3843,6 +3856,10 @@ func http2ConfigureServer(s *Server, conf *http2Server) error {
// ServeConnOpts are options for the Server.ServeConn method.
type http2ServeConnOpts struct {
+ // Context is the base context to use.
+ // If nil, context.Background is used.
+ Context context.Context
+
// BaseConfig optionally sets the base configuration
// for values. If nil, defaults are used.
BaseConfig *Server
@@ -3853,6 +3870,13 @@ type http2ServeConnOpts struct {
Handler Handler
}
+func (o *http2ServeConnOpts) context() context.Context {
+ if o.Context != nil {
+ return o.Context
+ }
+ return context.Background()
+}
+
func (o *http2ServeConnOpts) baseConfig() *Server {
if o != nil && o.BaseConfig != nil {
return o.BaseConfig
@@ -3998,7 +4022,7 @@ func (s *http2Server) ServeConn(c net.Conn, opts *http2ServeConnOpts) {
}
func http2serverConnBaseContext(c net.Conn, opts *http2ServeConnOpts) (ctx context.Context, cancel func()) {
- ctx, cancel = context.WithCancel(context.Background())
+ ctx, cancel = context.WithCancel(opts.context())
ctx = context.WithValue(ctx, LocalAddrContextKey, c.LocalAddr())
if hs := opts.baseConfig(); hs != nil {
ctx = context.WithValue(ctx, ServerContextKey, hs)
diff --git a/src/net/http/roundtrip_js.go b/src/net/http/roundtrip_js.go
index 7d965f844f..6331351a83 100644
--- a/src/net/http/roundtrip_js.go
+++ b/src/net/http/roundtrip_js.go
@@ -11,12 +11,12 @@ import (
"fmt"
"io"
"io/ioutil"
- "os"
"strconv"
- "strings"
"syscall/js"
)
+var uint8Array = js.Global().Get("Uint8Array")
+
// jsFetchMode is a Request.Header map key that, if present,
// signals that the map entry is actually an option to the Fetch API mode setting.
// Valid values are: "cors", "no-cors", "same-origin", "navigate"
@@ -41,9 +41,11 @@ const jsFetchCreds = "js.fetch:credentials"
// Reference: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters
const jsFetchRedirect = "js.fetch:redirect"
+var useFakeNetwork = js.Global().Get("fetch") == js.Undefined()
+
// RoundTrip implements the RoundTripper interface using the WHATWG Fetch API.
func (t *Transport) RoundTrip(req *Request) (*Response, error) {
- if useFakeNetwork() {
+ if useFakeNetwork {
return t.roundTrip(req)
}
@@ -96,9 +98,9 @@ func (t *Transport) RoundTrip(req *Request) (*Response, error) {
return nil, err
}
req.Body.Close()
- a := js.TypedArrayOf(body)
- defer a.Release()
- opt.Set("body", a)
+ buf := uint8Array.New(len(body))
+ js.CopyBytesToJS(buf, body)
+ opt.Set("body", buf)
}
respPromise := js.Global().Call("fetch", req.URL.String(), opt)
var (
@@ -180,12 +182,6 @@ func (t *Transport) RoundTrip(req *Request) (*Response, error) {
var errClosed = errors.New("net/http: reader is closed")
-// useFakeNetwork is used to determine whether the request is made
-// by a test and should be made to use the fake in-memory network.
-func useFakeNetwork() bool {
- return len(os.Args) > 0 && strings.HasSuffix(os.Args[0], ".test")
-}
-
// streamReader implements an io.ReadCloser wrapper for ReadableStream.
// See https://fetch.spec.whatwg.org/#readablestream for more information.
type streamReader struct {
@@ -210,9 +206,7 @@ func (r *streamReader) Read(p []byte) (n int, err error) {
return nil
}
value := make([]byte, result.Get("value").Get("byteLength").Int())
- a := js.TypedArrayOf(value)
- a.Call("set", result.Get("value"))
- a.Release()
+ js.CopyBytesToGo(value, result.Get("value"))
bCh <- value
return nil
})
@@ -273,11 +267,9 @@ func (r *arrayReader) Read(p []byte) (n int, err error) {
)
success := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
// Wrap the input ArrayBuffer with a Uint8Array
- uint8arrayWrapper := js.Global().Get("Uint8Array").New(args[0])
+ uint8arrayWrapper := uint8Array.New(args[0])
value := make([]byte, uint8arrayWrapper.Get("byteLength").Int())
- a := js.TypedArrayOf(value)
- a.Call("set", uint8arrayWrapper)
- a.Release()
+ js.CopyBytesToGo(value, uint8arrayWrapper)
bCh <- value
return nil
})
diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go
index d774915719..e7ed15c3aa 100644
--- a/src/net/http/serve_test.go
+++ b/src/net/http/serve_test.go
@@ -2900,15 +2900,6 @@ func TestStripPrefix(t *testing.T) {
t.Errorf("test 2: got status %v, want %v", g, e)
}
res.Body.Close()
-
- res, err = c.Get(ts.URL + "/foo")
- if err != nil {
- t.Fatal(err)
- }
- if g, e := res.Header.Get("X-Path"), "/"; g != e {
- t.Errorf("test 3: got %s, want %s", g, e)
- }
- res.Body.Close()
}
// https://golang.org/issue/18952.
@@ -4282,7 +4273,7 @@ func testServerEmptyBodyRace(t *testing.T, h2 bool) {
var n int32
cst := newClientServerTest(t, h2, HandlerFunc(func(rw ResponseWriter, req *Request) {
atomic.AddInt32(&n, 1)
- }))
+ }), optQuietLog)
defer cst.close()
var wg sync.WaitGroup
const reqs = 20
@@ -6075,6 +6066,50 @@ func TestServerContexts(t *testing.T) {
}
}
+func TestServerContextsHTTP2(t *testing.T) {
+ setParallel(t)
+ defer afterTest(t)
+ type baseKey struct{}
+ type connKey struct{}
+ ch := make(chan context.Context, 1)
+ ts := httptest.NewUnstartedServer(HandlerFunc(func(rw ResponseWriter, r *Request) {
+ if r.ProtoMajor != 2 {
+ t.Errorf("unexpected HTTP/1.x request")
+ }
+ ch <- r.Context()
+ }))
+ ts.Config.BaseContext = func(ln net.Listener) context.Context {
+ if strings.Contains(reflect.TypeOf(ln).String(), "onceClose") {
+ t.Errorf("unexpected onceClose listener type %T", ln)
+ }
+ return context.WithValue(context.Background(), baseKey{}, "base")
+ }
+ ts.Config.ConnContext = func(ctx context.Context, c net.Conn) context.Context {
+ if got, want := ctx.Value(baseKey{}), "base"; got != want {
+ t.Errorf("in ConnContext, base context key = %#v; want %q", got, want)
+ }
+ return context.WithValue(ctx, connKey{}, "conn")
+ }
+ ts.TLS = &tls.Config{
+ NextProtos: []string{"h2", "http/1.1"},
+ }
+ ts.StartTLS()
+ defer ts.Close()
+ ts.Client().Transport.(*Transport).ForceAttemptHTTP2 = true
+ res, err := ts.Client().Get(ts.URL)
+ if err != nil {
+ t.Fatal(err)
+ }
+ res.Body.Close()
+ ctx := <-ch
+ if got, want := ctx.Value(baseKey{}), "base"; got != want {
+ t.Errorf("base context key = %#v; want %q", got, want)
+ }
+ if got, want := ctx.Value(connKey{}), "conn"; got != want {
+ t.Errorf("conn context key = %#v; want %q", got, want)
+ }
+}
+
// Issue 30710: ensure that as per the spec, a server responds
// with 501 Not Implemented for unsupported transfer-encodings.
func TestUnsupportedTransferEncodingsReturn501(t *testing.T) {
diff --git a/src/net/http/server.go b/src/net/http/server.go
index 30bc9680f4..bcc283b66c 100644
--- a/src/net/http/server.go
+++ b/src/net/http/server.go
@@ -1796,7 +1796,7 @@ func (c *conn) serve(ctx context.Context) {
*c.tlsState = tlsConn.ConnectionState()
if proto := c.tlsState.NegotiatedProtocol; validNPN(proto) {
if fn := c.server.TLSNextProto[proto]; fn != nil {
- h := initNPNRequest{tlsConn, serverHandler{c.server}}
+ h := initNPNRequest{ctx, tlsConn, serverHandler{c.server}}
fn(c.server, tlsConn, h)
}
return
@@ -2042,7 +2042,7 @@ func StripPrefix(prefix string, h Handler) Handler {
*r2 = *r
r2.URL = new(url.URL)
*r2.URL = *r.URL
- r2.URL.Path = cleanPath(p)
+ r2.URL.Path = p
h.ServeHTTP(w, r2)
} else {
NotFound(w, r)
@@ -2512,7 +2512,9 @@ type Server struct {
// ReadHeaderTimeout is the amount of time allowed to read
// request headers. The connection's read deadline is reset
// after reading the headers and the Handler can decide what
- // is considered too slow for the body.
+ // is considered too slow for the body. If ReadHeaderTimeout
+ // is zero, the value of ReadTimeout is used. If both are
+ // zero, there is no timeout.
ReadHeaderTimeout time.Duration
// WriteTimeout is the maximum duration before timing out
@@ -2524,7 +2526,7 @@ type Server struct {
// IdleTimeout is the maximum amount of time to wait for the
// next request when keep-alives are enabled. If IdleTimeout
// is zero, the value of ReadTimeout is used. If both are
- // zero, ReadHeaderTimeout is used.
+ // zero, there is no timeout.
IdleTimeout time.Duration
// MaxHeaderBytes controls the maximum number of bytes the
@@ -2565,7 +2567,7 @@ type Server struct {
BaseContext func(net.Listener) context.Context
// ConnContext optionally specifies a function that modifies
- // the context used for a newly connection c. The provided ctx
+ // the context used for a new connection c. The provided ctx
// is derived from the base context and has a ServerContextKey
// value.
ConnContext func(ctx context.Context, c net.Conn) context.Context
@@ -3347,10 +3349,17 @@ func (globalOptionsHandler) ServeHTTP(w ResponseWriter, r *Request) {
// uninitialized fields in its *Request. Such partially-initialized
// Requests come from NPN protocol handlers.
type initNPNRequest struct {
- c *tls.Conn
- h serverHandler
+ ctx context.Context
+ c *tls.Conn
+ h serverHandler
}
+// BaseContext is an exported but unadvertised http.Handler method
+// recognized by x/net/http2 to pass down a context; the TLSNextProto
+// API predates context support so we shoehorn through the only
+// interface we have available.
+func (h initNPNRequest) BaseContext() context.Context { return h.ctx }
+
func (h initNPNRequest) ServeHTTP(rw ResponseWriter, req *Request) {
if req.TLS == nil {
req.TLS = &tls.ConnectionState{}
diff --git a/src/net/http/transport.go b/src/net/http/transport.go
index 5a1ebaac4c..26f642aa7a 100644
--- a/src/net/http/transport.go
+++ b/src/net/http/transport.go
@@ -271,8 +271,9 @@ type Transport struct {
tlsNextProtoWasNil bool // whether TLSNextProto was nil when the Once fired
// ForceAttemptHTTP2 controls whether HTTP/2 is enabled when a non-zero
- // TLSClientConfig or Dial, DialTLS or DialContext func is provided. By default, use of any those fields conservatively
- // disables HTTP/2. To use a customer dialer or TLS config and still attempt HTTP/2
+ // Dial, DialTLS, or DialContext func or TLSClientConfig is provided.
+ // By default, use of any those fields conservatively disables HTTP/2.
+ // To use a custom dialer or TLS config and still attempt HTTP/2
// upgrades, set this to true.
ForceAttemptHTTP2 bool
}
@@ -1911,7 +1912,12 @@ func (pc *persistConn) readLoopPeekFailLocked(peekErr error) {
}
if n := pc.br.Buffered(); n > 0 {
buf, _ := pc.br.Peek(n)
- log.Printf("Unsolicited response received on idle HTTP channel starting with %q; err=%v", buf, peekErr)
+ if is408Message(buf) {
+ pc.closeLocked(errServerClosedIdle)
+ return
+ } else {
+ log.Printf("Unsolicited response received on idle HTTP channel starting with %q; err=%v", buf, peekErr)
+ }
}
if peekErr == io.EOF {
// common case.
@@ -1921,6 +1927,19 @@ func (pc *persistConn) readLoopPeekFailLocked(peekErr error) {
}
}
+// is408Message reports whether buf has the prefix of an
+// HTTP 408 Request Timeout response.
+// See golang.org/issue/32310.
+func is408Message(buf []byte) bool {
+ if len(buf) < len("HTTP/1.x 408") {
+ return false
+ }
+ if string(buf[:7]) != "HTTP/1." {
+ return false
+ }
+ return string(buf[8:12]) == " 408"
+}
+
// readResponse reads an HTTP response (or two, in the case of "Expect:
// 100-continue") from the server. It returns the final non-100 one.
// trace is optional.
diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go
index 9de2fdab66..2b58e1daec 100644
--- a/src/net/http/transport_test.go
+++ b/src/net/http/transport_test.go
@@ -737,6 +737,8 @@ func TestTransportRemovesDeadIdleConnections(t *testing.T) {
}
}
+// Test that the Transport notices when a server hangs up on its
+// unexpectedly (a keep-alive connection is closed).
func TestTransportServerClosingUnexpectedly(t *testing.T) {
setParallel(t)
defer afterTest(t)
@@ -773,13 +775,14 @@ func TestTransportServerClosingUnexpectedly(t *testing.T) {
body1 := fetch(1, 0)
body2 := fetch(2, 0)
- ts.CloseClientConnections() // surprise!
-
- // This test has an expected race. Sleeping for 25 ms prevents
- // it on most fast machines, causing the next fetch() call to
- // succeed quickly. But if we do get errors, fetch() will retry 5
- // times with some delays between.
- time.Sleep(25 * time.Millisecond)
+ // Close all the idle connections in a way that's similar to
+ // the server hanging up on us. We don't use
+ // httptest.Server.CloseClientConnections because it's
+ // best-effort and stops blocking after 5 seconds. On a loaded
+ // machine running many tests concurrently it's possible for
+ // that method to be async and cause the body3 fetch below to
+ // run on an old connection. This function is synchronous.
+ ExportCloseTransportConnsAbruptly(c.Transport.(*Transport))
body3 := fetch(3, 5)
@@ -5371,3 +5374,77 @@ func TestTransportClone(t *testing.T) {
t.Errorf("Transport.TLSNextProto unexpected non-nil")
}
}
+
+func TestIs408(t *testing.T) {
+ tests := []struct {
+ in string
+ want bool
+ }{
+ {"HTTP/1.0 408", true},
+ {"HTTP/1.1 408", true},
+ {"HTTP/1.8 408", true},
+ {"HTTP/2.0 408", false}, // maybe h2c would do this? but false for now.
+ {"HTTP/1.1 408 ", true},
+ {"HTTP/1.1 40", false},
+ {"http/1.0 408", false},
+ {"HTTP/1-1 408", false},
+ }
+ for _, tt := range tests {
+ if got := Export_is408Message([]byte(tt.in)); got != tt.want {
+ t.Errorf("is408Message(%q) = %v; want %v", tt.in, got, tt.want)
+ }
+ }
+}
+
+func TestTransportIgnores408(t *testing.T) {
+ // Not parallel. Relies on mutating the log package's global Output.
+ defer log.SetOutput(log.Writer())
+
+ var logout bytes.Buffer
+ log.SetOutput(&logout)
+
+ defer afterTest(t)
+ const target = "backend:443"
+
+ cst := newClientServerTest(t, h1Mode, HandlerFunc(func(w ResponseWriter, r *Request) {
+ nc, _, err := w.(Hijacker).Hijack()
+ if err != nil {
+ t.Error(err)
+ return
+ }
+ defer nc.Close()
+ nc.Write([]byte("HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nok"))
+ nc.Write([]byte("HTTP/1.1 408 bye\r\n")) // changing 408 to 409 makes test fail
+ }))
+ defer cst.close()
+ req, err := NewRequest("GET", cst.ts.URL, nil)
+ if err != nil {
+ t.Fatal(err)
+ }
+ res, err := cst.c.Do(req)
+ if err != nil {
+ t.Fatal(err)
+ }
+ slurp, err := ioutil.ReadAll(res.Body)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err != nil {
+ t.Fatal(err)
+ }
+ if string(slurp) != "ok" {
+ t.Fatalf("got %q; want ok", slurp)
+ }
+
+ t0 := time.Now()
+ for i := 0; i < 50; i++ {
+ time.Sleep(time.Duration(i) * 5 * time.Millisecond)
+ if cst.tr.IdleConnKeyCountForTesting() == 0 {
+ if got := logout.String(); got != "" {
+ t.Fatalf("expected no log output; got: %s", got)
+ }
+ return
+ }
+ }
+ t.Fatalf("timeout after %v waiting for Transport connections to die off", time.Since(t0))
+}
diff --git a/src/net/ip.go b/src/net/ip.go
index 9a6fda00e8..cf90c0cd54 100644
--- a/src/net/ip.go
+++ b/src/net/ip.go
@@ -565,7 +565,7 @@ func parseIPv6Zone(s string) (IP, string) {
return parseIPv6(s), zone
}
-// parseIPv6Zone parses s as a literal IPv6 address described in RFC 4291
+// parseIPv6 parses s as a literal IPv6 address described in RFC 4291
// and RFC 5952.
func parseIPv6(s string) (ip IP) {
ip = make(IP, IPv6len)
diff --git a/src/os/file.go b/src/os/file.go
index f835537d51..96df3fb5e9 100644
--- a/src/os/file.go
+++ b/src/os/file.go
@@ -406,7 +406,7 @@ func UserCacheDir() (string, error) {
// On Unix systems, it returns $XDG_CONFIG_HOME as specified by
// https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html if
// non-empty, else $HOME/.config.
-// On Darwin, it returns $HOME/Library/Preferences.
+// On Darwin, it returns $HOME/Library/Application Support.
// On Windows, it returns %AppData%.
// On Plan 9, it returns $home/lib.
//
@@ -427,7 +427,7 @@ func UserConfigDir() (string, error) {
if dir == "" {
return "", errors.New("$HOME is not defined")
}
- dir += "/Library/Preferences"
+ dir += "/Library/Application Support"
case "plan9":
dir = Getenv("home")
diff --git a/src/os/file_plan9.go b/src/os/file_plan9.go
index 14091873cf..e0a3826a34 100644
--- a/src/os/file_plan9.go
+++ b/src/os/file_plan9.go
@@ -136,6 +136,7 @@ func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
// Close closes the File, rendering it unusable for I/O.
// On files that support SetDeadline, any pending I/O operations will
// be canceled and return immediately with an error.
+// Close will return an error if it has already been called.
func (f *File) Close() error {
if err := f.checkValid("close"); err != nil {
return err
diff --git a/src/os/file_unix.go b/src/os/file_unix.go
index 89c05b2657..754e859645 100644
--- a/src/os/file_unix.go
+++ b/src/os/file_unix.go
@@ -225,6 +225,7 @@ func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
// Close closes the File, rendering it unusable for I/O.
// On files that support SetDeadline, any pending I/O operations will
// be canceled and return immediately with an error.
+// Close will return an error if it has already been called.
func (f *File) Close() error {
if f == nil {
return ErrInvalid
diff --git a/src/os/file_windows.go b/src/os/file_windows.go
index 08444d728f..1e78f4e867 100644
--- a/src/os/file_windows.go
+++ b/src/os/file_windows.go
@@ -178,6 +178,7 @@ func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
// Close closes the File, rendering it unusable for I/O.
// On files that support SetDeadline, any pending I/O operations will
// be canceled and return immediately with an error.
+// Close will return an error if it has already been called.
func (file *File) Close() error {
if file == nil {
return ErrInvalid
diff --git a/src/os/os_unix_test.go b/src/os/os_unix_test.go
index fa4c594136..45cb6fc21f 100644
--- a/src/os/os_unix_test.go
+++ b/src/os/os_unix_test.go
@@ -259,12 +259,19 @@ func newFileTest(t *testing.T, blocking bool) {
}
defer file.Close()
+ timeToWrite := 100 * time.Millisecond
+ timeToDeadline := 1 * time.Millisecond
+ if !blocking {
+ // Use a longer time to avoid flakes.
+ // We won't be waiting this long anyhow.
+ timeToWrite = 1 * time.Second
+ }
+
// Try to read with deadline (but don't block forever).
b := make([]byte, 1)
- // Send something after 100ms.
- timer := time.AfterFunc(100*time.Millisecond, func() { syscall.Write(p[1], []byte("a")) })
+ timer := time.AfterFunc(timeToWrite, func() { syscall.Write(p[1], []byte("a")) })
defer timer.Stop()
- file.SetReadDeadline(time.Now().Add(10 * time.Millisecond))
+ file.SetReadDeadline(time.Now().Add(timeToDeadline))
_, err := file.Read(b)
if !blocking {
// We want it to fail with a timeout.
diff --git a/src/os/signal/signal_cgo_test.go b/src/os/signal/signal_cgo_test.go
index 3c23090489..075e8c11cb 100644
--- a/src/os/signal/signal_cgo_test.go
+++ b/src/os/signal/signal_cgo_test.go
@@ -101,6 +101,17 @@ func TestTerminalSignal(t *testing.T) {
Ctty: int(slave.Fd()),
}
+ // Test ctty management by sending enough child fd to overlap the
+ // parent's fd intended for child's ctty.
+ for 2+len(cmd.ExtraFiles) < cmd.SysProcAttr.Ctty {
+ dummy, err := os.Open(os.DevNull)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer dummy.Close()
+ cmd.ExtraFiles = append(cmd.ExtraFiles, dummy)
+ }
+
if err := cmd.Start(); err != nil {
t.Fatal(err)
}
diff --git a/src/reflect/value.go b/src/reflect/value.go
index c58b2d2567..218b4d25cc 100644
--- a/src/reflect/value.go
+++ b/src/reflect/value.go
@@ -1076,7 +1076,7 @@ func (v Value) IsValid() bool {
return v.flag != 0
}
-// IsZero reports whether v is a zero value for its type.
+// IsZero reports whether v is the zero value for its type.
// It panics if the argument is invalid.
func (v Value) IsZero() bool {
switch v.kind() {
diff --git a/src/runtime/asm.s b/src/runtime/asm.s
index 314f99d69b..6b209b2d1f 100644
--- a/src/runtime/asm.s
+++ b/src/runtime/asm.s
@@ -38,11 +38,3 @@ GLOBL runtime·memstats(SB), NOPTR, $0
// This function must be sizeofSkipFunction bytes.
TEXT runtime·skipPleaseUseCallersFrames(SB),NOSPLIT,$0-0
SKIP64; SKIP64; SKIP64; SKIP64
-
-// abi0Syms is a dummy symbol that creates ABI0 wrappers for Go
-// functions called from assembly in other packages.
-TEXT abi0Syms<>(SB),NOSPLIT,$0-0
- // obj assumes it can call morestack* using ABI0, but
- // morestackc is actually defined in Go.
- CALL ·morestackc(SB)
- // References from syscall are automatically collected by cmd/go.
diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s
index b98843e73e..a01841d796 100644
--- a/src/runtime/asm_386.s
+++ b/src/runtime/asm_386.s
@@ -1333,10 +1333,10 @@ TEXT runtime·goexit(SB),NOSPLIT,$0-0
// CX (implicitly) and DX, but it does not follow the ABI wrt arguments:
// instead the pointer to the moduledata is passed in AX.
TEXT runtime·addmoduledata(SB),NOSPLIT,$0-0
- MOVL runtime·lastmoduledatap(SB), DX
- MOVL AX, moduledata_next(DX)
- MOVL AX, runtime·lastmoduledatap(SB)
- RET
+ MOVL runtime·lastmoduledatap(SB), DX
+ MOVL AX, moduledata_next(DX)
+ MOVL AX, runtime·lastmoduledatap(SB)
+ RET
TEXT runtime·uint32tofloat64(SB),NOSPLIT,$8-12
MOVL a+0(FP), AX
diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s
index bb327fe9cc..441042cebe 100644
--- a/src/runtime/asm_ppc64x.s
+++ b/src/runtime/asm_ppc64x.s
@@ -211,7 +211,7 @@ TEXT runtime·mcall(SB), NOSPLIT|NOFRAME, $0-8
TEXT runtime·systemstack_switch(SB), NOSPLIT, $0-0
// We have several undefs here so that 16 bytes past
// $runtime·systemstack_switch lies within them whether or not the
- // instructions that derive r2 from r12 are there.
+ // instructions that derive r2 from r12 are there.
UNDEF
UNDEF
UNDEF
@@ -891,9 +891,9 @@ TEXT runtime·goexit(SB),NOSPLIT|NOFRAME|TOPFRAME,$0-0
// the goroutine exits. It's implemented in assembly mainly because that's the
// easiest way to get access to R2.
TEXT runtime·prepGoExitFrame(SB),NOSPLIT,$0-8
- MOVD sp+0(FP), R3
- MOVD R2, 24(R3)
- RET
+ MOVD sp+0(FP), R3
+ MOVD R2, 24(R3)
+ RET
TEXT runtime·addmoduledata(SB),NOSPLIT|NOFRAME,$0-0
ADD $-8, R1
diff --git a/src/runtime/asm_s390x.s b/src/runtime/asm_s390x.s
index 6bab3fd175..ff3caf72ad 100644
--- a/src/runtime/asm_s390x.s
+++ b/src/runtime/asm_s390x.s
@@ -782,8 +782,8 @@ TEXT runtime·goexit(SB),NOSPLIT|NOFRAME|TOPFRAME,$0-0
BYTE $0x07; BYTE $0x00; // 2-byte nop
TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0
- // Stores are already ordered on s390x, so this is just a
- // compile barrier.
+ // Stores are already ordered on s390x, so this is just a
+ // compile barrier.
RET
// This is called from .init_array and follows the platform, not Go, ABI.
diff --git a/src/runtime/asm_wasm.s b/src/runtime/asm_wasm.s
index a10c89d298..8f3964f08b 100644
--- a/src/runtime/asm_wasm.s
+++ b/src/runtime/asm_wasm.s
@@ -37,17 +37,12 @@ TEXT runtime·gogo(SB), NOSPLIT, $0-8
MOVD gobuf_g(R0), g
MOVD gobuf_sp(R0), SP
+ // Put target PC at -8(SP), wasm_pc_f_loop will pick it up
+ Get SP
+ I32Const $8
+ I32Sub
I64Load gobuf_pc(R0)
- I32WrapI64
- I32Const $16
- I32ShrU
- Set PC_F
-
- I64Load gobuf_pc(R0)
- I64Const $0xFFFF
- I64And
- I32WrapI64
- Set PC_B
+ I64Store $0
MOVD gobuf_ret(R0), RET0
MOVD gobuf_ctxt(R0), CTXT
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go
index 3c3e110f89..62b7730c44 100644
--- a/src/runtime/export_test.go
+++ b/src/runtime/export_test.go
@@ -545,18 +545,23 @@ type Span struct {
}
func AllocSpan(base, npages uintptr, scavenged bool) Span {
- lock(&mheap_.lock)
- s := (*mspan)(mheap_.spanalloc.alloc())
- unlock(&mheap_.lock)
+ var s *mspan
+ systemstack(func() {
+ lock(&mheap_.lock)
+ s = (*mspan)(mheap_.spanalloc.alloc())
+ unlock(&mheap_.lock)
+ })
s.init(base, npages)
s.scavenged = scavenged
return Span{s}
}
func (s *Span) Free() {
- lock(&mheap_.lock)
- mheap_.spanalloc.free(unsafe.Pointer(s.mspan))
- unlock(&mheap_.lock)
+ systemstack(func() {
+ lock(&mheap_.lock)
+ mheap_.spanalloc.free(unsafe.Pointer(s.mspan))
+ unlock(&mheap_.lock)
+ })
s.mspan = nil
}
@@ -629,9 +634,11 @@ func (t *Treap) Insert(s Span) {
// allocation which requires the mheap_ lock to manipulate.
// Locking here is safe because the treap itself never allocs
// or otherwise ends up grabbing this lock.
- lock(&mheap_.lock)
- t.insert(s.mspan)
- unlock(&mheap_.lock)
+ systemstack(func() {
+ lock(&mheap_.lock)
+ t.insert(s.mspan)
+ unlock(&mheap_.lock)
+ })
t.CheckInvariants()
}
@@ -644,17 +651,21 @@ func (t *Treap) Erase(i TreapIter) {
// freeing which requires the mheap_ lock to manipulate.
// Locking here is safe because the treap itself never allocs
// or otherwise ends up grabbing this lock.
- lock(&mheap_.lock)
- t.erase(i.treapIter)
- unlock(&mheap_.lock)
+ systemstack(func() {
+ lock(&mheap_.lock)
+ t.erase(i.treapIter)
+ unlock(&mheap_.lock)
+ })
t.CheckInvariants()
}
func (t *Treap) RemoveSpan(s Span) {
// See Erase about locking.
- lock(&mheap_.lock)
- t.removeSpan(s.mspan)
- unlock(&mheap_.lock)
+ systemstack(func() {
+ lock(&mheap_.lock)
+ t.removeSpan(s.mspan)
+ unlock(&mheap_.lock)
+ })
t.CheckInvariants()
}
diff --git a/src/runtime/internal/atomic/asm_s390x.s b/src/runtime/internal/atomic/asm_s390x.s
index 512fde5a12..084f5b5163 100644
--- a/src/runtime/internal/atomic/asm_s390x.s
+++ b/src/runtime/internal/atomic/asm_s390x.s
@@ -4,6 +4,30 @@
#include "textflag.h"
+// func Store(ptr *uint32, val uint32)
+TEXT ·Store(SB), NOSPLIT, $0
+ MOVD ptr+0(FP), R2
+ MOVWZ val+8(FP), R3
+ MOVW R3, 0(R2)
+ SYNC
+ RET
+
+// func Store64(ptr *uint64, val uint64)
+TEXT ·Store64(SB), NOSPLIT, $0
+ MOVD ptr+0(FP), R2
+ MOVD val+8(FP), R3
+ MOVD R3, 0(R2)
+ SYNC
+ RET
+
+// func StorepNoWB(ptr unsafe.Pointer, val unsafe.Pointer)
+TEXT ·StorepNoWB(SB), NOSPLIT, $0
+ MOVD ptr+0(FP), R2
+ MOVD val+8(FP), R3
+ MOVD R3, 0(R2)
+ SYNC
+ RET
+
// func Cas(ptr *uint32, old, new uint32) bool
// Atomically:
// if *ptr == old {
diff --git a/src/runtime/internal/atomic/atomic_386.go b/src/runtime/internal/atomic/atomic_386.go
index 143cd45e61..d7f82cc752 100644
--- a/src/runtime/internal/atomic/atomic_386.go
+++ b/src/runtime/internal/atomic/atomic_386.go
@@ -8,6 +8,10 @@ package atomic
import "unsafe"
+// Export some functions via linkname to assembly in sync/atomic.
+//go:linkname Load
+//go:linkname Loadp
+
//go:nosplit
//go:noinline
func Load(ptr *uint32) uint32 {
diff --git a/src/runtime/internal/atomic/atomic_amd64x.go b/src/runtime/internal/atomic/atomic_amd64x.go
index b7e01a3ad5..31c1636b2e 100644
--- a/src/runtime/internal/atomic/atomic_amd64x.go
+++ b/src/runtime/internal/atomic/atomic_amd64x.go
@@ -8,6 +8,11 @@ package atomic
import "unsafe"
+// Export some functions via linkname to assembly in sync/atomic.
+//go:linkname Load
+//go:linkname Loadp
+//go:linkname Load64
+
//go:nosplit
//go:noinline
func Load(ptr *uint32) uint32 {
diff --git a/src/runtime/internal/atomic/atomic_arm.go b/src/runtime/internal/atomic/atomic_arm.go
index 3834ce5b91..c1fc1f727f 100644
--- a/src/runtime/internal/atomic/atomic_arm.go
+++ b/src/runtime/internal/atomic/atomic_arm.go
@@ -11,6 +11,10 @@ import (
"unsafe"
)
+// Export some functions via linkname to assembly in sync/atomic.
+//go:linkname Xchg
+//go:linkname Xchguintptr
+
type spinlock struct {
v uint32
}
diff --git a/src/runtime/internal/atomic/atomic_mipsx.go b/src/runtime/internal/atomic/atomic_mipsx.go
index 210fc27d9b..6e39262c15 100644
--- a/src/runtime/internal/atomic/atomic_mipsx.go
+++ b/src/runtime/internal/atomic/atomic_mipsx.go
@@ -4,6 +4,13 @@
// +build mips mipsle
+// Export some functions via linkname to assembly in sync/atomic.
+//go:linkname Xadd64
+//go:linkname Xchg64
+//go:linkname Cas64
+//go:linkname Load64
+//go:linkname Store64
+
package atomic
import (
diff --git a/src/runtime/internal/atomic/atomic_s390x.go b/src/runtime/internal/atomic/atomic_s390x.go
index 0ad96d3502..25fd890524 100644
--- a/src/runtime/internal/atomic/atomic_s390x.go
+++ b/src/runtime/internal/atomic/atomic_s390x.go
@@ -6,6 +6,11 @@ package atomic
import "unsafe"
+// Export some functions via linkname to assembly in sync/atomic.
+//go:linkname Load
+//go:linkname Loadp
+//go:linkname Load64
+
//go:nosplit
//go:noinline
func Load(ptr *uint32) uint32 {
@@ -36,30 +41,17 @@ func LoadAcq(ptr *uint32) uint32 {
return *ptr
}
-//go:noinline
-//go:nosplit
-func Store(ptr *uint32, val uint32) {
- *ptr = val
-}
+//go:noescape
+func Store(ptr *uint32, val uint32)
-//go:noinline
-//go:nosplit
-func Store64(ptr *uint64, val uint64) {
- *ptr = val
-}
-
-//go:notinheap
-type noWB struct{}
+//go:noescape
+func Store64(ptr *uint64, val uint64)
// NO go:noescape annotation; see atomic_pointer.go.
-//go:noinline
-//go:nosplit
-func StorepNoWB(ptr unsafe.Pointer, val unsafe.Pointer) {
- *(**noWB)(ptr) = (*noWB)(val)
-}
+func StorepNoWB(ptr unsafe.Pointer, val unsafe.Pointer)
-//go:noinline
//go:nosplit
+//go:noinline
func StoreRel(ptr *uint32, val uint32) {
*ptr = val
}
diff --git a/src/runtime/internal/atomic/atomic_wasm.go b/src/runtime/internal/atomic/atomic_wasm.go
index 9ce4892cb6..0731763ac1 100644
--- a/src/runtime/internal/atomic/atomic_wasm.go
+++ b/src/runtime/internal/atomic/atomic_wasm.go
@@ -5,6 +5,24 @@
// TODO(neelance): implement with actual atomic operations as soon as threads are available
// See https://github.com/WebAssembly/design/issues/1073
+// Export some functions via linkname to assembly in sync/atomic.
+//go:linkname Load
+//go:linkname Loadp
+//go:linkname Load64
+//go:linkname Loaduintptr
+//go:linkname Xadd
+//go:linkname Xadd64
+//go:linkname Xadduintptr
+//go:linkname Xchg
+//go:linkname Xchg64
+//go:linkname Xchguintptr
+//go:linkname Cas
+//go:linkname Cas64
+//go:linkname Casuintptr
+//go:linkname Store
+//go:linkname Store64
+//go:linkname Storeuintptr
+
package atomic
import "unsafe"
diff --git a/src/runtime/lookup_darwin.go b/src/runtime/lookup_darwin.go
deleted file mode 100644
index c39b937ccf..0000000000
--- a/src/runtime/lookup_darwin.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2019 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 runtime
-
-import (
- "unsafe"
-)
-
-//go:linkname res_init net.res_init
-//go:nosplit
-//go:cgo_unsafe_args
-func res_init() int32 {
- return libcCall(unsafe.Pointer(funcPC(res_init_trampoline)), nil)
-}
-func res_init_trampoline()
-
-//go:linkname res_search net.res_search
-//go:nosplit
-//go:cgo_unsafe_args
-func res_search(dname *byte, class int32, rtype int32, answer *byte, anslen int32) (int32, int32) {
- args := struct {
- dname *byte
- class, rtype int32
- answer *byte
- anslen, retSize, retErr int32
- }{dname, class, rtype, answer, anslen, 0, 0}
- libcCall(unsafe.Pointer(funcPC(res_search_trampoline)), unsafe.Pointer(&args))
- return args.retSize, args.retErr
-}
-func res_search_trampoline()
-
-//go:cgo_import_dynamic libc_res_search res_search "/usr/lib/libSystem.B.dylib"
-//go:cgo_import_dynamic libc_res_init res_init "/usr/lib/libSystem.B.dylib"
diff --git a/src/runtime/lookup_darwin_386.s b/src/runtime/lookup_darwin_386.s
deleted file mode 100644
index 4995e51df5..0000000000
--- a/src/runtime/lookup_darwin_386.s
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2019 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.
-
-#include "go_asm.h"
-#include "go_tls.h"
-#include "textflag.h"
-
-TEXT runtime·res_init_trampoline(SB),NOSPLIT,$0
- PUSHL BP
- MOVL SP, BP
- SUBL $8, SP
- CALL libc_res_init(SB)
- CMPL AX, $-1
- JNE ok
- CALL libc_error(SB)
-ok:
- MOVL BP, SP
- POPL BP
- RET
-
-TEXT runtime·res_search_trampoline(SB),NOSPLIT,$0
- PUSHL BP
- MOVL SP, BP
- SUBL $24, SP
- MOVL 32(SP), CX
- MOVL 16(CX), AX // arg 5 anslen
- MOVL AX, 16(SP)
- MOVL 12(CX), AX // arg 4 answer
- MOVL AX, 12(SP)
- MOVL 8(CX), AX // arg 3 type
- MOVL AX, 8(SP)
- MOVL 4(CX), AX // arg 2 class
- MOVL AX, 4(SP)
- MOVL 0(CX), AX // arg 1 name
- MOVL AX, 0(SP)
- CALL libc_res_search(SB)
- XORL DX, DX
- CMPL AX, $-1
- JNE ok
- CALL libc_error(SB)
- MOVL (AX), DX
- XORL AX, AX
-ok:
- MOVL 32(SP), CX
- MOVL AX, 20(CX)
- MOVL DX, 24(CX)
- MOVL BP, SP
- POPL BP
- RET
diff --git a/src/runtime/lookup_darwin_amd64.s b/src/runtime/lookup_darwin_amd64.s
deleted file mode 100644
index 3534a4fbc7..0000000000
--- a/src/runtime/lookup_darwin_amd64.s
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2019 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.
-
-#include "go_asm.h"
-#include "go_tls.h"
-#include "textflag.h"
-
-TEXT runtime·res_init_trampoline(SB),NOSPLIT,$0
- PUSHQ BP
- MOVQ SP, BP
- CALL libc_res_init(SB)
- CMPQ AX, $-1
- JNE ok
- CALL libc_error(SB)
-ok:
- POPQ BP
- RET
-
-TEXT runtime·res_search_trampoline(SB),NOSPLIT,$0
- PUSHQ BP
- MOVQ SP, BP
- MOVQ DI, BX // move DI into BX to preserve struct addr
- MOVL 24(BX), R8 // arg 5 anslen
- MOVQ 16(BX), CX // arg 4 answer
- MOVL 12(BX), DX // arg 3 type
- MOVL 8(BX), SI // arg 2 class
- MOVQ 0(BX), DI // arg 1 name
- CALL libc_res_search(SB)
- XORL DX, DX
- CMPQ AX, $-1
- JNE ok
- CALL libc_error(SB)
- MOVLQSX (AX), DX // move return from libc_error into DX
- XORL AX, AX // size on error is 0
-ok:
- MOVL AX, 28(BX) // size
- MOVL DX, 32(BX) // error code
- POPQ BP
- RET
diff --git a/src/runtime/lookup_darwin_arm.s b/src/runtime/lookup_darwin_arm.s
deleted file mode 100644
index bf69d21213..0000000000
--- a/src/runtime/lookup_darwin_arm.s
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2015 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.
-
-// System calls and other sys.stuff for ARM64, Darwin
-// System calls are implemented in libSystem, this file contains
-// trampolines that convert from Go to C calling convention.
-
-#include "go_asm.h"
-#include "go_tls.h"
-#include "textflag.h"
-
-// On darwin/arm, the runtime always uses runtime/cgo
-// for resolution. This will just exit with a nominal
-// exit code.
-
-TEXT runtime·res_search_trampoline(SB),NOSPLIT,$0
- MOVW $90, R0
- BL libc_exit(SB)
- RET
-
-TEXT runtime·res_init_trampoline(SB),NOSPLIT,$0
- MOVW $91, R0
- BL libc_exit(SB)
- RET
diff --git a/src/runtime/lookup_darwin_arm64.s b/src/runtime/lookup_darwin_arm64.s
deleted file mode 100644
index 31061e15c0..0000000000
--- a/src/runtime/lookup_darwin_arm64.s
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2019 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.
-
-#include "go_asm.h"
-#include "go_tls.h"
-#include "textflag.h"
-
-// On darwin/arm, the runtime always uses runtime/cgo
-// for resolution. This will just exit with a nominal
-// exit code.
-
-TEXT runtime·res_search_trampoline(SB),NOSPLIT,$0
- MOVW $90, R0
- BL libc_exit(SB)
- RET
-
-TEXT runtime·res_init_trampoline(SB),NOSPLIT,$0
- MOVW $91, R0
- BL libc_exit(SB)
- RET
diff --git a/src/runtime/mcache.go b/src/runtime/mcache.go
index 7895e489bc..0cb21f7190 100644
--- a/src/runtime/mcache.go
+++ b/src/runtime/mcache.go
@@ -83,10 +83,13 @@ type stackfreelist struct {
var emptymspan mspan
func allocmcache() *mcache {
- lock(&mheap_.lock)
- c := (*mcache)(mheap_.cachealloc.alloc())
- c.flushGen = mheap_.sweepgen
- unlock(&mheap_.lock)
+ var c *mcache
+ systemstack(func() {
+ lock(&mheap_.lock)
+ c = (*mcache)(mheap_.cachealloc.alloc())
+ c.flushGen = mheap_.sweepgen
+ unlock(&mheap_.lock)
+ })
for i := range c.alloc {
c.alloc[i] = &emptymspan
}
diff --git a/src/runtime/memclr_arm64.s b/src/runtime/memclr_arm64.s
index c9cdc4b12a..a56a6dfb85 100644
--- a/src/runtime/memclr_arm64.s
+++ b/src/runtime/memclr_arm64.s
@@ -113,10 +113,10 @@ try_zva:
MOVW block_size<>(SB), R5
TBNZ $31, R5, no_zva
CBNZ R5, zero_by_line
- // DCZID_EL0 bit assignments
- // [63:5] Reserved
- // [4] DZP, if bit set DC ZVA instruction is prohibited, else permitted
- // [3:0] log2 of the block size in words, eg. if it returns 0x4 then block size is 16 words
+ // DCZID_EL0 bit assignments
+ // [63:5] Reserved
+ // [4] DZP, if bit set DC ZVA instruction is prohibited, else permitted
+ // [3:0] log2 of the block size in words, eg. if it returns 0x4 then block size is 16 words
MRS DCZID_EL0, R3
TBZ $4, R3, init
// ZVA not available
diff --git a/src/runtime/memmove_arm64.s b/src/runtime/memmove_arm64.s
index dcbead8cf4..ac29f94c7b 100644
--- a/src/runtime/memmove_arm64.s
+++ b/src/runtime/memmove_arm64.s
@@ -25,10 +25,10 @@ check:
// Copying forward proceeds by copying R7/8 words then copying R6 bytes.
// R3 and R4 are advanced as we copy.
- // (There may be implementations of armv8 where copying by bytes until
- // at least one of source or dest is word aligned is a worthwhile
- // optimization, but the on the one tested so far (xgene) it did not
- // make a significance difference.)
+ // (There may be implementations of armv8 where copying by bytes until
+ // at least one of source or dest is word aligned is a worthwhile
+ // optimization, but the on the one tested so far (xgene) it did not
+ // make a significance difference.)
CBZ R7, noforwardlarge // Do we need to do any doubleword-by-doubleword copying?
@@ -111,7 +111,7 @@ nobackwardtail:
RET
backwardlarge:
- SUB R7, R3, R9 // R9 points at the lowest destination byte
+ SUB R7, R3, R9 // R9 points at the lowest destination byte
backwardlargeloop:
LDP -16(R4), (R8, R10)
diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go
index 9eaacd933d..823b556e53 100644
--- a/src/runtime/mgc.go
+++ b/src/runtime/mgc.go
@@ -216,16 +216,19 @@ func gcenable() {
//go:linkname setGCPercent runtime/debug.setGCPercent
func setGCPercent(in int32) (out int32) {
- lock(&mheap_.lock)
- out = gcpercent
- if in < 0 {
- in = -1
- }
- gcpercent = in
- heapminimum = defaultHeapMinimum * uint64(gcpercent) / 100
- // Update pacing in response to gcpercent change.
- gcSetTriggerRatio(memstats.triggerRatio)
- unlock(&mheap_.lock)
+ // Run on the system stack since we grab the heap lock.
+ systemstack(func() {
+ lock(&mheap_.lock)
+ out = gcpercent
+ if in < 0 {
+ in = -1
+ }
+ gcpercent = in
+ heapminimum = defaultHeapMinimum * uint64(gcpercent) / 100
+ // Update pacing in response to gcpercent change.
+ gcSetTriggerRatio(memstats.triggerRatio)
+ unlock(&mheap_.lock)
+ })
// If we just disabled GC, wait for any concurrent GC mark to
// finish so we always return with no GC running.
@@ -1261,7 +1264,7 @@ func gcStart(trigger gcTrigger) {
gcBgMarkStartWorkers()
- gcResetMarkState()
+ systemstack(gcResetMarkState)
work.stwprocs, work.maxprocs = gomaxprocs, gomaxprocs
if work.stwprocs > ncpu {
@@ -2078,6 +2081,9 @@ func gcMark(start_time int64) {
}
}
+// gcSweep must be called on the system stack because it acquires the heap
+// lock. See mheap for details.
+//go:systemstack
func gcSweep(mode gcMode) {
if gcphase != _GCoff {
throw("gcSweep being done but phase is not GCoff")
@@ -2134,6 +2140,11 @@ func gcSweep(mode gcMode) {
//
// This is safe to do without the world stopped because any Gs created
// during or after this will start out in the reset state.
+//
+// gcResetMarkState must be called on the system stack because it acquires
+// the heap lock. See mheap for details.
+//
+//go:systemstack
func gcResetMarkState() {
// This may be called during a concurrent phase, so make sure
// allgs doesn't change.
diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go
index efa007aa97..2c63724472 100644
--- a/src/runtime/mgcmark.go
+++ b/src/runtime/mgcmark.go
@@ -712,15 +712,31 @@ func scanstack(gp *g, gcw *gcWork) {
// Find additional pointers that point into the stack from the heap.
// Currently this includes defers and panics. See also function copystack.
+
+ // Find and trace all defer arguments.
tracebackdefers(gp, scanframe, nil)
+
+ // Find and trace other pointers in defer records.
for d := gp._defer; d != nil; d = d.link {
- // tracebackdefers above does not scan the func value, which could
- // be a stack allocated closure. See issue 30453.
if d.fn != nil {
+ // tracebackdefers above does not scan the func value, which could
+ // be a stack allocated closure. See issue 30453.
scanblock(uintptr(unsafe.Pointer(&d.fn)), sys.PtrSize, &oneptrmask[0], gcw, &state)
}
+ if d.link != nil {
+ // The link field of a stack-allocated defer record might point
+ // to a heap-allocated defer record. Keep that heap record live.
+ scanblock(uintptr(unsafe.Pointer(&d.link)), sys.PtrSize, &oneptrmask[0], gcw, &state)
+ }
+ // Retain defers records themselves.
+ // Defer records might not be reachable from the G through regular heap
+ // tracing because the defer linked list might weave between the stack and the heap.
+ if d.heap {
+ scanblock(uintptr(unsafe.Pointer(&d)), sys.PtrSize, &oneptrmask[0], gcw, &state)
+ }
}
if gp._panic != nil {
+ // Panics are always stack allocated.
state.putPtr(uintptr(unsafe.Pointer(gp._panic)))
}
diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go
index 3297c287d4..af2818a2bd 100644
--- a/src/runtime/mheap.go
+++ b/src/runtime/mheap.go
@@ -29,6 +29,8 @@ const minPhysPageSize = 4096
//
//go:notinheap
type mheap struct {
+ // lock must only be acquired on the system stack, otherwise a g
+ // could self-deadlock if its stack grows with the lock held.
lock mutex
free mTreap // free spans
sweepgen uint32 // sweep generation, see comment in mspan
@@ -1095,9 +1097,8 @@ func (h *mheap) alloc(npage uintptr, spanclass spanClass, large bool, needzero b
// The memory backing the returned span may not be zeroed if
// span.needzero is set.
//
-// allocManual must be called on the system stack to prevent stack
-// growth. Since this is used by the stack allocator, stack growth
-// during allocManual would self-deadlock.
+// allocManual must be called on the system stack because it acquires
+// the heap lock. See mheap for details.
//
//go:systemstack
func (h *mheap) allocManual(npage uintptr, stat *uint64) *mspan {
@@ -1303,8 +1304,8 @@ func (h *mheap) freeSpan(s *mspan, large bool) {
// This must only be called when gcphase == _GCoff. See mSpanState for
// an explanation.
//
-// freeManual must be called on the system stack to prevent stack
-// growth, just like allocManual.
+// freeManual must be called on the system stack because it acquires
+// the heap lock. See mheap for details.
//
//go:systemstack
func (h *mheap) freeManual(s *mspan, stat *uint64) {
diff --git a/src/runtime/mstats.go b/src/runtime/mstats.go
index 9250865ed1..421580eec3 100644
--- a/src/runtime/mstats.go
+++ b/src/runtime/mstats.go
@@ -470,6 +470,9 @@ func readGCStats(pauses *[]uint64) {
})
}
+// readGCStats_m must be called on the system stack because it acquires the heap
+// lock. See mheap for details.
+//go:systemstack
func readGCStats_m(pauses *[]uint64) {
p := *pauses
// Calling code in runtime/debug should make the slice large enough.
diff --git a/src/runtime/os_darwin.go b/src/runtime/os_darwin.go
index 18c15ad89e..4b6dbf6427 100644
--- a/src/runtime/os_darwin.go
+++ b/src/runtime/os_darwin.go
@@ -7,10 +7,7 @@ package runtime
import "unsafe"
type mOS struct {
- initialized bool
- mutex pthreadmutex
- cond pthreadcond
- count int
+ sema uintptr
}
func unimplemented(name string) {
@@ -20,59 +17,32 @@ func unimplemented(name string) {
//go:nosplit
func semacreate(mp *m) {
- if mp.initialized {
- return
- }
- mp.initialized = true
- if err := pthread_mutex_init(&mp.mutex, nil); err != 0 {
- throw("pthread_mutex_init")
- }
- if err := pthread_cond_init(&mp.cond, nil); err != 0 {
- throw("pthread_cond_init")
+ if mp.sema == 0 {
+ mp.sema = dispatch_semaphore_create(0)
}
}
+const (
+ _DISPATCH_TIME_NOW = uint64(0)
+ _DISPATCH_TIME_FOREVER = ^uint64(0)
+)
+
//go:nosplit
func semasleep(ns int64) int32 {
- var start int64
- if ns >= 0 {
- start = nanotime()
- }
mp := getg().m
- pthread_mutex_lock(&mp.mutex)
- for {
- if mp.count > 0 {
- mp.count--
- pthread_mutex_unlock(&mp.mutex)
- return 0
- }
- if ns >= 0 {
- spent := nanotime() - start
- if spent >= ns {
- pthread_mutex_unlock(&mp.mutex)
- return -1
- }
- var t timespec
- t.setNsec(ns - spent)
- err := pthread_cond_timedwait_relative_np(&mp.cond, &mp.mutex, &t)
- if err == _ETIMEDOUT {
- pthread_mutex_unlock(&mp.mutex)
- return -1
- }
- } else {
- pthread_cond_wait(&mp.cond, &mp.mutex)
- }
+ t := _DISPATCH_TIME_FOREVER
+ if ns >= 0 {
+ t = dispatch_time(_DISPATCH_TIME_NOW, ns)
}
+ if dispatch_semaphore_wait(mp.sema, t) != 0 {
+ return -1
+ }
+ return 0
}
//go:nosplit
func semawakeup(mp *m) {
- pthread_mutex_lock(&mp.mutex)
- mp.count++
- if mp.count > 0 {
- pthread_cond_signal(&mp.cond)
- }
- pthread_mutex_unlock(&mp.mutex)
+ dispatch_semaphore_signal(mp.sema)
}
// BSD interface for threading.
@@ -145,14 +115,14 @@ func newosproc(mp *m) {
exit(1)
}
- // Set the stack size we want to use. 64KB for now.
- // TODO: just use OS default size?
- const stackSize = 1 << 16
- if pthread_attr_setstacksize(&attr, stackSize) != 0 {
+ // Find out OS stack size for our own stack guard.
+ var stacksize uintptr
+ if pthread_attr_getstacksize(&attr, &stacksize) != 0 {
write(2, unsafe.Pointer(&failthreadcreate[0]), int32(len(failthreadcreate)))
exit(1)
}
- //mSysStatInc(&memstats.stacks_sys, stackSize) //TODO: do this?
+ mp.g0.stack.hi = stacksize // for mstart
+ //mSysStatInc(&memstats.stacks_sys, stacksize) //TODO: do this?
// Tell the pthread library we won't join with this thread.
if pthread_attr_setdetachstate(&attr, _PTHREAD_CREATE_DETACHED) != 0 {
@@ -191,11 +161,16 @@ func newosproc0(stacksize uintptr, fn uintptr) {
exit(1)
}
- // Set the stack we want to use.
- if pthread_attr_setstacksize(&attr, stacksize) != 0 {
+ // The caller passes in a suggested stack size,
+ // from when we allocated the stack and thread ourselves,
+ // without libpthread. Now that we're using libpthread,
+ // we use the OS default stack size instead of the suggestion.
+ // Find out that stack size for our own stack guard.
+ if pthread_attr_getstacksize(&attr, &stacksize) != 0 {
write(2, unsafe.Pointer(&failthreadcreate[0]), int32(len(failthreadcreate)))
exit(1)
}
+ g0.stack.hi = stacksize // for mstart
mSysStatInc(&memstats.stacks_sys, stacksize)
// Tell the pthread library we won't join with this thread.
diff --git a/src/runtime/panic.go b/src/runtime/panic.go
index f39a4bc0a2..ce26eb540d 100644
--- a/src/runtime/panic.go
+++ b/src/runtime/panic.go
@@ -228,6 +228,46 @@ func deferproc(siz int32, fn *funcval) { // arguments of fn follow fn
// been set and must not be clobbered.
}
+// deferprocStack queues a new deferred function with a defer record on the stack.
+// The defer record must have its siz and fn fields initialized.
+// All other fields can contain junk.
+// The defer record must be immediately followed in memory by
+// the arguments of the defer.
+// Nosplit because the arguments on the stack won't be scanned
+// until the defer record is spliced into the gp._defer list.
+//go:nosplit
+func deferprocStack(d *_defer) {
+ gp := getg()
+ if gp.m.curg != gp {
+ // go code on the system stack can't defer
+ throw("defer on system stack")
+ }
+ // siz and fn are already set.
+ // The other fields are junk on entry to deferprocStack and
+ // are initialized here.
+ d.started = false
+ d.heap = false
+ d.sp = getcallersp()
+ d.pc = getcallerpc()
+ // The lines below implement:
+ // d.panic = nil
+ // d.link = gp._defer
+ // gp._defer = d
+ // But without write barriers. The first two are writes to
+ // the stack so they don't need a write barrier, and furthermore
+ // are to uninitialized memory, so they must not use a write barrier.
+ // The third write does not require a write barrier because we
+ // explicitly mark all the defer structures, so we don't need to
+ // keep track of pointers to them with a write barrier.
+ *(*uintptr)(unsafe.Pointer(&d._panic)) = 0
+ *(*uintptr)(unsafe.Pointer(&d.link)) = uintptr(unsafe.Pointer(gp._defer))
+ *(*uintptr)(unsafe.Pointer(&gp._defer)) = uintptr(unsafe.Pointer(d))
+
+ return0()
+ // No code can go here - the C return register has
+ // been set and must not be clobbered.
+}
+
// Small malloc size classes >= 16 are the multiples of 16: 16, 32, 48, 64, 80, 96, 112, 128, 144, ...
// Each P holds a pool for defers with small arg sizes.
// Assign defer allocations to pools by rounding to 16, to match malloc size classes.
@@ -349,6 +389,7 @@ func newdefer(siz int32) *_defer {
}
}
d.siz = siz
+ d.heap = true
d.link = gp._defer
gp._defer = d
return d
@@ -368,6 +409,9 @@ func freedefer(d *_defer) {
if d.fn != nil {
freedeferfn()
}
+ if !d.heap {
+ return
+ }
sc := deferclass(uintptr(d.siz))
if sc >= uintptr(len(p{}.deferpool)) {
return
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index e9eca23138..b5cf9d442d 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -2850,7 +2850,11 @@ func reentersyscall(pc, sp uintptr) {
}
// Standard syscall entry used by the go syscall library and normal cgo calls.
+//
+// This is exported via linkname to assembly in the syscall package.
+//
//go:nosplit
+//go:linkname entersyscall
func entersyscall() {
reentersyscall(getcallerpc(), getcallersp())
}
@@ -2940,8 +2944,11 @@ func entersyscallblock_handoff() {
//
// Write barriers are not allowed because our P may have been stolen.
//
+// This is exported via linkname to assembly in the syscall package.
+//
//go:nosplit
//go:nowritebarrierrec
+//go:linkname exitsyscall
func exitsyscall() {
_g_ := getg()
diff --git a/src/runtime/race_arm64.s b/src/runtime/race_arm64.s
index 192a847ad8..48c719aa36 100644
--- a/src/runtime/race_arm64.s
+++ b/src/runtime/race_arm64.s
@@ -432,7 +432,7 @@ TEXT runtime·racecallbackthunk(SB), NOSPLIT|NOFRAME, $0
MOVD R13, g
JMP (LR)
rest:
- // Save callee-saved registers (Go code won't respect that).
+ // Save callee-saved registers (Go code won't respect that).
// 8(RSP) and 16(RSP) are for args passed through racecallback
SUB $96, RSP
MOVD LR, 0(RSP)
diff --git a/src/runtime/race_ppc64le.s b/src/runtime/race_ppc64le.s
index 8aba786d3f..79b8ba2ae8 100644
--- a/src/runtime/race_ppc64le.s
+++ b/src/runtime/race_ppc64le.s
@@ -97,9 +97,9 @@ TEXT runtime·racereadrangepc1(SB), NOSPLIT, $0-24
MOVD size+8(FP), R5
MOVD pc+16(FP), R6
ADD $4, R6 // tsan wants return addr
- // void __tsan_read_range(ThreadState *thr, void *addr, uintptr size, void *pc);
- MOVD $__tsan_read_range(SB), R8
- BR racecalladdr<>(SB)
+ // void __tsan_read_range(ThreadState *thr, void *addr, uintptr size, void *pc);
+ MOVD $__tsan_read_range(SB), R8
+ BR racecalladdr<>(SB)
TEXT runtime·RaceReadRange(SB), NOSPLIT, $0-24
BR runtime·racereadrange(SB)
@@ -384,8 +384,8 @@ racecallatomic_ignore:
MOVD R17, R6 // restore arg list addr
// Call the atomic function.
// racecall will call LLVM race code which might clobber r30 (g)
- MOVD runtime·tls_g(SB), R10
- MOVD 0(R13)(R10*1), g
+ MOVD runtime·tls_g(SB), R10
+ MOVD 0(R13)(R10*1), g
MOVD g_racectx(g), R3
MOVD R8, R4 // pc being called same TODO as above
@@ -516,7 +516,7 @@ rest:
BL runtime·racecallback(SB)
// All registers are clobbered after Go code, reload.
MOVD runtime·tls_g(SB), R10
- MOVD 0(R13)(R10*1), g
+ MOVD 0(R13)(R10*1), g
MOVD g_m(g), R7
MOVD m_curg(R7), g // restore g = m->curg
diff --git a/src/runtime/rt0_js_wasm.s b/src/runtime/rt0_js_wasm.s
index c4efd9637c..b22c46e2e9 100644
--- a/src/runtime/rt0_js_wasm.s
+++ b/src/runtime/rt0_js_wasm.s
@@ -31,14 +31,9 @@ TEXT wasm_export_run(SB),NOSPLIT,$0
I64ExtendI32U
I64Store $8
- I32Const $runtime·rt0_go(SB)
- I32Const $16
- I32ShrU
- Set PC_F
-
- I32Const $0
- Set PC_B
-
+ I32Const $0 // entry PC_B
+ Call runtime·rt0_go(SB)
+ Drop
Call wasm_pc_f_loop(SB)
Return
@@ -46,14 +41,9 @@ TEXT wasm_export_run(SB),NOSPLIT,$0
// wasm_export_resume gets called from JavaScript. It resumes the execution of Go code until it needs to wait for
// an event.
TEXT wasm_export_resume(SB),NOSPLIT,$0
- I32Const $runtime·handleEvent(SB)
- I32Const $16
- I32ShrU
- Set PC_F
-
I32Const $0
- Set PC_B
-
+ Call runtime·handleEvent(SB)
+ Drop
Call wasm_pc_f_loop(SB)
Return
@@ -63,15 +53,30 @@ TEXT wasm_pc_f_loop(SB),NOSPLIT,$0
// The WebAssembly stack may unwind, e.g. when switching goroutines.
// The Go stack on the linear memory is then used to jump to the correct functions
// with this loop, without having to restore the full WebAssembly stack.
-loop:
- Loop
- Get PC_F
- CallIndirect $0
- Drop
+// It is expected to have a pending call before entering the loop, so check PAUSE first.
+ Get PAUSE
+ I32Eqz
+ If
+ loop:
+ Loop
+ // Get PC_B & PC_F from -8(SP)
+ Get SP
+ I32Const $8
+ I32Sub
+ I32Load16U $0 // PC_B
- Get PAUSE
- I32Eqz
- BrIf loop
+ Get SP
+ I32Const $8
+ I32Sub
+ I32Load16U $2 // PC_F
+
+ CallIndirect $0
+ Drop
+
+ Get PAUSE
+ I32Eqz
+ BrIf loop
+ End
End
I32Const $0
@@ -91,6 +96,7 @@ TEXT runtime·pause(SB), NOSPLIT, $0-8
RETUNWIND
TEXT runtime·exit(SB), NOSPLIT, $0-4
+ I32Const $0
Call runtime·wasmExit(SB)
Drop
I32Const $1
diff --git a/src/runtime/rt0_linux_mipsx.s b/src/runtime/rt0_linux_mipsx.s
index 17f6c3b4c8..74b8f50b73 100644
--- a/src/runtime/rt0_linux_mipsx.s
+++ b/src/runtime/rt0_linux_mipsx.s
@@ -23,6 +23,6 @@ TEXT _main<>(SB),NOSPLIT|NOFRAME,$0
JMP main(SB)
TEXT main(SB),NOSPLIT|NOFRAME,$0
- // In external linking, libc jumps to main with argc in R4, argv in R5
+ // In external linking, libc jumps to main with argc in R4, argv in R5
MOVW $runtime·rt0_go(SB), R1
JMP (R1)
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index bc5b48222b..16c02cd1ed 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -775,9 +775,16 @@ func extendRandom(r []byte, n int) {
// A _defer holds an entry on the list of deferred calls.
// If you add a field here, add code to clear it in freedefer.
+// This struct must match the code in cmd/compile/internal/gc/reflect.go:deferstruct
+// and cmd/compile/internal/gc/ssa.go:(*state).call.
+// Some defers will be allocated on the stack and some on the heap.
+// All defers are logically part of the stack, so write barriers to
+// initialize them are not required. All defers must be manually scanned,
+// and for heap defers, marked.
type _defer struct {
- siz int32
+ siz int32 // includes both arguments and results
started bool
+ heap bool
sp uintptr // sp at time of defer
pc uintptr
fn *funcval
diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go
index 1dd56989b4..ad51dc1800 100644
--- a/src/runtime/signal_unix.go
+++ b/src/runtime/signal_unix.go
@@ -268,7 +268,7 @@ func setThreadCPUProfiler(hz int32) {
}
func sigpipe() {
- if sigsend(_SIGPIPE) {
+ if signal_ignored(_SIGPIPE) || sigsend(_SIGPIPE) {
return
}
dieFromSignal(_SIGPIPE)
@@ -369,6 +369,9 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
//
// The signal handler must not inject a call to sigpanic if
// getg().throwsplit, since sigpanic may need to grow the stack.
+//
+// This is exported via linkname to assembly in runtime/cgo.
+//go:linkname sigpanic
func sigpanic() {
g := getg()
if !canpanic(g) {
@@ -843,7 +846,11 @@ func signalstack(s *stack) {
}
// setsigsegv is used on darwin/arm{,64} to fake a segmentation fault.
+//
+// This is exported via linkname to assembly in runtime/cgo.
+//
//go:nosplit
+//go:linkname setsigsegv
func setsigsegv(pc uintptr) {
g := getg()
g.sig = _SIGSEGV
diff --git a/src/runtime/stack.go b/src/runtime/stack.go
index d5d09ba7d7..7ae3eeef83 100644
--- a/src/runtime/stack.go
+++ b/src/runtime/stack.go
@@ -719,16 +719,21 @@ func adjustctxt(gp *g, adjinfo *adjustinfo) {
}
func adjustdefers(gp *g, adjinfo *adjustinfo) {
- // Adjust defer argument blocks the same way we adjust active stack frames.
- tracebackdefers(gp, adjustframe, noescape(unsafe.Pointer(adjinfo)))
-
// Adjust pointers in the Defer structs.
- // Defer structs themselves are never on the stack.
+ // We need to do this first because we need to adjust the
+ // defer.link fields so we always work on the new stack.
+ adjustpointer(adjinfo, unsafe.Pointer(&gp._defer))
for d := gp._defer; d != nil; d = d.link {
adjustpointer(adjinfo, unsafe.Pointer(&d.fn))
adjustpointer(adjinfo, unsafe.Pointer(&d.sp))
adjustpointer(adjinfo, unsafe.Pointer(&d._panic))
+ adjustpointer(adjinfo, unsafe.Pointer(&d.link))
}
+
+ // Adjust defer argument blocks the same way we adjust active stack frames.
+ // Note: this code is after the loop above, so that if a defer record is
+ // stack allocated, we work on the copy in the new stack.
+ tracebackdefers(gp, adjustframe, noescape(unsafe.Pointer(adjinfo)))
}
func adjustpanics(gp *g, adjinfo *adjustinfo) {
@@ -1295,7 +1300,10 @@ type stackObjectRecord struct {
typ *_type
}
+// This is exported as ABI0 via linkname so obj can call it.
+//
//go:nosplit
+//go:linkname morestackc
func morestackc() {
throw("attempt to execute system stack code on user stack")
}
diff --git a/src/runtime/stack_test.go b/src/runtime/stack_test.go
index df73b3a1d5..143d3a99a0 100644
--- a/src/runtime/stack_test.go
+++ b/src/runtime/stack_test.go
@@ -799,3 +799,58 @@ func TestDeferLiveness(t *testing.T) {
t.Errorf("output:\n%s\n\nwant no output", output)
}
}
+
+func TestDeferHeapAndStack(t *testing.T) {
+ P := 4 // processors
+ N := 10000 //iterations
+ D := 200 // stack depth
+
+ if testing.Short() {
+ P /= 2
+ N /= 10
+ D /= 10
+ }
+ c := make(chan bool)
+ for p := 0; p < P; p++ {
+ go func() {
+ for i := 0; i < N; i++ {
+ if deferHeapAndStack(D) != 2*D {
+ panic("bad result")
+ }
+ }
+ c <- true
+ }()
+ }
+ for p := 0; p < P; p++ {
+ <-c
+ }
+}
+
+// deferHeapAndStack(n) computes 2*n
+func deferHeapAndStack(n int) (r int) {
+ if n == 0 {
+ return 0
+ }
+ if n%2 == 0 {
+ // heap-allocated defers
+ for i := 0; i < 2; i++ {
+ defer func() {
+ r++
+ }()
+ }
+ } else {
+ // stack-allocated defers
+ defer func() {
+ r++
+ }()
+ defer func() {
+ r++
+ }()
+ }
+ r = deferHeapAndStack(n - 1)
+ escapeMe(new([1024]byte)) // force some GCs
+ return
+}
+
+// Pass a value to escapeMe to force it to escape.
+var escapeMe = func(x interface{}) {}
diff --git a/src/runtime/string.go b/src/runtime/string.go
index 839e882cdc..d198f73756 100644
--- a/src/runtime/string.go
+++ b/src/runtime/string.go
@@ -310,6 +310,8 @@ func gobytes(p *byte, n int) (b []byte) {
return
}
+// This is exported via linkname to assembly in syscall (for Plan9).
+//go:linkname gostring
func gostring(p *byte) string {
l := findnull(p)
if l == 0 {
diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go
index 18e64dd5f7..26aaf2224d 100644
--- a/src/runtime/stubs.go
+++ b/src/runtime/stubs.go
@@ -248,9 +248,6 @@ func getclosureptr() uintptr
//go:noescape
func asmcgocall(fn, arg unsafe.Pointer) int32
-// argp used in Defer structs when there is no argp.
-const _NoArgs = ^uintptr(0)
-
func morestack()
func morestack_noctxt()
func rt0_go()
diff --git a/src/runtime/sys_aix_ppc64.s b/src/runtime/sys_aix_ppc64.s
index 9561e11d28..75f41786cd 100644
--- a/src/runtime/sys_aix_ppc64.s
+++ b/src/runtime/sys_aix_ppc64.s
@@ -59,7 +59,7 @@ TEXT asmsyscall6<>(SB),NOSPLIT,$256
CMP R6, R3
BNE skiperrno
- // Save errno in libcall
+ // Save errno in libcall
BL runtime·load_g(SB)
MOVD g_m(g), R4
MOVD (m_mOS + mOS_perrno)(R4), R9
diff --git a/src/runtime/sys_darwin.go b/src/runtime/sys_darwin.go
index 434fa5f588..2aaa0f8546 100644
--- a/src/runtime/sys_darwin.go
+++ b/src/runtime/sys_darwin.go
@@ -128,10 +128,10 @@ func pthread_attr_init_trampoline()
//go:nosplit
//go:cgo_unsafe_args
-func pthread_attr_setstacksize(attr *pthreadattr, size uintptr) int32 {
- return libcCall(unsafe.Pointer(funcPC(pthread_attr_setstacksize_trampoline)), unsafe.Pointer(&attr))
+func pthread_attr_getstacksize(attr *pthreadattr, size *uintptr) int32 {
+ return libcCall(unsafe.Pointer(funcPC(pthread_attr_getstacksize_trampoline)), unsafe.Pointer(&attr))
}
-func pthread_attr_setstacksize_trampoline()
+func pthread_attr_getstacksize_trampoline()
//go:nosplit
//go:cgo_unsafe_args
@@ -206,6 +206,9 @@ func close_trampoline()
//go:nosplit
//go:cgo_unsafe_args
+//
+// This is exported via linkname to assembly in runtime/cgo.
+//go:linkname exit
func exit(code int32) {
libcCall(unsafe.Pointer(funcPC(exit_trampoline)), unsafe.Pointer(&code))
}
@@ -336,52 +339,33 @@ func kevent_trampoline()
//go:nosplit
//go:cgo_unsafe_args
-func pthread_mutex_init(m *pthreadmutex, attr *pthreadmutexattr) int32 {
- return libcCall(unsafe.Pointer(funcPC(pthread_mutex_init_trampoline)), unsafe.Pointer(&m))
+func dispatch_semaphore_create(val int) (sema uintptr) {
+ libcCall(unsafe.Pointer(funcPC(dispatch_semaphore_create_trampoline)), unsafe.Pointer(&val))
+ return
}
-func pthread_mutex_init_trampoline()
+func dispatch_semaphore_create_trampoline()
//go:nosplit
//go:cgo_unsafe_args
-func pthread_mutex_lock(m *pthreadmutex) int32 {
- return libcCall(unsafe.Pointer(funcPC(pthread_mutex_lock_trampoline)), unsafe.Pointer(&m))
+func dispatch_semaphore_wait(sema uintptr, t uint64) int32 {
+ return libcCall(unsafe.Pointer(funcPC(dispatch_semaphore_wait_trampoline)), unsafe.Pointer(&sema))
}
-func pthread_mutex_lock_trampoline()
+func dispatch_semaphore_wait_trampoline()
//go:nosplit
//go:cgo_unsafe_args
-func pthread_mutex_unlock(m *pthreadmutex) int32 {
- return libcCall(unsafe.Pointer(funcPC(pthread_mutex_unlock_trampoline)), unsafe.Pointer(&m))
+func dispatch_semaphore_signal(sema uintptr) {
+ libcCall(unsafe.Pointer(funcPC(dispatch_semaphore_signal_trampoline)), unsafe.Pointer(&sema))
}
-func pthread_mutex_unlock_trampoline()
+func dispatch_semaphore_signal_trampoline()
//go:nosplit
//go:cgo_unsafe_args
-func pthread_cond_init(c *pthreadcond, attr *pthreadcondattr) int32 {
- return libcCall(unsafe.Pointer(funcPC(pthread_cond_init_trampoline)), unsafe.Pointer(&c))
+func dispatch_time(base uint64, delta int64) (result uint64) {
+ libcCall(unsafe.Pointer(funcPC(dispatch_time_trampoline)), unsafe.Pointer(&base))
+ return
}
-func pthread_cond_init_trampoline()
-
-//go:nosplit
-//go:cgo_unsafe_args
-func pthread_cond_wait(c *pthreadcond, m *pthreadmutex) int32 {
- return libcCall(unsafe.Pointer(funcPC(pthread_cond_wait_trampoline)), unsafe.Pointer(&c))
-}
-func pthread_cond_wait_trampoline()
-
-//go:nosplit
-//go:cgo_unsafe_args
-func pthread_cond_timedwait_relative_np(c *pthreadcond, m *pthreadmutex, t *timespec) int32 {
- return libcCall(unsafe.Pointer(funcPC(pthread_cond_timedwait_relative_np_trampoline)), unsafe.Pointer(&c))
-}
-func pthread_cond_timedwait_relative_np_trampoline()
-
-//go:nosplit
-//go:cgo_unsafe_args
-func pthread_cond_signal(c *pthreadcond) int32 {
- return libcCall(unsafe.Pointer(funcPC(pthread_cond_signal_trampoline)), unsafe.Pointer(&c))
-}
-func pthread_cond_signal_trampoline()
+func dispatch_time_trampoline()
// Not used on Darwin, but must be defined.
func exitThread(wait *uint32) {
@@ -396,7 +380,7 @@ func closeonexec(fd int32) {
// in a system library, with the libc_ prefix missing.
//go:cgo_import_dynamic libc_pthread_attr_init pthread_attr_init "/usr/lib/libSystem.B.dylib"
-//go:cgo_import_dynamic libc_pthread_attr_setstacksize pthread_attr_setstacksize "/usr/lib/libSystem.B.dylib"
+//go:cgo_import_dynamic libc_pthread_attr_getstacksize pthread_attr_getstacksize "/usr/lib/libSystem.B.dylib"
//go:cgo_import_dynamic libc_pthread_attr_setdetachstate pthread_attr_setdetachstate "/usr/lib/libSystem.B.dylib"
//go:cgo_import_dynamic libc_pthread_create pthread_create "/usr/lib/libSystem.B.dylib"
//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib"
@@ -427,13 +411,10 @@ func closeonexec(fd int32) {
//go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib"
//go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib"
-//go:cgo_import_dynamic libc_pthread_mutex_init pthread_mutex_init "/usr/lib/libSystem.B.dylib"
-//go:cgo_import_dynamic libc_pthread_mutex_lock pthread_mutex_lock "/usr/lib/libSystem.B.dylib"
-//go:cgo_import_dynamic libc_pthread_mutex_unlock pthread_mutex_unlock "/usr/lib/libSystem.B.dylib"
-//go:cgo_import_dynamic libc_pthread_cond_init pthread_cond_init "/usr/lib/libSystem.B.dylib"
-//go:cgo_import_dynamic libc_pthread_cond_wait pthread_cond_wait "/usr/lib/libSystem.B.dylib"
-//go:cgo_import_dynamic libc_pthread_cond_timedwait_relative_np pthread_cond_timedwait_relative_np "/usr/lib/libSystem.B.dylib"
-//go:cgo_import_dynamic libc_pthread_cond_signal pthread_cond_signal "/usr/lib/libSystem.B.dylib"
+//go:cgo_import_dynamic libc_dispatch_semaphore_create dispatch_semaphore_create "/usr/lib/libSystem.B.dylib"
+//go:cgo_import_dynamic libc_dispatch_semaphore_wait dispatch_semaphore_wait "/usr/lib/libSystem.B.dylib"
+//go:cgo_import_dynamic libc_dispatch_semaphore_signal dispatch_semaphore_signal "/usr/lib/libSystem.B.dylib"
+//go:cgo_import_dynamic libc_dispatch_time dispatch_time "/usr/lib/libSystem.B.dylib"
// Magic incantation to get libSystem actually dynamically linked.
// TODO: Why does the code require this? See cmd/link/internal/ld/go.go
diff --git a/src/runtime/sys_darwin_386.s b/src/runtime/sys_darwin_386.s
index d318509e0a..0c54d13b02 100644
--- a/src/runtime/sys_darwin_386.s
+++ b/src/runtime/sys_darwin_386.s
@@ -474,7 +474,7 @@ TEXT runtime·pthread_attr_init_trampoline(SB),NOSPLIT,$0
POPL BP
RET
-TEXT runtime·pthread_attr_setstacksize_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_attr_getstacksize_trampoline(SB),NOSPLIT,$0
PUSHL BP
MOVL SP, BP
SUBL $8, SP
@@ -483,7 +483,7 @@ TEXT runtime·pthread_attr_setstacksize_trampoline(SB),NOSPLIT,$0
MOVL AX, 0(SP)
MOVL 4(CX), AX // arg 2 size
MOVL AX, 4(SP)
- CALL libc_pthread_attr_setstacksize(SB)
+ CALL libc_pthread_attr_getstacksize(SB)
MOVL BP, SP
POPL BP
RET
@@ -532,96 +532,63 @@ TEXT runtime·raise_trampoline(SB),NOSPLIT,$0
POPL BP
RET
-TEXT runtime·pthread_mutex_init_trampoline(SB),NOSPLIT,$0
+TEXT runtime·dispatch_semaphore_create_trampoline(SB),NOSPLIT,$0
PUSHL BP
MOVL SP, BP
SUBL $8, SP
- MOVL 16(SP), CX
- MOVL 0(CX), AX // arg 1 mutex
+ MOVL 16(SP), BX
+ MOVL 0(BX), AX // arg 1 value
MOVL AX, 0(SP)
- MOVL 4(CX), AX // arg 2 attr
- MOVL AX, 4(SP)
- CALL libc_pthread_mutex_init(SB)
+ CALL libc_dispatch_semaphore_create(SB)
+ MOVL AX, 4(BX) // result sema
MOVL BP, SP
POPL BP
RET
-TEXT runtime·pthread_mutex_lock_trampoline(SB),NOSPLIT,$0
- PUSHL BP
- MOVL SP, BP
- SUBL $8, SP
- MOVL 16(SP), CX
- MOVL 0(CX), AX // arg 1 mutex
- MOVL AX, 0(SP)
- CALL libc_pthread_mutex_lock(SB)
- MOVL BP, SP
- POPL BP
- RET
-
-TEXT runtime·pthread_mutex_unlock_trampoline(SB),NOSPLIT,$0
- PUSHL BP
- MOVL SP, BP
- SUBL $8, SP
- MOVL 16(SP), CX
- MOVL 0(CX), AX // arg 1 mutex
- MOVL AX, 0(SP)
- CALL libc_pthread_mutex_unlock(SB)
- MOVL BP, SP
- POPL BP
- RET
-
-TEXT runtime·pthread_cond_init_trampoline(SB),NOSPLIT,$0
- PUSHL BP
- MOVL SP, BP
- SUBL $8, SP
- MOVL 16(SP), CX
- MOVL 0(CX), AX // arg 1 cond
- MOVL AX, 0(SP)
- MOVL 4(CX), AX // arg 2 attr
- MOVL AX, 4(SP)
- CALL libc_pthread_cond_init(SB)
- MOVL BP, SP
- POPL BP
- RET
-
-TEXT runtime·pthread_cond_wait_trampoline(SB),NOSPLIT,$0
- PUSHL BP
- MOVL SP, BP
- SUBL $8, SP
- MOVL 16(SP), CX
- MOVL 0(CX), AX // arg 1 cond
- MOVL AX, 0(SP)
- MOVL 4(CX), AX // arg 2 mutex
- MOVL AX, 4(SP)
- CALL libc_pthread_cond_wait(SB)
- MOVL BP, SP
- POPL BP
- RET
-
-TEXT runtime·pthread_cond_timedwait_relative_np_trampoline(SB),NOSPLIT,$0
+TEXT runtime·dispatch_semaphore_wait_trampoline(SB),NOSPLIT,$0
PUSHL BP
MOVL SP, BP
SUBL $24, SP
MOVL 32(SP), CX
- MOVL 0(CX), AX // arg 1 cond
+ MOVL 0(CX), AX // arg 1 sema
MOVL AX, 0(SP)
- MOVL 4(CX), AX // arg 2 mutex
+ MOVL 4(CX), AX // arg 2 timeout/0
MOVL AX, 4(SP)
- MOVL 8(CX), AX // arg 3 timeout
+ MOVL 8(CX), AX // arg 2 timeout/1
MOVL AX, 8(SP)
- CALL libc_pthread_cond_timedwait_relative_np(SB)
+ CALL libc_dispatch_semaphore_wait(SB)
MOVL BP, SP
POPL BP
RET
-TEXT runtime·pthread_cond_signal_trampoline(SB),NOSPLIT,$0
+TEXT runtime·dispatch_semaphore_signal_trampoline(SB),NOSPLIT,$0
PUSHL BP
MOVL SP, BP
SUBL $8, SP
MOVL 16(SP), CX
- MOVL 0(CX), AX // arg 1 cond
+ MOVL 0(CX), AX // arg 1 sema
MOVL AX, 0(SP)
- CALL libc_pthread_cond_signal(SB)
+ CALL libc_dispatch_semaphore_signal(SB)
+ MOVL BP, SP
+ POPL BP
+ RET
+
+TEXT runtime·dispatch_time_trampoline(SB),NOSPLIT,$0
+ PUSHL BP
+ MOVL SP, BP
+ SUBL $24, SP
+ MOVL 32(SP), BX
+ MOVL 0(BX), AX // arg 1 base/0
+ MOVL AX, 0(SP)
+ MOVL 4(BX), AX // arg 1 base/1
+ MOVL AX, 4(SP)
+ MOVL 8(BX), AX // arg 2 delta/0
+ MOVL AX, 8(SP)
+ MOVL 12(BX), AX // arg 2 delta/1
+ MOVL AX, 12(SP)
+ CALL libc_dispatch_time(SB)
+ MOVL AX, 16(BX) // result/0
+ MOVL DX, 20(BX) // result/1
MOVL BP, SP
POPL BP
RET
diff --git a/src/runtime/sys_darwin_amd64.s b/src/runtime/sys_darwin_amd64.s
index 934c510b88..95ba496cbc 100644
--- a/src/runtime/sys_darwin_amd64.s
+++ b/src/runtime/sys_darwin_amd64.s
@@ -369,7 +369,7 @@ TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0
MOVQ 40(DI), R9 // arg 6 ts
MOVL 0(DI), DI // arg 1 kq
CALL libc_kevent(SB)
- CMPQ AX, $-1
+ CMPL AX, $-1
JNE ok
CALL libc_error(SB)
MOVLQSX (AX), AX // errno
@@ -443,12 +443,12 @@ TEXT runtime·pthread_attr_init_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·pthread_attr_setstacksize_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_attr_getstacksize_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 size
MOVQ 0(DI), DI // arg 1 attr
- CALL libc_pthread_attr_setstacksize(SB)
+ CALL libc_pthread_attr_getstacksize(SB)
POPQ BP
RET
@@ -482,64 +482,44 @@ TEXT runtime·raise_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·pthread_mutex_init_trampoline(SB),NOSPLIT,$0
+TEXT runtime·dispatch_semaphore_create_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
- MOVQ 8(DI), SI // arg 2 attr
- MOVQ 0(DI), DI // arg 1 mutex
- CALL libc_pthread_mutex_init(SB)
+ MOVQ DI, BX
+ MOVQ 0(BX), DI // arg 1 value
+ CALL libc_dispatch_semaphore_create(SB)
+ MOVQ AX, 8(BX) // result sema
POPQ BP
RET
-TEXT runtime·pthread_mutex_lock_trampoline(SB),NOSPLIT,$0
+TEXT runtime·dispatch_semaphore_wait_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
- MOVQ 0(DI), DI // arg 1 mutex
- CALL libc_pthread_mutex_lock(SB)
+ MOVQ 8(DI), SI // arg 2 timeout
+ MOVQ 0(DI), DI // arg 1 sema
+ CALL libc_dispatch_semaphore_wait(SB)
+ TESTQ AX, AX // For safety convert 64-bit result to int32 0 or 1.
+ JEQ 2(PC)
+ MOVL $1, AX
POPQ BP
RET
-TEXT runtime·pthread_mutex_unlock_trampoline(SB),NOSPLIT,$0
+TEXT runtime·dispatch_semaphore_signal_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
- MOVQ 0(DI), DI // arg 1 mutex
- CALL libc_pthread_mutex_unlock(SB)
+ MOVQ 0(DI), DI // arg 1 sema
+ CALL libc_dispatch_semaphore_signal(SB)
POPQ BP
RET
-TEXT runtime·pthread_cond_init_trampoline(SB),NOSPLIT,$0
+TEXT runtime·dispatch_time_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
- MOVQ 8(DI), SI // arg 2 attr
- MOVQ 0(DI), DI // arg 1 cond
- CALL libc_pthread_cond_init(SB)
- POPQ BP
- RET
-
-TEXT runtime·pthread_cond_wait_trampoline(SB),NOSPLIT,$0
- PUSHQ BP
- MOVQ SP, BP
- MOVQ 8(DI), SI // arg 2 mutex
- MOVQ 0(DI), DI // arg 1 cond
- CALL libc_pthread_cond_wait(SB)
- POPQ BP
- RET
-
-TEXT runtime·pthread_cond_timedwait_relative_np_trampoline(SB),NOSPLIT,$0
- PUSHQ BP
- MOVQ SP, BP
- MOVQ 8(DI), SI // arg 2 mutex
- MOVQ 16(DI), DX // arg 3 timeout
- MOVQ 0(DI), DI // arg 1 cond
- CALL libc_pthread_cond_timedwait_relative_np(SB)
- POPQ BP
- RET
-
-TEXT runtime·pthread_cond_signal_trampoline(SB),NOSPLIT,$0
- PUSHQ BP
- MOVQ SP, BP
- MOVQ 0(DI), DI // arg 1 cond
- CALL libc_pthread_cond_signal(SB)
+ MOVQ DI, BX
+ MOVQ 0(BX), DI // arg 1 base
+ MOVQ 8(BX), SI // arg 2 delta
+ CALL libc_dispatch_time(SB)
+ MOVQ AX, 16(BX)
POPQ BP
RET
@@ -556,6 +536,9 @@ TEXT runtime·pthread_cond_signal_trampoline(SB),NOSPLIT,$0
// }
// syscall must be called on the g0 stack with the
// C calling convention (use libcCall).
+//
+// syscall expects a 32-bit result and tests for 32-bit -1
+// to decide there was an error.
TEXT runtime·syscall(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
@@ -603,6 +586,9 @@ ok:
// }
// syscallX must be called on the g0 stack with the
// C calling convention (use libcCall).
+//
+// syscallX is like syscall but expects a 64-bit result
+// and tests for 64-bit -1 to decide there was an error.
TEXT runtime·syscallX(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
@@ -689,6 +675,9 @@ ok:
// }
// syscall6 must be called on the g0 stack with the
// C calling convention (use libcCall).
+//
+// syscall6 expects a 32-bit result and tests for 32-bit -1
+// to decide there was an error.
TEXT runtime·syscall6(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
@@ -739,6 +728,9 @@ ok:
// }
// syscall6X must be called on the g0 stack with the
// C calling convention (use libcCall).
+//
+// syscall6X is like syscall6 but expects a 64-bit result
+// and tests for 64-bit -1 to decide there was an error.
TEXT runtime·syscall6X(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
diff --git a/src/runtime/sys_darwin_arm.s b/src/runtime/sys_darwin_arm.s
index 6c3fa0739d..bb0832f3af 100644
--- a/src/runtime/sys_darwin_arm.s
+++ b/src/runtime/sys_darwin_arm.s
@@ -323,7 +323,7 @@ TEXT runtime·pthread_attr_init_trampoline(SB),NOSPLIT,$0
BL libc_exit(SB)
RET
-TEXT runtime·pthread_attr_setstacksize_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_attr_getstacksize_trampoline(SB),NOSPLIT,$0
MOVW $46, R0
BL libc_exit(SB)
RET
@@ -343,44 +343,34 @@ TEXT runtime·raise_trampoline(SB),NOSPLIT,$0
BL libc_raise(SB)
RET
-TEXT runtime·pthread_mutex_init_trampoline(SB),NOSPLIT,$0
- MOVW 4(R0), R1 // arg 2 attr
- MOVW 0(R0), R0 // arg 1 mutex
- BL libc_pthread_mutex_init(SB)
+TEXT runtime·dispatch_semaphore_create_trampoline(SB),NOSPLIT,$0
+ MOVW R0, R8
+ MOVW 0(R8), R0 // arg 1 value
+ BL libc_dispatch_semaphore_create(SB)
+ MOVW R0, 4(R8) // result sema
RET
-TEXT runtime·pthread_mutex_lock_trampoline(SB),NOSPLIT,$0
- MOVW 0(R0), R0 // arg 1 mutex
- BL libc_pthread_mutex_lock(SB)
+TEXT runtime·dispatch_semaphore_wait_trampoline(SB),NOSPLIT,$0
+ MOVW 4(R0), R1 // arg 2 timeout/0
+ MOVW 8(R0), R2 // arg 2 timeout/1
+ MOVW 0(R0), R0 // arg 1 sema
+ BL libc_dispatch_semaphore_wait(SB)
RET
-TEXT runtime·pthread_mutex_unlock_trampoline(SB),NOSPLIT,$0
- MOVW 0(R0), R0 // arg 1 mutex
- BL libc_pthread_mutex_unlock(SB)
+TEXT runtime·dispatch_semaphore_signal_trampoline(SB),NOSPLIT,$0
+ MOVW 0(R0), R0 // arg 1 sema
+ BL libc_dispatch_semaphore_signal(SB)
RET
-TEXT runtime·pthread_cond_init_trampoline(SB),NOSPLIT,$0
- MOVW 4(R0), R1 // arg 2 attr
- MOVW 0(R0), R0 // arg 1 cond
- BL libc_pthread_cond_init(SB)
- RET
-
-TEXT runtime·pthread_cond_wait_trampoline(SB),NOSPLIT,$0
- MOVW 4(R0), R1 // arg 2 mutex
- MOVW 0(R0), R0 // arg 1 cond
- BL libc_pthread_cond_wait(SB)
- RET
-
-TEXT runtime·pthread_cond_timedwait_relative_np_trampoline(SB),NOSPLIT,$0
- MOVW 4(R0), R1 // arg 2 mutex
- MOVW 8(R0), R2 // arg 3 timeout
- MOVW 0(R0), R0 // arg 1 cond
- BL libc_pthread_cond_timedwait_relative_np(SB)
- RET
-
-TEXT runtime·pthread_cond_signal_trampoline(SB),NOSPLIT,$0
- MOVW 0(R0), R0 // arg 1 cond
- BL libc_pthread_cond_signal(SB)
+TEXT runtime·dispatch_time_trampoline(SB),NOSPLIT,$0
+ MOVW R0, R8
+ MOVW 0(R8), R0 // arg 1 base/0
+ MOVW 4(R8), R1 // arg 1 base/1
+ MOVW 8(R8), R2 // arg 2 delta/0
+ MOVW 12(R8), R3 // arg 2 delta/1
+ BL libc_dispatch_time(SB)
+ MOVW R0, 16(R8) // result/0
+ MOVW R1, 20(R8) // result/1
RET
// syscall calls a function in libc on behalf of the syscall package.
diff --git a/src/runtime/sys_darwin_arm64.s b/src/runtime/sys_darwin_arm64.s
index fa6157eba9..4c81b99336 100644
--- a/src/runtime/sys_darwin_arm64.s
+++ b/src/runtime/sys_darwin_arm64.s
@@ -41,7 +41,7 @@ TEXT runtime·read_trampoline(SB),NOSPLIT,$0
MOVD 8(R0), R1 // arg 2 buf
MOVW 16(R0), R2 // arg 3 count
MOVW 0(R0), R0 // arg 1 fd
- BL libc_read(SB)
+ BL libc_read(SB)
RET
TEXT runtime·exit_trampoline(SB),NOSPLIT|NOFRAME,$0
@@ -72,7 +72,7 @@ TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0
MOVD $-1, R2
CMP R0, R2
BNE ok
- BL libc_error(SB)
+ BL libc_error(SB)
MOVW (R0), R1
MOVD $0, R0
ok:
@@ -84,8 +84,8 @@ TEXT runtime·munmap_trampoline(SB),NOSPLIT,$0
MOVD 8(R0), R1 // arg 2 len
MOVD 0(R0), R0 // arg 1 addr
BL libc_munmap(SB)
- CMP $0, R0
- BEQ 2(PC)
+ CMP $0, R0
+ BEQ 2(PC)
BL notok<>(SB)
RET
@@ -145,22 +145,28 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
BL (R11)
RET
-TEXT runtime·sigtramp(SB),NOSPLIT,$0
- // Reserve space for callee-save registers and arguments.
- SUB $(8*16), RSP
-
- // Save callee-save registers.
- MOVD R19, (8*4)(RSP)
- MOVD R20, (8*5)(RSP)
- MOVD R21, (8*6)(RSP)
- MOVD R22, (8*7)(RSP)
- MOVD R23, (8*8)(RSP)
- MOVD R24, (8*9)(RSP)
- MOVD R25, (8*10)(RSP)
- MOVD R26, (8*11)(RSP)
- MOVD R27, (8*12)(RSP)
- MOVD g, (8*13)(RSP)
- MOVD R29, (8*14)(RSP)
+TEXT runtime·sigtramp(SB),NOSPLIT,$192
+ // Save callee-save registers in the case of signal forwarding.
+ // Please refer to https://golang.org/issue/31827 .
+ MOVD R19, 8*4(RSP)
+ MOVD R20, 8*5(RSP)
+ MOVD R21, 8*6(RSP)
+ MOVD R22, 8*7(RSP)
+ MOVD R23, 8*8(RSP)
+ MOVD R24, 8*9(RSP)
+ MOVD R25, 8*10(RSP)
+ MOVD R26, 8*11(RSP)
+ MOVD R27, 8*12(RSP)
+ MOVD g, 8*13(RSP)
+ MOVD R29, 8*14(RSP)
+ FMOVD F8, 8*15(RSP)
+ FMOVD F9, 8*16(RSP)
+ FMOVD F10, 8*17(RSP)
+ FMOVD F11, 8*18(RSP)
+ FMOVD F12, 8*19(RSP)
+ FMOVD F13, 8*20(RSP)
+ FMOVD F14, 8*21(RSP)
+ FMOVD F15, 8*22(RSP)
// Save arguments.
MOVW R0, (8*1)(RSP) // sig
@@ -174,9 +180,9 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$0
BEQ 2(PC)
BL runtime·load_g(SB)
- MOVD RSP, R6
- CMP $0, g
- BEQ nog
+ MOVD RSP, R6
+ CMP $0, g
+ BEQ nog
// iOS always use the main stack to run the signal handler.
// We need to switch to gsignal ourselves.
MOVD g_m(g), R11
@@ -221,8 +227,14 @@ nog:
MOVD (8*12)(RSP), R27
MOVD (8*13)(RSP), g
MOVD (8*14)(RSP), R29
-
- ADD $(8*16), RSP
+ FMOVD (8*15)(RSP), F8
+ FMOVD (8*16)(RSP), F9
+ FMOVD (8*17)(RSP), F10
+ FMOVD (8*18)(RSP), F11
+ FMOVD (8*19)(RSP), F12
+ FMOVD (8*20)(RSP), F13
+ FMOVD (8*21)(RSP), F14
+ FMOVD (8*22)(RSP), F15
RET
@@ -234,7 +246,7 @@ TEXT runtime·sigprocmask_trampoline(SB),NOSPLIT,$0
MOVD 16(R0), R2 // arg 3 old
MOVW 0(R0), R0 // arg 1 how
BL libc_pthread_sigmask(SB)
- CMP $0, R0
+ CMP $0, R0
BEQ 2(PC)
BL notok<>(SB)
RET
@@ -279,7 +291,7 @@ TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0
MOVD $-1, R2
CMP R0, R2
BNE ok
- BL libc_error(SB)
+ BL libc_error(SB)
MOVW (R0), R0 // errno
NEG R0, R0 // caller wants it as a negative error code
ok:
@@ -308,60 +320,60 @@ TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$0
// mstart_stub is the first function executed on a new thread started by pthread_create.
// It just does some low-level setup and then calls mstart.
// Note: called with the C calling convention.
-TEXT runtime·mstart_stub(SB),NOSPLIT,$0
+TEXT runtime·mstart_stub(SB),NOSPLIT,$160
// R0 points to the m.
// We are already on m's g0 stack.
// Save callee-save registers.
- SUB $144, RSP
- MOVD R19, 0(RSP)
- MOVD R20, 8(RSP)
- MOVD R21, 16(RSP)
- MOVD R22, 24(RSP)
- MOVD R23, 32(RSP)
- MOVD R24, 40(RSP)
- MOVD R25, 48(RSP)
- MOVD R26, 56(RSP)
- MOVD R27, 64(RSP)
- MOVD g, 72(RSP)
- FMOVD F8, 80(RSP)
- FMOVD F9, 88(RSP)
- FMOVD F10, 96(RSP)
- FMOVD F11, 104(RSP)
- FMOVD F12, 112(RSP)
- FMOVD F13, 120(RSP)
- FMOVD F14, 128(RSP)
- FMOVD F15, 136(RSP)
+ MOVD R19, 8(RSP)
+ MOVD R20, 16(RSP)
+ MOVD R21, 24(RSP)
+ MOVD R22, 32(RSP)
+ MOVD R23, 40(RSP)
+ MOVD R24, 48(RSP)
+ MOVD R25, 56(RSP)
+ MOVD R26, 64(RSP)
+ MOVD R27, 72(RSP)
+ MOVD g, 80(RSP)
+ MOVD R29, 88(RSP)
+ FMOVD F8, 96(RSP)
+ FMOVD F9, 104(RSP)
+ FMOVD F10, 112(RSP)
+ FMOVD F11, 120(RSP)
+ FMOVD F12, 128(RSP)
+ FMOVD F13, 136(RSP)
+ FMOVD F14, 144(RSP)
+ FMOVD F15, 152(RSP)
MOVD m_g0(R0), g
- BL runtime·mstart(SB)
+ BL runtime·mstart(SB)
// Restore callee-save registers.
- MOVD 0(RSP), R19
- MOVD 8(RSP), R20
- MOVD 16(RSP), R21
- MOVD 24(RSP), R22
- MOVD 32(RSP), R23
- MOVD 40(RSP), R24
- MOVD 48(RSP), R25
- MOVD 56(RSP), R26
- MOVD 64(RSP), R27
- MOVD 72(RSP), g
- FMOVD 80(RSP), F8
- FMOVD 88(RSP), F9
- FMOVD 96(RSP), F10
- FMOVD 104(RSP), F11
- FMOVD 112(RSP), F12
- FMOVD 120(RSP), F13
- FMOVD 128(RSP), F14
- FMOVD 136(RSP), F15
- ADD $144, RSP
+ MOVD 8(RSP), R19
+ MOVD 16(RSP), R20
+ MOVD 24(RSP), R21
+ MOVD 32(RSP), R22
+ MOVD 40(RSP), R23
+ MOVD 48(RSP), R24
+ MOVD 56(RSP), R25
+ MOVD 64(RSP), R26
+ MOVD 72(RSP), R27
+ MOVD 80(RSP), g
+ MOVD 88(RSP), R29
+ FMOVD 96(RSP), F8
+ FMOVD 104(RSP), F9
+ FMOVD 112(RSP), F10
+ FMOVD 120(RSP), F11
+ FMOVD 128(RSP), F12
+ FMOVD 136(RSP), F13
+ FMOVD 144(RSP), F14
+ FMOVD 152(RSP), F15
// Go is all done with this OS thread.
// Tell pthread everything is ok (we never join with this thread, so
// the value here doesn't really matter).
- MOVD $0, R0
+ MOVD $0, R0
RET
@@ -370,10 +382,10 @@ TEXT runtime·pthread_attr_init_trampoline(SB),NOSPLIT,$0
BL libc_pthread_attr_init(SB)
RET
-TEXT runtime·pthread_attr_setstacksize_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_attr_getstacksize_trampoline(SB),NOSPLIT,$0
MOVD 8(R0), R1 // arg 2 size
MOVD 0(R0), R0 // arg 1 attr
- BL libc_pthread_attr_setstacksize(SB)
+ BL libc_pthread_attr_getstacksize(SB)
RET
TEXT runtime·pthread_attr_setdetachstate_trampoline(SB),NOSPLIT,$0
@@ -397,44 +409,33 @@ TEXT runtime·raise_trampoline(SB),NOSPLIT,$0
BL libc_raise(SB)
RET
-TEXT runtime·pthread_mutex_init_trampoline(SB),NOSPLIT,$0
- MOVD 8(R0), R1 // arg 2 attr
- MOVD 0(R0), R0 // arg 1 mutex
- BL libc_pthread_mutex_init(SB)
+TEXT runtime·dispatch_semaphore_create_trampoline(SB),NOSPLIT,$0
+ MOVD R0, R19
+ MOVD 0(R19), R0 // arg 1 value
+ BL libc_dispatch_semaphore_create(SB)
+ MOVD R0, 8(R19) // result sema
RET
-TEXT runtime·pthread_mutex_lock_trampoline(SB),NOSPLIT,$0
- MOVD 0(R0), R0 // arg 1 mutex
- BL libc_pthread_mutex_lock(SB)
+TEXT runtime·dispatch_semaphore_wait_trampoline(SB),NOSPLIT,$0
+ MOVD 8(R0), R1 // arg 2 timeout
+ MOVD 0(R0), R0 // arg 1 sema
+ BL libc_dispatch_semaphore_wait(SB)
+ CMP $0, R0 // For safety convert 64-bit result to int32 0 or 1.
+ BEQ 2(PC)
+ MOVW $1, R0
RET
-TEXT runtime·pthread_mutex_unlock_trampoline(SB),NOSPLIT,$0
- MOVD 0(R0), R0 // arg 1 mutex
- BL libc_pthread_mutex_unlock(SB)
+TEXT runtime·dispatch_semaphore_signal_trampoline(SB),NOSPLIT,$0
+ MOVD 0(R0), R0 // arg 1 sema
+ BL libc_dispatch_semaphore_signal(SB)
RET
-TEXT runtime·pthread_cond_init_trampoline(SB),NOSPLIT,$0
- MOVD 8(R0), R1 // arg 2 attr
- MOVD 0(R0), R0 // arg 1 cond
- BL libc_pthread_cond_init(SB)
- RET
-
-TEXT runtime·pthread_cond_wait_trampoline(SB),NOSPLIT,$0
- MOVD 8(R0), R1 // arg 2 mutex
- MOVD 0(R0), R0 // arg 1 cond
- BL libc_pthread_cond_wait(SB)
- RET
-
-TEXT runtime·pthread_cond_timedwait_relative_np_trampoline(SB),NOSPLIT,$0
- MOVD 8(R0), R1 // arg 2 mutex
- MOVD 16(R0), R2 // arg 3 timeout
- MOVD 0(R0), R0 // arg 1 cond
- BL libc_pthread_cond_timedwait_relative_np(SB)
- RET
-
-TEXT runtime·pthread_cond_signal_trampoline(SB),NOSPLIT,$0
- MOVD 0(R0), R0 // arg 1 cond
- BL libc_pthread_cond_signal(SB)
+TEXT runtime·dispatch_time_trampoline(SB),NOSPLIT,$0
+ MOVD R0, R19
+ MOVD 0(R19), R0 // arg 1 base
+ MOVD 8(R19), R1 // arg 2 delta
+ BL libc_dispatch_time(SB)
+ MOVD R0, 16(R19) // result
RET
// syscall calls a function in libc on behalf of the syscall package.
diff --git a/src/runtime/sys_linux_arm64.s b/src/runtime/sys_linux_arm64.s
index 321d74254c..2835b6ca1c 100644
--- a/src/runtime/sys_linux_arm64.s
+++ b/src/runtime/sys_linux_arm64.s
@@ -316,7 +316,29 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
BL (R11)
RET
-TEXT runtime·sigtramp(SB),NOSPLIT,$24
+TEXT runtime·sigtramp(SB),NOSPLIT,$192
+ // Save callee-save registers in the case of signal forwarding.
+ // Please refer to https://golang.org/issue/31827 .
+ MOVD R19, 8*4(RSP)
+ MOVD R20, 8*5(RSP)
+ MOVD R21, 8*6(RSP)
+ MOVD R22, 8*7(RSP)
+ MOVD R23, 8*8(RSP)
+ MOVD R24, 8*9(RSP)
+ MOVD R25, 8*10(RSP)
+ MOVD R26, 8*11(RSP)
+ MOVD R27, 8*12(RSP)
+ MOVD g, 8*13(RSP)
+ MOVD R29, 8*14(RSP)
+ FMOVD F8, 8*15(RSP)
+ FMOVD F9, 8*16(RSP)
+ FMOVD F10, 8*17(RSP)
+ FMOVD F11, 8*18(RSP)
+ FMOVD F12, 8*19(RSP)
+ FMOVD F13, 8*20(RSP)
+ FMOVD F14, 8*21(RSP)
+ FMOVD F15, 8*22(RSP)
+
// this might be called in external code context,
// where g is not set.
// first save R0, because runtime·load_g will clobber it
@@ -330,6 +352,28 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$24
MOVD R2, 24(RSP)
MOVD $runtime·sigtrampgo(SB), R0
BL (R0)
+
+ // Restore callee-save registers.
+ MOVD 8*4(RSP), R19
+ MOVD 8*5(RSP), R20
+ MOVD 8*6(RSP), R21
+ MOVD 8*7(RSP), R22
+ MOVD 8*8(RSP), R23
+ MOVD 8*9(RSP), R24
+ MOVD 8*10(RSP), R25
+ MOVD 8*11(RSP), R26
+ MOVD 8*12(RSP), R27
+ MOVD 8*13(RSP), g
+ MOVD 8*14(RSP), R29
+ FMOVD 8*15(RSP), F8
+ FMOVD 8*16(RSP), F9
+ FMOVD 8*17(RSP), F10
+ FMOVD 8*18(RSP), F11
+ FMOVD 8*19(RSP), F12
+ FMOVD 8*20(RSP), F13
+ FMOVD 8*21(RSP), F14
+ FMOVD 8*22(RSP), F15
+
RET
TEXT runtime·cgoSigtramp(SB),NOSPLIT,$0
diff --git a/src/runtime/sys_netbsd_arm64.s b/src/runtime/sys_netbsd_arm64.s
index fb5589addf..57ded53858 100644
--- a/src/runtime/sys_netbsd_arm64.s
+++ b/src/runtime/sys_netbsd_arm64.s
@@ -276,7 +276,29 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
BL (R11)
RET
-TEXT runtime·sigtramp(SB),NOSPLIT,$24
+TEXT runtime·sigtramp(SB),NOSPLIT,$192
+ // Save callee-save registers in the case of signal forwarding.
+ // Please refer to https://golang.org/issue/31827 .
+ MOVD R19, 8*4(RSP)
+ MOVD R20, 8*5(RSP)
+ MOVD R21, 8*6(RSP)
+ MOVD R22, 8*7(RSP)
+ MOVD R23, 8*8(RSP)
+ MOVD R24, 8*9(RSP)
+ MOVD R25, 8*10(RSP)
+ MOVD R26, 8*11(RSP)
+ MOVD R27, 8*12(RSP)
+ MOVD g, 8*13(RSP)
+ MOVD R29, 8*14(RSP)
+ FMOVD F8, 8*15(RSP)
+ FMOVD F9, 8*16(RSP)
+ FMOVD F10, 8*17(RSP)
+ FMOVD F11, 8*18(RSP)
+ FMOVD F12, 8*19(RSP)
+ FMOVD F13, 8*20(RSP)
+ FMOVD F14, 8*21(RSP)
+ FMOVD F15, 8*22(RSP)
+
// this might be called in external code context,
// where g is not set.
// first save R0, because runtime·load_g will clobber it
@@ -290,6 +312,28 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$24
MOVD R1, 16(RSP)
MOVD R2, 24(RSP)
BL runtime·sigtrampgo(SB)
+
+ // Restore callee-save registers.
+ MOVD 8*4(RSP), R19
+ MOVD 8*5(RSP), R20
+ MOVD 8*6(RSP), R21
+ MOVD 8*7(RSP), R22
+ MOVD 8*8(RSP), R23
+ MOVD 8*9(RSP), R24
+ MOVD 8*10(RSP), R25
+ MOVD 8*11(RSP), R26
+ MOVD 8*12(RSP), R27
+ MOVD 8*13(RSP), g
+ MOVD 8*14(RSP), R29
+ FMOVD 8*15(RSP), F8
+ FMOVD 8*16(RSP), F9
+ FMOVD 8*17(RSP), F10
+ FMOVD 8*18(RSP), F11
+ FMOVD 8*19(RSP), F12
+ FMOVD 8*20(RSP), F13
+ FMOVD 8*21(RSP), F14
+ FMOVD 8*22(RSP), F15
+
RET
TEXT runtime·mmap(SB),NOSPLIT,$0
diff --git a/src/runtime/sys_openbsd_arm64.s b/src/runtime/sys_openbsd_arm64.s
index 8d0f4de689..52bed4bd8b 100644
--- a/src/runtime/sys_openbsd_arm64.s
+++ b/src/runtime/sys_openbsd_arm64.s
@@ -219,7 +219,29 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
BL (R11) // Alignment for ELF ABI?
RET
-TEXT runtime·sigtramp(SB),NOSPLIT,$32
+TEXT runtime·sigtramp(SB),NOSPLIT,$192
+ // Save callee-save registers in the case of signal forwarding.
+ // Please refer to https://golang.org/issue/31827 .
+ MOVD R19, 8*4(RSP)
+ MOVD R20, 8*5(RSP)
+ MOVD R21, 8*6(RSP)
+ MOVD R22, 8*7(RSP)
+ MOVD R23, 8*8(RSP)
+ MOVD R24, 8*9(RSP)
+ MOVD R25, 8*10(RSP)
+ MOVD R26, 8*11(RSP)
+ MOVD R27, 8*12(RSP)
+ MOVD g, 8*13(RSP)
+ MOVD R29, 8*14(RSP)
+ FMOVD F8, 8*15(RSP)
+ FMOVD F9, 8*16(RSP)
+ FMOVD F10, 8*17(RSP)
+ FMOVD F11, 8*18(RSP)
+ FMOVD F12, 8*19(RSP)
+ FMOVD F13, 8*20(RSP)
+ FMOVD F14, 8*21(RSP)
+ FMOVD F15, 8*22(RSP)
+
// If called from an external code context, g will not be set.
// Save R0, since runtime·load_g will clobber it.
MOVW R0, 8(RSP) // signum
@@ -231,6 +253,28 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$32
MOVD R1, 16(RSP)
MOVD R2, 24(RSP)
BL runtime·sigtrampgo(SB)
+
+ // Restore callee-save registers.
+ MOVD 8*4(RSP), R19
+ MOVD 8*5(RSP), R20
+ MOVD 8*6(RSP), R21
+ MOVD 8*7(RSP), R22
+ MOVD 8*8(RSP), R23
+ MOVD 8*9(RSP), R24
+ MOVD 8*10(RSP), R25
+ MOVD 8*11(RSP), R26
+ MOVD 8*12(RSP), R27
+ MOVD 8*13(RSP), g
+ MOVD 8*14(RSP), R29
+ FMOVD 8*15(RSP), F8
+ FMOVD 8*16(RSP), F9
+ FMOVD 8*17(RSP), F10
+ FMOVD 8*18(RSP), F11
+ FMOVD 8*19(RSP), F12
+ FMOVD 8*20(RSP), F13
+ FMOVD 8*21(RSP), F14
+ FMOVD 8*22(RSP), F15
+
RET
// int32 tfork(void *param, uintptr psize, M *mp, G *gp, void (*fn)(void));
diff --git a/src/runtime/syscall_aix.go b/src/runtime/syscall_aix.go
index 1ed1dfa0bb..79b51240e9 100644
--- a/src/runtime/syscall_aix.go
+++ b/src/runtime/syscall_aix.go
@@ -57,19 +57,30 @@ var (
// Syscall is needed because some packages (like net) need it too.
// The best way is to return EINVAL and let Golang handles its failure
// If the syscall can't fail, this function can redirect it to a real syscall.
+//
+// This is exported via linkname to assembly in the syscall package.
+//
//go:nosplit
+//go:linkname syscall_Syscall
func syscall_Syscall(fn, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
return 0, 0, _EINVAL
}
// This is syscall.RawSyscall, it exists to satisfy some build dependency,
// but it doesn't work.
+//
+// This is exported via linkname to assembly in the syscall package.
+//
+//go:linkname syscall_RawSyscall
func syscall_RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
panic("RawSyscall not available on AIX")
}
+// This is exported via linkname to assembly in the syscall package.
+//
//go:nosplit
//go:cgo_unsafe_args
+//go:linkname syscall_syscall6
func syscall_syscall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
c := libcall{
fn: fn,
@@ -83,8 +94,11 @@ func syscall_syscall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err ui
return c.r1, 0, c.err
}
+// This is exported via linkname to assembly in the syscall package.
+//
//go:nosplit
//go:cgo_unsafe_args
+//go:linkname syscall_rawSyscall6
func syscall_rawSyscall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
c := libcall{
fn: fn,
diff --git a/src/runtime/syscall_solaris.go b/src/runtime/syscall_solaris.go
index b1592c511a..35381801c5 100644
--- a/src/runtime/syscall_solaris.go
+++ b/src/runtime/syscall_solaris.go
@@ -31,7 +31,11 @@ var pipe1x libcFunc // name to take addr of pipe1
func pipe1() // declared for vet; do NOT call
+// Many of these are exported via linkname to assembly in the syscall
+// package.
+
//go:nosplit
+//go:linkname syscall_sysvicall6
func syscall_sysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
call := libcall{
fn: fn,
@@ -45,6 +49,7 @@ func syscall_sysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err
}
//go:nosplit
+//go:linkname syscall_rawsysvicall6
func syscall_rawsysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
call := libcall{
fn: fn,
@@ -60,6 +65,7 @@ func syscall_rawsysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, e
// with calls to sysvicallN.
//go:nosplit
+//go:linkname syscall_chdir
func syscall_chdir(path uintptr) (err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_chdir)),
@@ -71,6 +77,7 @@ func syscall_chdir(path uintptr) (err uintptr) {
}
//go:nosplit
+//go:linkname syscall_chroot
func syscall_chroot(path uintptr) (err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_chroot)),
@@ -83,6 +90,7 @@ func syscall_chroot(path uintptr) (err uintptr) {
// like close, but must not split stack, for forkx.
//go:nosplit
+//go:linkname syscall_close
func syscall_close(fd int32) int32 {
return int32(sysvicall1(&libc_close, uintptr(fd)))
}
@@ -90,11 +98,13 @@ func syscall_close(fd int32) int32 {
const _F_DUP2FD = 0x9
//go:nosplit
+//go:linkname syscall_dup2
func syscall_dup2(oldfd, newfd uintptr) (val, err uintptr) {
return syscall_fcntl(oldfd, _F_DUP2FD, newfd)
}
//go:nosplit
+//go:linkname syscall_execve
func syscall_execve(path, argv, envp uintptr) (err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_execve)),
@@ -107,11 +117,13 @@ func syscall_execve(path, argv, envp uintptr) (err uintptr) {
// like exit, but must not split stack, for forkx.
//go:nosplit
+//go:linkname syscall_exit
func syscall_exit(code uintptr) {
sysvicall1(&libc_exit, code)
}
//go:nosplit
+//go:linkname syscall_fcntl
func syscall_fcntl(fd, cmd, arg uintptr) (val, err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_fcntl)),
@@ -123,6 +135,7 @@ func syscall_fcntl(fd, cmd, arg uintptr) (val, err uintptr) {
}
//go:nosplit
+//go:linkname syscall_forkx
func syscall_forkx(flags uintptr) (pid uintptr, err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_forkx)),
@@ -133,6 +146,7 @@ func syscall_forkx(flags uintptr) (pid uintptr, err uintptr) {
return call.r1, call.err
}
+//go:linkname syscall_gethostname
func syscall_gethostname() (name string, err uintptr) {
cname := new([_MAXHOSTNAMELEN]byte)
var args = [2]uintptr{uintptr(unsafe.Pointer(&cname[0])), _MAXHOSTNAMELEN}
@@ -152,6 +166,7 @@ func syscall_gethostname() (name string, err uintptr) {
}
//go:nosplit
+//go:linkname syscall_getpid
func syscall_getpid() (pid, err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_getpid)),
@@ -163,6 +178,7 @@ func syscall_getpid() (pid, err uintptr) {
}
//go:nosplit
+//go:linkname syscall_ioctl
func syscall_ioctl(fd, req, arg uintptr) (err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_ioctl)),
@@ -173,6 +189,7 @@ func syscall_ioctl(fd, req, arg uintptr) (err uintptr) {
return call.err
}
+//go:linkname syscall_pipe
func syscall_pipe() (r, w, err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&pipe1x)),
@@ -187,17 +204,22 @@ func syscall_pipe() (r, w, err uintptr) {
// This is syscall.RawSyscall, it exists to satisfy some build dependency,
// but it doesn't work.
+//
+//go:linkname syscall_rawsyscall
func syscall_rawsyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
panic("RawSyscall not available on Solaris")
}
// This is syscall.RawSyscall6, it exists to avoid a linker error because
// syscall.RawSyscall6 is already declared. See golang.org/issue/24357
+//
+//go:linkname syscall_rawsyscall6
func syscall_rawsyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
panic("RawSyscall6 not available on Solaris")
}
//go:nosplit
+//go:linkname syscall_setgid
func syscall_setgid(gid uintptr) (err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_setgid)),
@@ -209,6 +231,7 @@ func syscall_setgid(gid uintptr) (err uintptr) {
}
//go:nosplit
+//go:linkname syscall_setgroups
func syscall_setgroups(ngid, gid uintptr) (err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_setgroups)),
@@ -220,6 +243,7 @@ func syscall_setgroups(ngid, gid uintptr) (err uintptr) {
}
//go:nosplit
+//go:linkname syscall_setsid
func syscall_setsid() (pid, err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_setsid)),
@@ -231,6 +255,7 @@ func syscall_setsid() (pid, err uintptr) {
}
//go:nosplit
+//go:linkname syscall_setuid
func syscall_setuid(uid uintptr) (err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_setuid)),
@@ -242,6 +267,7 @@ func syscall_setuid(uid uintptr) (err uintptr) {
}
//go:nosplit
+//go:linkname syscall_setpgid
func syscall_setpgid(pid, pgid uintptr) (err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_setpgid)),
@@ -252,6 +278,7 @@ func syscall_setpgid(pid, pgid uintptr) (err uintptr) {
return call.err
}
+//go:linkname syscall_syscall
func syscall_syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_syscall)),
@@ -264,6 +291,7 @@ func syscall_syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
return call.r1, call.r2, call.err
}
+//go:linkname syscall_wait4
func syscall_wait4(pid uintptr, wstatus *uint32, options uintptr, rusage unsafe.Pointer) (wpid int, err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_wait4)),
@@ -277,6 +305,7 @@ func syscall_wait4(pid uintptr, wstatus *uint32, options uintptr, rusage unsafe.
}
//go:nosplit
+//go:linkname syscall_write
func syscall_write(fd, buf, nbyte uintptr) (n, err uintptr) {
call := libcall{
fn: uintptr(unsafe.Pointer(&libc_write)),
diff --git a/src/runtime/syscall_windows.go b/src/runtime/syscall_windows.go
index 36ad7511af..722a73d108 100644
--- a/src/runtime/syscall_windows.go
+++ b/src/runtime/syscall_windows.go
@@ -112,7 +112,6 @@ const _LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800
//go:nosplit
func syscall_loadsystemlibrary(filename *uint16, absoluteFilepath *uint16) (handle, err uintptr) {
lockOSThread()
- defer unlockOSThread()
c := &getg().m.syscall
if useLoadLibraryEx {
@@ -135,6 +134,7 @@ func syscall_loadsystemlibrary(filename *uint16, absoluteFilepath *uint16) (hand
if handle == 0 {
err = c.err
}
+ unlockOSThread() // not defer'd after the lockOSThread above to save stack frame size.
return
}
diff --git a/src/runtime/tls_arm.s b/src/runtime/tls_arm.s
index 9b8855e170..350089abc6 100644
--- a/src/runtime/tls_arm.s
+++ b/src/runtime/tls_arm.s
@@ -88,7 +88,7 @@ TEXT runtime·_initcgo(SB),NOSPLIT,$4
#ifdef TLSG_IS_VARIABLE
MOVW $runtime·tls_g(SB), R2 // arg 2: &tls_g
#else
- MOVW $0, R2 // arg 2: not used when using platform tls
+ MOVW $0, R2 // arg 2: not used when using platform tls
#endif
MOVW $setg_gcc<>(SB), R1 // arg 1: setg
MOVW g, R0 // arg 0: G
diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go
index 0bb7fc2831..ef48c9fa1f 100644
--- a/src/runtime/traceback.go
+++ b/src/runtime/traceback.go
@@ -119,6 +119,8 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
}
level, _, _ := gotraceback()
+ var ctxt *funcval // Context pointer for unstarted goroutines. See issue #25897.
+
if pc0 == ^uintptr(0) && sp0 == ^uintptr(0) { // Signal to fetch saved values from gp.
if gp.syscallsp != 0 {
pc0 = gp.syscallpc
@@ -132,6 +134,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
if usesLR {
lr0 = gp.sched.lr
}
+ ctxt = (*funcval)(gp.sched.ctxt)
}
}
@@ -145,11 +148,6 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
waspanic := false
cgoCtxt := gp.cgoCtxt
printing := pcbuf == nil && callback == nil
- _defer := gp._defer
-
- for _defer != nil && _defer.sp == _NoArgs {
- _defer = _defer.link
- }
// If the PC is zero, it's likely a nil function call.
// Start in the caller's frame.
@@ -300,9 +298,10 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
var ok bool
frame.arglen, frame.argmap, ok = getArgInfoFast(f, callback != nil)
if !ok {
- frame.arglen, frame.argmap = getArgInfo(&frame, f, callback != nil, nil)
+ frame.arglen, frame.argmap = getArgInfo(&frame, f, callback != nil, ctxt)
}
}
+ ctxt = nil // ctxt is only needed to get arg maps for the topmost frame
// Determine frame's 'continuation PC', where it can continue.
// Normally this is the return address on the stack, but if sigpanic
@@ -315,15 +314,14 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
// In the latter case, use a deferreturn call site as the continuation pc.
frame.continpc = frame.pc
if waspanic {
- // We match up defers with frames using the SP.
- // However, if the function has an empty stack
- // frame, then it's possible (on LR machines)
- // for multiple call frames to have the same
- // SP. But, since a function with no frame
- // can't push a defer, the defer can't belong
- // to that frame.
- if _defer != nil && _defer.sp == frame.sp && frame.sp != frame.fp {
+ if frame.fn.deferreturn != 0 {
frame.continpc = frame.fn.entry + uintptr(frame.fn.deferreturn) + 1
+ // Note: this may perhaps keep return variables alive longer than
+ // strictly necessary, as we are using "function has a defer statement"
+ // as a proxy for "function actually deferred something". It seems
+ // to be a minor drawback. (We used to actually look through the
+ // gp._defer for a defer corresponding to this function, but that
+ // is hard to do with defer records on the stack during a stack copy.)
// Note: the +1 is to offset the -1 that
// stack.go:getStackMap does to back up a return
// address make sure the pc is in the CALL instruction.
@@ -332,11 +330,6 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
}
}
- // Unwind our local defer stack past this frame.
- for _defer != nil && ((_defer.sp == frame.sp && frame.sp != frame.fp) || _defer.sp == _NoArgs) {
- _defer = _defer.link
- }
-
if callback != nil {
if !callback((*stkframe)(noescape(unsafe.Pointer(&frame))), v) {
return n
@@ -506,13 +499,6 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
n = nprint
}
- // If callback != nil, we're being called to gather stack information during
- // garbage collection or stack growth. In that context, require that we used
- // up the entire defer stack. If not, then there is a bug somewhere and the
- // garbage collection or stack growth may not have seen the correct picture
- // of the stack. Crash now instead of silently executing the garbage collection
- // or stack copy incorrectly and setting up for a mysterious crash later.
- //
// Note that panic != nil is okay here: there can be leftover panics,
// because the defers on the panic stack do not nest in frame order as
// they do on the defer stack. If you have:
@@ -553,16 +539,6 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
// At other times, such as when gathering a stack for a profiling signal
// or when printing a traceback during a crash, everything may not be
// stopped nicely, and the stack walk may not be able to complete.
- // It's okay in those situations not to use up the entire defer stack:
- // incomplete information then is still better than nothing.
- if callback != nil && n < max && _defer != nil {
- print("runtime: g", gp.goid, ": leftover defer sp=", hex(_defer.sp), " pc=", hex(_defer.pc), "\n")
- for _defer = gp._defer; _defer != nil; _defer = _defer.link {
- print("\tdefer ", _defer, " sp=", hex(_defer.sp), " pc=", hex(_defer.pc), "\n")
- }
- throw("traceback has leftover defers")
- }
-
if callback != nil && n < max && frame.sp != gp.stktopsp {
print("runtime: g", gp.goid, ": frame.sp=", hex(frame.sp), " top=", hex(gp.stktopsp), "\n")
print("\tstack=[", hex(gp.stack.lo), "-", hex(gp.stack.hi), "] n=", n, " max=", max, "\n")
@@ -593,10 +569,10 @@ func getArgInfoFast(f funcInfo, needArgMap bool) (arglen uintptr, argmap *bitvec
// with call frame frame.
//
// This is used for both actual calls with active stack frames and for
-// deferred calls that are not yet executing. If this is an actual
+// deferred calls or goroutines that are not yet executing. If this is an actual
// call, ctxt must be nil (getArgInfo will retrieve what it needs from
-// the active stack frame). If this is a deferred call, ctxt must be
-// the function object that was deferred.
+// the active stack frame). If this is a deferred call or unstarted goroutine,
+// ctxt must be the function object that was deferred or go'd.
func getArgInfo(frame *stkframe, f funcInfo, needArgMap bool, ctxt *funcval) (arglen uintptr, argmap *bitvector) {
arglen = uintptr(f.args)
if needArgMap && f.args == _ArgsSizeUnknown {
@@ -609,8 +585,8 @@ func getArgInfo(frame *stkframe, f funcInfo, needArgMap bool, ctxt *funcval) (ar
var retValid bool
if ctxt != nil {
// This is not an actual call, but a
- // deferred call. The function value
- // is itself the *reflect.methodValue.
+ // deferred call or an unstarted goroutine.
+ // The function value is itself the *reflect.methodValue.
mv = (*reflectMethodValue)(unsafe.Pointer(ctxt))
} else {
// This is a real call that took the
diff --git a/src/runtime/vdso_linux_test.go b/src/runtime/vdso_linux_test.go
deleted file mode 100644
index ad083c61b4..0000000000
--- a/src/runtime/vdso_linux_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2017 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.
-
-// +build linux
-// +build 386 amd64 arm arm64 ppc64 ppc64le
-
-package runtime_test
-
-import (
- "testing"
- "time"
- _ "unsafe"
-)
-
-// These tests are a little risky because they overwrite the vdsoClockgettimeSym value.
-// It's normally initialized at startup and remains unchanged after that.
-
-//go:linkname vdsoClockgettimeSym runtime.vdsoClockgettimeSym
-var vdsoClockgettimeSym uintptr
-
-func TestClockVDSOAndFallbackPaths(t *testing.T) {
- // Check that we can call walltime() and nanotime() with and without their (1st) fast-paths.
- // This just checks that fast and fallback paths can be called, rather than testing their
- // results.
- //
- // Call them indirectly via time.Now(), so we don't need auxiliary .s files to allow us to
- // use go:linkname to refer to the functions directly.
-
- save := vdsoClockgettimeSym
- if save == 0 {
- t.Log("vdsoClockgettime symbol not found; fallback path will be used by default")
- }
-
- // Call with fast-path enabled (if vDSO symbol found at startup)
- time.Now()
-
- // Call with fast-path disabled
- vdsoClockgettimeSym = 0
- time.Now()
- vdsoClockgettimeSym = save
-}
-
-func BenchmarkClockVDSOAndFallbackPaths(b *testing.B) {
- run := func(b *testing.B) {
- for i := 0; i < b.N; i++ {
- // Call via time.Now() - see comment in test above.
- time.Now()
- }
- }
-
- save := vdsoClockgettimeSym
- b.Run("vDSO", run)
- vdsoClockgettimeSym = 0
- b.Run("Fallback", run)
- vdsoClockgettimeSym = save
-}
-
-func BenchmarkTimeNow(b *testing.B) {
- for i := 0; i < b.N; i++ {
- time.Now()
- }
-}
diff --git a/src/strconv/atof.go b/src/strconv/atof.go
index 504b9613fb..0903fa155a 100644
--- a/src/strconv/atof.go
+++ b/src/strconv/atof.go
@@ -654,6 +654,9 @@ func atof64(s string) (f float64, err error) {
// If s is syntactically well-formed but is more than 1/2 ULP
// away from the largest floating point number of the given size,
// ParseFloat returns f = ±Inf, err.Err = ErrRange.
+//
+// ParseFloat recognizes the strings "NaN", "+Inf", and "-Inf" as their
+// respective special floating point values. It ignores case when matching.
func ParseFloat(s string, bitSize int) (float64, error) {
if !underscoreOK(s) {
return 0, syntaxError(fnParseFloat, s)
diff --git a/src/strconv/example_test.go b/src/strconv/example_test.go
index 46cfd432fb..50f6b20fee 100644
--- a/src/strconv/example_test.go
+++ b/src/strconv/example_test.go
@@ -232,7 +232,7 @@ func ExampleParseFloat() {
if s, err := strconv.ParseFloat("inf", 32); err == nil {
fmt.Printf("%T, %v\n", s, s)
}
- if s, err := strconv.ParseFloat("Inf", 32); err == nil {
+ if s, err := strconv.ParseFloat("+Inf", 32); err == nil {
fmt.Printf("%T, %v\n", s, s)
}
if s, err := strconv.ParseFloat("-Inf", 32); err == nil {
diff --git a/src/strings/example_test.go b/src/strings/example_test.go
index e31054a4e0..4f3a1ce8c6 100644
--- a/src/strings/example_test.go
+++ b/src/strings/example_test.go
@@ -47,12 +47,16 @@ func ExampleContains() {
func ExampleContainsAny() {
fmt.Println(strings.ContainsAny("team", "i"))
- fmt.Println(strings.ContainsAny("failure", "u & i"))
+ fmt.Println(strings.ContainsAny("fail", "ui"))
+ fmt.Println(strings.ContainsAny("ure", "ui"))
+ fmt.Println(strings.ContainsAny("failure", "ui"))
fmt.Println(strings.ContainsAny("foo", ""))
fmt.Println(strings.ContainsAny("", ""))
// Output:
// false
// true
+ // true
+ // true
// false
// false
}
diff --git a/src/syscall/dll_windows.go b/src/syscall/dll_windows.go
index 34925f74a4..75bc372c3d 100644
--- a/src/syscall/dll_windows.go
+++ b/src/syscall/dll_windows.go
@@ -270,7 +270,7 @@ func NewLazyDLL(name string) *LazyDLL {
}
// A LazyProc implements access to a procedure inside a LazyDLL.
-// It delays the lookup until the Addr method is called.
+// It delays the lookup until the Addr, Call, or Find method is called.
type LazyProc struct {
mu sync.Mutex
Name string
@@ -321,13 +321,8 @@ func (p *LazyProc) Addr() uintptr {
//go:uintptrescapes
-// Call executes procedure p with arguments a. It will panic, if more than 15 arguments
-// are supplied.
-//
-// The returned error is always non-nil, constructed from the result of GetLastError.
-// Callers must inspect the primary return value to decide whether an error occurred
-// (according to the semantics of the specific function being called) before consulting
-// the error. The error will be guaranteed to contain syscall.Errno.
+// Call executes procedure p with arguments a. See the documentation of
+// Proc.Call for more information.
func (p *LazyProc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
p.mustFind()
return p.proc.Call(a...)
diff --git a/src/syscall/exec_bsd.go b/src/syscall/exec_bsd.go
index 30b88eba7a..632b711ce8 100644
--- a/src/syscall/exec_bsd.go
+++ b/src/syscall/exec_bsd.go
@@ -162,6 +162,22 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
}
+ // Detach fd 0 from tty
+ if sys.Noctty {
+ _, _, err1 = RawSyscall(SYS_IOCTL, 0, uintptr(TIOCNOTTY), 0)
+ if err1 != 0 {
+ goto childerror
+ }
+ }
+
+ // Set the controlling TTY to Ctty
+ if sys.Setctty {
+ _, _, err1 = RawSyscall(SYS_IOCTL, uintptr(sys.Ctty), uintptr(TIOCSCTTY), 0)
+ if err1 != 0 {
+ goto childerror
+ }
+ }
+
// Pass 1: look for fd[i] < i and move those up above len(fd)
// so that pass 2 won't stomp on an fd it needs later.
if pipe < nextfd {
@@ -219,22 +235,6 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
RawSyscall(SYS_CLOSE, uintptr(i), 0, 0)
}
- // Detach fd 0 from tty
- if sys.Noctty {
- _, _, err1 = RawSyscall(SYS_IOCTL, 0, uintptr(TIOCNOTTY), 0)
- if err1 != 0 {
- goto childerror
- }
- }
-
- // Set the controlling TTY to Ctty
- if sys.Setctty {
- _, _, err1 = RawSyscall(SYS_IOCTL, uintptr(sys.Ctty), uintptr(TIOCSCTTY), 0)
- if err1 != 0 {
- goto childerror
- }
- }
-
// Time to exec.
_, _, err1 = RawSyscall(SYS_EXECVE,
uintptr(unsafe.Pointer(argv0)),
diff --git a/src/syscall/exec_darwin.go b/src/syscall/exec_darwin.go
index f860f4628e..9f7bf67d2c 100644
--- a/src/syscall/exec_darwin.go
+++ b/src/syscall/exec_darwin.go
@@ -80,8 +80,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
// Enable tracing if requested.
if sys.Ptrace {
- _, _, err1 = rawSyscall(funcPC(libc_ptrace_trampoline), uintptr(PTRACE_TRACEME), 0, 0)
- if err1 != 0 {
+ if err := ptrace(PTRACE_TRACEME, 0, 0, 0); err != nil {
+ err1 = err.(Errno)
goto childerror
}
}
@@ -160,6 +160,22 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
}
+ // Detach fd 0 from tty
+ if sys.Noctty {
+ _, _, err1 = rawSyscall(funcPC(libc_ioctl_trampoline), 0, uintptr(TIOCNOTTY), 0)
+ if err1 != 0 {
+ goto childerror
+ }
+ }
+
+ // Set the controlling TTY to Ctty
+ if sys.Setctty {
+ _, _, err1 = rawSyscall(funcPC(libc_ioctl_trampoline), uintptr(sys.Ctty), uintptr(TIOCSCTTY), 0)
+ if err1 != 0 {
+ goto childerror
+ }
+ }
+
// Pass 1: look for fd[i] < i and move those up above len(fd)
// so that pass 2 won't stomp on an fd it needs later.
if pipe < nextfd {
@@ -217,22 +233,6 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
rawSyscall(funcPC(libc_close_trampoline), uintptr(i), 0, 0)
}
- // Detach fd 0 from tty
- if sys.Noctty {
- _, _, err1 = rawSyscall(funcPC(libc_ioctl_trampoline), 0, uintptr(TIOCNOTTY), 0)
- if err1 != 0 {
- goto childerror
- }
- }
-
- // Set the controlling TTY to Ctty
- if sys.Setctty {
- _, _, err1 = rawSyscall(funcPC(libc_ioctl_trampoline), uintptr(sys.Ctty), uintptr(TIOCSCTTY), 0)
- if err1 != 0 {
- goto childerror
- }
- }
-
// Time to exec.
_, _, err1 = rawSyscall(funcPC(libc_execve_trampoline),
uintptr(unsafe.Pointer(argv0)),
diff --git a/src/syscall/exec_libc.go b/src/syscall/exec_libc.go
index 0133139000..11cd2bb9f3 100644
--- a/src/syscall/exec_libc.go
+++ b/src/syscall/exec_libc.go
@@ -180,6 +180,27 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
}
+ // Detach fd 0 from tty
+ if sys.Noctty {
+ err1 = ioctl(0, uintptr(TIOCNOTTY), 0)
+ if err1 != 0 {
+ goto childerror
+ }
+ }
+
+ // Set the controlling TTY to Ctty
+ if sys.Setctty {
+ // On AIX, TIOCSCTTY is undefined
+ if TIOCSCTTY == 0 {
+ err1 = ENOSYS
+ goto childerror
+ }
+ err1 = ioctl(uintptr(sys.Ctty), uintptr(TIOCSCTTY), 0)
+ if err1 != 0 {
+ goto childerror
+ }
+ }
+
// Pass 1: look for fd[i] < i and move those up above len(fd)
// so that pass 2 won't stomp on an fd it needs later.
if pipe < nextfd {
@@ -240,27 +261,6 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
close(uintptr(i))
}
- // Detach fd 0 from tty
- if sys.Noctty {
- err1 = ioctl(0, uintptr(TIOCNOTTY), 0)
- if err1 != 0 {
- goto childerror
- }
- }
-
- // Set the controlling TTY to Ctty
- if sys.Setctty {
- // On AIX, TIOCSCTTY is undefined
- if TIOCSCTTY == 0 {
- err1 = ENOSYS
- goto childerror
- }
- err1 = ioctl(uintptr(sys.Ctty), uintptr(TIOCSCTTY), 0)
- if err1 != 0 {
- goto childerror
- }
- }
-
// Time to exec.
err1 = execve(
uintptr(unsafe.Pointer(argv0)),
diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go
index a2242b2057..f62f2c633e 100644
--- a/src/syscall/exec_linux.go
+++ b/src/syscall/exec_linux.go
@@ -431,6 +431,22 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att
}
}
+ // Detach fd 0 from tty
+ if sys.Noctty {
+ _, _, err1 = RawSyscall(SYS_IOCTL, 0, uintptr(TIOCNOTTY), 0)
+ if err1 != 0 {
+ goto childerror
+ }
+ }
+
+ // Set the controlling TTY to Ctty
+ if sys.Setctty {
+ _, _, err1 = RawSyscall(SYS_IOCTL, uintptr(sys.Ctty), uintptr(TIOCSCTTY), 1)
+ if err1 != 0 {
+ goto childerror
+ }
+ }
+
// Pass 1: look for fd[i] < i and move those up above len(fd)
// so that pass 2 won't stomp on an fd it needs later.
if pipe < nextfd {
@@ -488,22 +504,6 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att
RawSyscall(SYS_CLOSE, uintptr(i), 0, 0)
}
- // Detach fd 0 from tty
- if sys.Noctty {
- _, _, err1 = RawSyscall(SYS_IOCTL, 0, uintptr(TIOCNOTTY), 0)
- if err1 != 0 {
- goto childerror
- }
- }
-
- // Set the controlling TTY to Ctty
- if sys.Setctty {
- _, _, err1 = RawSyscall(SYS_IOCTL, uintptr(sys.Ctty), uintptr(TIOCSCTTY), 1)
- if err1 != 0 {
- goto childerror
- }
- }
-
// Enable tracing if requested.
// Do this right before exec so that we don't unnecessarily trace the runtime
// setting up after the fork. See issue #21428.
diff --git a/src/syscall/exec_linux_test.go b/src/syscall/exec_linux_test.go
index 09ced3b0e0..cc2140f811 100644
--- a/src/syscall/exec_linux_test.go
+++ b/src/syscall/exec_linux_test.go
@@ -42,6 +42,15 @@ func skipInContainer(t *testing.T) {
}
}
+func skipUnprivilegedUserClone(t *testing.T) {
+ // Skip the test if the sysctl that prevents unprivileged user
+ // from creating user namespaces is enabled.
+ data, errRead := ioutil.ReadFile("/proc/sys/kernel/unprivileged_userns_clone")
+ if errRead != nil || len(data) < 1 || data[0] == '0' {
+ t.Skip("kernel prohibits user namespace in unprivileged process")
+ }
+}
+
// Check if we are in a chroot by checking if the inode of / is
// different from 2 (there is no better test available to non-root on
// linux).
@@ -72,10 +81,7 @@ func checkUserNS(t *testing.T) {
}
// On some systems, there is a sysctl setting.
if os.Getuid() != 0 {
- data, errRead := ioutil.ReadFile("/proc/sys/kernel/unprivileged_userns_clone")
- if errRead == nil && data[0] == '0' {
- t.Skip("kernel prohibits user namespace in unprivileged process")
- }
+ skipUnprivilegedUserClone(t)
}
// On Centos 7 make sure they set the kernel parameter user_namespace=1
// See issue 16283 and 20796.
@@ -582,12 +588,7 @@ func testAmbientCaps(t *testing.T, userns bool) {
t.Skip("skipping test on Kubernetes-based builders; see Issue 12815")
}
- // Skip the test if the sysctl that prevents unprivileged user
- // from creating user namespaces is enabled.
- data, errRead := ioutil.ReadFile("/proc/sys/kernel/unprivileged_userns_clone")
- if errRead == nil && data[0] == '0' {
- t.Skip("kernel prohibits user namespace in unprivileged process")
- }
+ skipUnprivilegedUserClone(t)
// skip on android, due to lack of lookup support
if runtime.GOOS == "android" {
diff --git a/src/syscall/fs_js.go b/src/syscall/fs_js.go
index 3c2dac3579..1b835c5048 100644
--- a/src/syscall/fs_js.go
+++ b/src/syscall/fs_js.go
@@ -19,6 +19,7 @@ func now() (sec int64, nsec int32)
var jsProcess = js.Global().Get("process")
var jsFS = js.Global().Get("fs")
var constants = jsFS.Get("constants")
+
var uint8Array = js.Global().Get("Uint8Array")
var (
@@ -384,10 +385,7 @@ func Read(fd int, b []byte) (int, error) {
if err != nil {
return 0, err
}
-
- a := js.TypedArrayOf(b)
- a.Call("set", buf)
- a.Release()
+ js.CopyBytesToGo(b, buf)
n2 := n.Int()
f.pos += int64(n2)
@@ -406,11 +404,8 @@ func Write(fd int, b []byte) (int, error) {
return n, err
}
- a := js.TypedArrayOf(b)
buf := uint8Array.New(len(b))
- buf.Call("set", a)
- a.Release()
-
+ js.CopyBytesToJS(buf, b)
n, err := fsCall("write", fd, buf, 0, len(b), nil)
if err != nil {
return 0, err
@@ -426,20 +421,13 @@ func Pread(fd int, b []byte, offset int64) (int, error) {
if err != nil {
return 0, err
}
-
- a := js.TypedArrayOf(b)
- a.Call("set", buf)
- a.Release()
-
+ js.CopyBytesToGo(b, buf)
return n.Int(), nil
}
func Pwrite(fd int, b []byte, offset int64) (int, error) {
- a := js.TypedArrayOf(b)
buf := uint8Array.New(len(b))
- buf.Call("set", a)
- a.Release()
-
+ js.CopyBytesToJS(buf, b)
n, err := fsCall("write", fd, buf, 0, len(b), offset)
if err != nil {
return 0, err
diff --git a/src/syscall/js/js.go b/src/syscall/js/js.go
index 0acc7da9bf..7300d2c769 100644
--- a/src/syscall/js/js.go
+++ b/src/syscall/js/js.go
@@ -79,8 +79,7 @@ var (
valueTrue = predefValue(3)
valueFalse = predefValue(4)
valueGlobal = predefValue(5)
- memory = predefValue(6) // WebAssembly linear memory
- jsGo = predefValue(7) // instance of the Go class in JavaScript
+ jsGo = predefValue(6) // instance of the Go class in JavaScript
objectConstructor = valueGlobal.Get("Object")
arrayConstructor = valueGlobal.Get("Array")
@@ -106,7 +105,6 @@ func Global() Value {
// | Go | JavaScript |
// | ---------------------- | ---------------------- |
// | js.Value | [its value] |
-// | js.TypedArray | typed array |
// | js.Func | function |
// | nil | null |
// | bool | boolean |
@@ -478,3 +476,29 @@ type ValueError struct {
func (e *ValueError) Error() string {
return "syscall/js: call of " + e.Method + " on " + e.Type.String()
}
+
+// CopyBytesToGo copies bytes from the Uint8Array src to dst.
+// It returns the number of bytes copied, which will be the minimum of the lengths of src and dst.
+// CopyBytesToGo panics if src is not an Uint8Array.
+func CopyBytesToGo(dst []byte, src Value) int {
+ n, ok := copyBytesToGo(dst, src.ref)
+ if !ok {
+ panic("syscall/js: CopyBytesToGo: expected src to be an Uint8Array")
+ }
+ return n
+}
+
+func copyBytesToGo(dst []byte, src ref) (int, bool)
+
+// CopyBytesToJS copies bytes from src to the Uint8Array dst.
+// It returns the number of bytes copied, which will be the minimum of the lengths of src and dst.
+// CopyBytesToJS panics if dst is not an Uint8Array.
+func CopyBytesToJS(dst Value, src []byte) int {
+ n, ok := copyBytesToJS(dst.ref, src)
+ if !ok {
+ panic("syscall/js: CopyBytesToJS: expected dst to be an Uint8Array")
+ }
+ return n
+}
+
+func copyBytesToJS(dst ref, src []byte) (int, bool)
diff --git a/src/syscall/js/js_js.s b/src/syscall/js/js_js.s
index 0ec164d5cb..5f29468237 100644
--- a/src/syscall/js/js_js.s
+++ b/src/syscall/js/js_js.s
@@ -51,3 +51,11 @@ TEXT ·valueLoadString(SB), NOSPLIT, $0
TEXT ·valueInstanceOf(SB), NOSPLIT, $0
CallImport
RET
+
+TEXT ·copyBytesToGo(SB), NOSPLIT, $0
+ CallImport
+ RET
+
+TEXT ·copyBytesToJS(SB), NOSPLIT, $0
+ CallImport
+ RET
diff --git a/src/syscall/js/js_test.go b/src/syscall/js/js_test.go
index 20ccac7779..7a1e346f55 100644
--- a/src/syscall/js/js_test.go
+++ b/src/syscall/js/js_test.go
@@ -167,28 +167,6 @@ func TestFrozenObject(t *testing.T) {
}
}
-func TestTypedArrayOf(t *testing.T) {
- testTypedArrayOf(t, "[]int8", []int8{0, -42, 0}, -42)
- testTypedArrayOf(t, "[]int16", []int16{0, -42, 0}, -42)
- testTypedArrayOf(t, "[]int32", []int32{0, -42, 0}, -42)
- testTypedArrayOf(t, "[]uint8", []uint8{0, 42, 0}, 42)
- testTypedArrayOf(t, "[]uint16", []uint16{0, 42, 0}, 42)
- testTypedArrayOf(t, "[]uint32", []uint32{0, 42, 0}, 42)
- testTypedArrayOf(t, "[]float32", []float32{0, -42.5, 0}, -42.5)
- testTypedArrayOf(t, "[]float64", []float64{0, -42.5, 0}, -42.5)
-}
-
-func testTypedArrayOf(t *testing.T, name string, slice interface{}, want float64) {
- t.Run(name, func(t *testing.T) {
- a := js.TypedArrayOf(slice)
- got := a.Index(1).Float()
- a.Release()
- if got != want {
- t.Errorf("got %#v, want %#v", got, want)
- }
- })
-}
-
func TestNaN(t *testing.T) {
want := js.ValueOf(math.NaN())
got := dummys.Get("NaN")
@@ -454,3 +432,55 @@ func expectPanic(t *testing.T, fn func()) {
}()
fn()
}
+
+var copyTests = []struct {
+ srcLen int
+ dstLen int
+ copyLen int
+}{
+ {5, 3, 3},
+ {3, 5, 3},
+ {0, 0, 0},
+}
+
+func TestCopyBytesToGo(t *testing.T) {
+ for _, tt := range copyTests {
+ t.Run(fmt.Sprintf("%d-to-%d", tt.srcLen, tt.dstLen), func(t *testing.T) {
+ src := js.Global().Get("Uint8Array").New(tt.srcLen)
+ if tt.srcLen >= 2 {
+ src.SetIndex(1, 42)
+ }
+ dst := make([]byte, tt.dstLen)
+
+ if got, want := js.CopyBytesToGo(dst, src), tt.copyLen; got != want {
+ t.Errorf("copied %d, want %d", got, want)
+ }
+ if tt.dstLen >= 2 {
+ if got, want := int(dst[1]), 42; got != want {
+ t.Errorf("got %d, want %d", got, want)
+ }
+ }
+ })
+ }
+}
+
+func TestCopyBytesToJS(t *testing.T) {
+ for _, tt := range copyTests {
+ t.Run(fmt.Sprintf("%d-to-%d", tt.srcLen, tt.dstLen), func(t *testing.T) {
+ src := make([]byte, tt.srcLen)
+ if tt.srcLen >= 2 {
+ src[1] = 42
+ }
+ dst := js.Global().Get("Uint8Array").New(tt.dstLen)
+
+ if got, want := js.CopyBytesToJS(dst, src), tt.copyLen; got != want {
+ t.Errorf("copied %d, want %d", got, want)
+ }
+ if tt.dstLen >= 2 {
+ if got, want := dst.Index(1).Int(), 42; got != want {
+ t.Errorf("got %d, want %d", got, want)
+ }
+ }
+ })
+ }
+}
diff --git a/src/syscall/js/typedarray.go b/src/syscall/js/typedarray.go
deleted file mode 100644
index 04c0057106..0000000000
--- a/src/syscall/js/typedarray.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2018 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.
-
-// +build js,wasm
-
-package js
-
-import (
- "sync"
- "unsafe"
-)
-
-var (
- int8Array = Global().Get("Int8Array")
- int16Array = Global().Get("Int16Array")
- int32Array = Global().Get("Int32Array")
- uint8Array = Global().Get("Uint8Array")
- uint16Array = Global().Get("Uint16Array")
- uint32Array = Global().Get("Uint32Array")
- float32Array = Global().Get("Float32Array")
- float64Array = Global().Get("Float64Array")
-)
-
-var _ Wrapper = TypedArray{} // TypedArray must implement Wrapper
-
-// TypedArray represents a JavaScript typed array.
-//
-// BUG(neelance): The typed array currently becomes inaccessible when Go requests more memory
-// from the WebAssembly host. It is recommended to only use the typed array synchronously
-// without keeping a long-lived reference. You can also check if the length property is zero
-// to detect this detached state of the typed array.
-type TypedArray struct {
- Value
-}
-
-// Release frees up resources allocated for the typed array.
-// The typed array and its buffer must not be accessed after calling Release.
-func (a TypedArray) Release() {
- openTypedArraysMutex.Lock()
- delete(openTypedArrays, a)
- openTypedArraysMutex.Unlock()
-}
-
-var (
- openTypedArraysMutex sync.Mutex
- openTypedArrays = make(map[TypedArray]interface{})
-)
-
-// TypedArrayOf returns a JavaScript typed array backed by the slice's underlying array.
-//
-// The supported types are []int8, []int16, []int32, []uint8, []uint16, []uint32, []float32 and []float64.
-// Passing an unsupported value causes a panic.
-//
-// TypedArray.Release must be called to free up resources when the typed array will not be used any more.
-func TypedArrayOf(slice interface{}) TypedArray {
- a := TypedArray{typedArrayOf(slice)}
- openTypedArraysMutex.Lock()
- openTypedArrays[a] = slice
- openTypedArraysMutex.Unlock()
- return a
-}
-
-func typedArrayOf(slice interface{}) Value {
- switch slice := slice.(type) {
- case []int8:
- if len(slice) == 0 {
- return int8Array.New(memory.Get("buffer"), 0, 0)
- }
- return int8Array.New(memory.Get("buffer"), unsafe.Pointer(&slice[0]), len(slice))
- case []int16:
- if len(slice) == 0 {
- return int16Array.New(memory.Get("buffer"), 0, 0)
- }
- return int16Array.New(memory.Get("buffer"), unsafe.Pointer(&slice[0]), len(slice))
- case []int32:
- if len(slice) == 0 {
- return int32Array.New(memory.Get("buffer"), 0, 0)
- }
- return int32Array.New(memory.Get("buffer"), unsafe.Pointer(&slice[0]), len(slice))
- case []uint8:
- if len(slice) == 0 {
- return uint8Array.New(memory.Get("buffer"), 0, 0)
- }
- return uint8Array.New(memory.Get("buffer"), unsafe.Pointer(&slice[0]), len(slice))
- case []uint16:
- if len(slice) == 0 {
- return uint16Array.New(memory.Get("buffer"), 0, 0)
- }
- return uint16Array.New(memory.Get("buffer"), unsafe.Pointer(&slice[0]), len(slice))
- case []uint32:
- if len(slice) == 0 {
- return uint32Array.New(memory.Get("buffer"), 0, 0)
- }
- return uint32Array.New(memory.Get("buffer"), unsafe.Pointer(&slice[0]), len(slice))
- case []float32:
- if len(slice) == 0 {
- return float32Array.New(memory.Get("buffer"), 0, 0)
- }
- return float32Array.New(memory.Get("buffer"), unsafe.Pointer(&slice[0]), len(slice))
- case []float64:
- if len(slice) == 0 {
- return float64Array.New(memory.Get("buffer"), 0, 0)
- }
- return float64Array.New(memory.Get("buffer"), unsafe.Pointer(&slice[0]), len(slice))
- default:
- panic("TypedArrayOf: not a supported slice")
- }
-}
diff --git a/src/syscall/mksyscall.pl b/src/syscall/mksyscall.pl
index 667ca54c02..2a82145a62 100755
--- a/src/syscall/mksyscall.pl
+++ b/src/syscall/mksyscall.pl
@@ -130,6 +130,12 @@ while(<>) {
# without reading the header.
$text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
+ if ($darwin && $func eq "ptrace") {
+ # The ptrace function is called from forkAndExecInChild where stack
+ # growth is forbidden.
+ $text .= "//go:nosplit\n"
+ }
+
# Go function header.
my $out_decl = @out ? sprintf(" (%s)", join(', ', @out)) : "";
$text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out_decl;
diff --git a/src/syscall/syscall_darwin.go b/src/syscall/syscall_darwin.go
index e7a0967d36..7d795ee4d3 100644
--- a/src/syscall/syscall_darwin.go
+++ b/src/syscall/syscall_darwin.go
@@ -87,7 +87,6 @@ func direntNamlen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
}
-//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
diff --git a/src/syscall/syscall_darwin_386.go b/src/syscall/syscall_darwin_386.go
index a8926c022a..8c5b82da55 100644
--- a/src/syscall/syscall_darwin_386.go
+++ b/src/syscall/syscall_darwin_386.go
@@ -21,6 +21,7 @@ func setTimeval(sec, usec int64) Timeval {
//sys Stat(path string, stat *Stat_t) (err error) = SYS_stat64
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_statfs64
//sys fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_fstatat64
+//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
func SetKevent(k *Kevent_t, fd, mode, flags int) {
k.Ident = uint32(fd)
diff --git a/src/syscall/syscall_darwin_amd64.go b/src/syscall/syscall_darwin_amd64.go
index bc3acf8d75..23a4e5f996 100644
--- a/src/syscall/syscall_darwin_amd64.go
+++ b/src/syscall/syscall_darwin_amd64.go
@@ -21,6 +21,7 @@ func setTimeval(sec, usec int64) Timeval {
//sys Stat(path string, stat *Stat_t) (err error) = SYS_stat64
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_statfs64
//sys fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_fstatat64
+//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
func SetKevent(k *Kevent_t, fd, mode, flags int) {
k.Ident = uint64(fd)
diff --git a/src/syscall/syscall_darwin_arm.go b/src/syscall/syscall_darwin_arm.go
index 19c9827c09..7f39cf4003 100644
--- a/src/syscall/syscall_darwin_arm.go
+++ b/src/syscall/syscall_darwin_arm.go
@@ -22,6 +22,13 @@ func setTimeval(sec, usec int64) Timeval {
//sys Statfs(path string, stat *Statfs_t) (err error)
//sys fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
+// Marked nosplit because it is called from forkAndExecInChild where
+// stack growth is forbidden.
+//go:nosplit
+func ptrace(request int, pid int, addr uintptr, data uintptr) error {
+ return ENOTSUP
+}
+
func SetKevent(k *Kevent_t, fd, mode, flags int) {
k.Ident = uint32(fd)
k.Filter = int16(mode)
diff --git a/src/syscall/syscall_darwin_arm64.go b/src/syscall/syscall_darwin_arm64.go
index 95eb9465b9..bd110f2e7f 100644
--- a/src/syscall/syscall_darwin_arm64.go
+++ b/src/syscall/syscall_darwin_arm64.go
@@ -22,6 +22,13 @@ func setTimeval(sec, usec int64) Timeval {
//sys Statfs(path string, stat *Statfs_t) (err error)
//sys fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
+// Marked nosplit because it is called from forkAndExecInChild where
+// stack growth is forbidden.
+//go:nosplit
+func ptrace(request int, pid int, addr uintptr, data uintptr) error {
+ return ENOTSUP
+}
+
func SetKevent(k *Kevent_t, fd, mode, flags int) {
k.Ident = uint64(fd)
k.Filter = int16(mode)
diff --git a/src/syscall/syscall_freebsd.go b/src/syscall/syscall_freebsd.go
index 87a27b1ff7..eecae8de30 100644
--- a/src/syscall/syscall_freebsd.go
+++ b/src/syscall/syscall_freebsd.go
@@ -267,7 +267,21 @@ func Fstatfs(fd int, st *Statfs_t) (err error) {
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
if supportsABI(_ino64First) {
- return getdirentries_freebsd12(fd, buf, basep)
+ if unsafe.Sizeof(*basep) == 8 {
+ return getdirentries_freebsd12(fd, buf, (*uint64)(unsafe.Pointer(basep)))
+ }
+ // The freebsd12 syscall needs a 64-bit base. On 32-bit machines
+ // we can't just use the basep passed in. See #32498.
+ var base uint64 = uint64(*basep)
+ n, err = getdirentries_freebsd12(fd, buf, &base)
+ *basep = uintptr(base)
+ if base>>32 != 0 {
+ // We can't stuff the base back into a uintptr, so any
+ // future calls would be suspect. Generate an error.
+ // EIO is allowed by getdirentries.
+ err = EIO
+ }
+ return
}
// The old syscall entries are smaller than the new. Use 1/4 of the original
@@ -424,7 +438,7 @@ func convertFromDirents11(buf []byte, old []byte) int {
//sys Fsync(fd int) (err error)
//sys Ftruncate(fd int, length int64) (err error)
//sys getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error)
-//sys getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error) = _SYS_GETDIRENTRIES_FREEBSD12
+//sys getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) = _SYS_GETDIRENTRIES_FREEBSD12
//sys Getdtablesize() (size int)
//sysnb Getegid() (egid int)
//sysnb Geteuid() (uid int)
diff --git a/src/syscall/syscall_ptrace_test.go b/src/syscall/syscall_ptrace_test.go
new file mode 100644
index 0000000000..6b7f54dcfd
--- /dev/null
+++ b/src/syscall/syscall_ptrace_test.go
@@ -0,0 +1,37 @@
+// Copyright 2019 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.
+
+// +build darwin dragonfly freebsd linux netbsd openbsd
+
+package syscall_test
+
+import (
+ "internal/testenv"
+ "os"
+ "os/exec"
+ "syscall"
+ "testing"
+)
+
+func TestExecPtrace(t *testing.T) {
+ testenv.MustHaveExec(t)
+
+ bin, err := exec.LookPath("sh")
+ if err != nil {
+ t.Skipf("skipped because sh is not available")
+ }
+
+ attr := &os.ProcAttr{
+ Sys: &syscall.SysProcAttr{
+ Ptrace: true,
+ },
+ }
+ proc, err := os.StartProcess(bin, []string{bin}, attr)
+ if err == nil {
+ proc.Kill()
+ }
+ if err != nil && !os.IsPermission(err) {
+ t.Fatalf("StartProcess with ptrace enabled failed: %v", err)
+ }
+}
diff --git a/src/syscall/zsyscall_darwin_386.go b/src/syscall/zsyscall_darwin_386.go
index 06a51557e6..2c3b15f5f9 100644
--- a/src/syscall/zsyscall_darwin_386.go
+++ b/src/syscall/zsyscall_darwin_386.go
@@ -350,21 +350,6 @@ func libc_fcntl_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
- _, _, e1 := syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-func libc_ptrace_trampoline()
-
-//go:linkname libc_ptrace libc_ptrace
-//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func pipe(p *[2]int32) (err error) {
_, _, e1 := rawSyscall(funcPC(libc_pipe_trampoline), uintptr(unsafe.Pointer(p)), 0, 0)
if e1 != 0 {
@@ -2080,3 +2065,19 @@ func libc_fstatat64_trampoline()
//go:linkname libc_fstatat64 libc_fstatat64
//go:cgo_import_dynamic libc_fstatat64 fstatat64 "/usr/lib/libSystem.B.dylib"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+//go:nosplit
+func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
+ _, _, e1 := syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+func libc_ptrace_trampoline()
+
+//go:linkname libc_ptrace libc_ptrace
+//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
diff --git a/src/syscall/zsyscall_darwin_386.s b/src/syscall/zsyscall_darwin_386.s
index a50c3ef4df..d84b46229e 100644
--- a/src/syscall/zsyscall_darwin_386.s
+++ b/src/syscall/zsyscall_darwin_386.s
@@ -53,8 +53,6 @@ TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0
JMP libc_futimes(SB)
TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0
JMP libc_fcntl(SB)
-TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
- JMP libc_ptrace(SB)
TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
JMP libc_pipe(SB)
TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0
@@ -251,3 +249,5 @@ TEXT ·libc_statfs64_trampoline(SB),NOSPLIT,$0-0
JMP libc_statfs64(SB)
TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0
JMP libc_fstatat64(SB)
+TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
+ JMP libc_ptrace(SB)
diff --git a/src/syscall/zsyscall_darwin_amd64.go b/src/syscall/zsyscall_darwin_amd64.go
index c2b88fc4c4..83214de2fb 100644
--- a/src/syscall/zsyscall_darwin_amd64.go
+++ b/src/syscall/zsyscall_darwin_amd64.go
@@ -350,21 +350,6 @@ func libc_fcntl_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
- _, _, e1 := syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-func libc_ptrace_trampoline()
-
-//go:linkname libc_ptrace libc_ptrace
-//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func pipe(p *[2]int32) (err error) {
_, _, e1 := rawSyscall(funcPC(libc_pipe_trampoline), uintptr(unsafe.Pointer(p)), 0, 0)
if e1 != 0 {
@@ -2080,3 +2065,19 @@ func libc_fstatat64_trampoline()
//go:linkname libc_fstatat64 libc_fstatat64
//go:cgo_import_dynamic libc_fstatat64 fstatat64 "/usr/lib/libSystem.B.dylib"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+//go:nosplit
+func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
+ _, _, e1 := syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+func libc_ptrace_trampoline()
+
+//go:linkname libc_ptrace libc_ptrace
+//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
diff --git a/src/syscall/zsyscall_darwin_amd64.s b/src/syscall/zsyscall_darwin_amd64.s
index 626cd752db..23ddbe06c0 100644
--- a/src/syscall/zsyscall_darwin_amd64.s
+++ b/src/syscall/zsyscall_darwin_amd64.s
@@ -53,8 +53,6 @@ TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0
JMP libc_futimes(SB)
TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0
JMP libc_fcntl(SB)
-TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
- JMP libc_ptrace(SB)
TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
JMP libc_pipe(SB)
TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0
@@ -251,3 +249,5 @@ TEXT ·libc_statfs64_trampoline(SB),NOSPLIT,$0-0
JMP libc_statfs64(SB)
TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0
JMP libc_fstatat64(SB)
+TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
+ JMP libc_ptrace(SB)
diff --git a/src/syscall/zsyscall_darwin_arm.go b/src/syscall/zsyscall_darwin_arm.go
index a640c7425a..2a643f209f 100644
--- a/src/syscall/zsyscall_darwin_arm.go
+++ b/src/syscall/zsyscall_darwin_arm.go
@@ -350,21 +350,6 @@ func libc_fcntl_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
- _, _, e1 := syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-func libc_ptrace_trampoline()
-
-//go:linkname libc_ptrace libc_ptrace
-//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func pipe(p *[2]int32) (err error) {
_, _, e1 := rawSyscall(funcPC(libc_pipe_trampoline), uintptr(unsafe.Pointer(p)), 0, 0)
if e1 != 0 {
diff --git a/src/syscall/zsyscall_darwin_arm.s b/src/syscall/zsyscall_darwin_arm.s
index 0963413266..c7cd83d83e 100644
--- a/src/syscall/zsyscall_darwin_arm.s
+++ b/src/syscall/zsyscall_darwin_arm.s
@@ -53,8 +53,6 @@ TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0
JMP libc_futimes(SB)
TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0
JMP libc_fcntl(SB)
-TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
- JMP libc_ptrace(SB)
TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
JMP libc_pipe(SB)
TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0
diff --git a/src/syscall/zsyscall_darwin_arm64.go b/src/syscall/zsyscall_darwin_arm64.go
index e6d362d3a4..0b77839869 100644
--- a/src/syscall/zsyscall_darwin_arm64.go
+++ b/src/syscall/zsyscall_darwin_arm64.go
@@ -350,21 +350,6 @@ func libc_fcntl_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
- _, _, e1 := syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-func libc_ptrace_trampoline()
-
-//go:linkname libc_ptrace libc_ptrace
-//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func pipe(p *[2]int32) (err error) {
_, _, e1 := rawSyscall(funcPC(libc_pipe_trampoline), uintptr(unsafe.Pointer(p)), 0, 0)
if e1 != 0 {
diff --git a/src/syscall/zsyscall_darwin_arm64.s b/src/syscall/zsyscall_darwin_arm64.s
index 23ddc8f53c..7b8b3764a8 100644
--- a/src/syscall/zsyscall_darwin_arm64.s
+++ b/src/syscall/zsyscall_darwin_arm64.s
@@ -53,8 +53,6 @@ TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0
JMP libc_futimes(SB)
TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0
JMP libc_fcntl(SB)
-TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
- JMP libc_ptrace(SB)
TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
JMP libc_pipe(SB)
TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0
diff --git a/src/syscall/zsyscall_freebsd_386.go b/src/syscall/zsyscall_freebsd_386.go
index 8f4234c7e9..ddc265f190 100644
--- a/src/syscall/zsyscall_freebsd_386.go
+++ b/src/syscall/zsyscall_freebsd_386.go
@@ -570,7 +570,7 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error) {
+func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
diff --git a/src/syscall/zsyscall_freebsd_amd64.go b/src/syscall/zsyscall_freebsd_amd64.go
index baa7d68a7d..a0f79522b9 100644
--- a/src/syscall/zsyscall_freebsd_amd64.go
+++ b/src/syscall/zsyscall_freebsd_amd64.go
@@ -570,7 +570,7 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error) {
+func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
diff --git a/src/syscall/zsyscall_freebsd_arm.go b/src/syscall/zsyscall_freebsd_arm.go
index 16e4bc5414..2cd23d3db6 100644
--- a/src/syscall/zsyscall_freebsd_arm.go
+++ b/src/syscall/zsyscall_freebsd_arm.go
@@ -570,7 +570,7 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error) {
+func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
diff --git a/src/testing/internal/testdeps/deps.go b/src/testing/internal/testdeps/deps.go
index 14512e9632..af08dd768a 100644
--- a/src/testing/internal/testdeps/deps.go
+++ b/src/testing/internal/testdeps/deps.go
@@ -98,7 +98,6 @@ func (l *testLog) add(op, name string) {
}
var log testLog
-var didSetLogger bool
func (TestDeps) StartTestLog(w io.Writer) {
log.mu.Lock()
diff --git a/src/text/template/helper.go b/src/text/template/helper.go
index 9e0200c352..c9e890078c 100644
--- a/src/text/template/helper.go
+++ b/src/text/template/helper.go
@@ -91,9 +91,10 @@ func parseFiles(t *Template, filenames ...string) (*Template, error) {
return t, nil
}
-// ParseGlob creates a new Template and parses the template definitions from the
-// files identified by the pattern, which must match at least one file. The
-// returned template will have the (base) name and (parsed) contents of the
+// ParseGlob creates a new Template and parses the template definitions from
+// the files identified by the pattern. The files are matched according to the
+// semantics of filepath.Match, and the pattern must match at least one file.
+// The returned template will have the (base) name and (parsed) contents of the
// first file matched by the pattern. ParseGlob is equivalent to calling
// ParseFiles with the list of files matched by the pattern.
//
@@ -104,10 +105,10 @@ func ParseGlob(pattern string) (*Template, error) {
}
// ParseGlob parses the template definitions in the files identified by the
-// pattern and associates the resulting templates with t. The pattern is
-// processed by filepath.Glob and must match at least one file. ParseGlob is
-// equivalent to calling t.ParseFiles with the list of files matched by the
-// pattern.
+// pattern and associates the resulting templates with t. The files are matched
+// according to the semantics of filepath.Match, and the pattern must match at
+// least one file. ParseGlob is equivalent to calling t.ParseFiles with the
+// list of files matched by the pattern.
//
// When parsing multiple files with the same name in different directories,
// the last one mentioned will be the one that results.
diff --git a/src/text/template/template.go b/src/text/template/template.go
index 41cdd5682c..1135d819b9 100644
--- a/src/text/template/template.go
+++ b/src/text/template/template.go
@@ -50,6 +50,10 @@ func (t *Template) Name() string {
// New allocates a new, undefined template associated with the given one and with the same
// delimiters. The association, which is transitive, allows one template to
// invoke another with a {{template}} action.
+//
+// Because associated templates share underlying data, template construction
+// cannot be done safely in parallel. Once the templates are constructed, they
+// can be executed in parallel.
func (t *Template) New(name string) *Template {
t.init()
nt := &Template{
diff --git a/src/vendor/golang.org/x/crypto/internal/chacha20/asm_ppc64le.s b/src/vendor/golang.org/x/crypto/internal/chacha20/asm_ppc64le.s
new file mode 100644
index 0000000000..cde3fc989b
--- /dev/null
+++ b/src/vendor/golang.org/x/crypto/internal/chacha20/asm_ppc64le.s
@@ -0,0 +1,668 @@
+// Copyright 2019 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.
+
+// Based on CRYPTOGAMS code with the following comment:
+// # ====================================================================
+// # Written by Andy Polyakov for the OpenSSL
+// # project. The module is, however, dual licensed under OpenSSL and
+// # CRYPTOGAMS licenses depending on where you obtain it. For further
+// # details see http://www.openssl.org/~appro/cryptogams/.
+// # ====================================================================
+
+// Original code can be found at the link below:
+// https://github.com/dot-asm/cryptogams/commit/a60f5b50ed908e91e5c39ca79126a4a876d5d8ff
+
+// There are some differences between CRYPTOGAMS code and this one. The round
+// loop for "_int" isn't the same as the original. Some adjustments were
+// necessary because there are less vector registers available. For example, some
+// X variables (r12, r13, r14, and r15) share the same register used by the
+// counter. The original code uses ctr to name the counter. Here we use CNT
+// because golang uses CTR as the counter register name.
+
+// +build ppc64le,!gccgo,!appengine
+
+#include "textflag.h"
+
+#define OUT R3
+#define INP R4
+#define LEN R5
+#define KEY R6
+#define CNT R7
+
+#define TEMP R8
+
+#define X0 R11
+#define X1 R12
+#define X2 R14
+#define X3 R15
+#define X4 R16
+#define X5 R17
+#define X6 R18
+#define X7 R19
+#define X8 R20
+#define X9 R21
+#define X10 R22
+#define X11 R23
+#define X12 R24
+#define X13 R25
+#define X14 R26
+#define X15 R27
+
+#define CON0 X0
+#define CON1 X1
+#define CON2 X2
+#define CON3 X3
+
+#define KEY0 X4
+#define KEY1 X5
+#define KEY2 X6
+#define KEY3 X7
+#define KEY4 X8
+#define KEY5 X9
+#define KEY6 X10
+#define KEY7 X11
+
+#define CNT0 X12
+#define CNT1 X13
+#define CNT2 X14
+#define CNT3 X15
+
+#define TMP0 R9
+#define TMP1 R10
+#define TMP2 R28
+#define TMP3 R29
+
+#define CONSTS R8
+
+#define A0 V0
+#define B0 V1
+#define C0 V2
+#define D0 V3
+#define A1 V4
+#define B1 V5
+#define C1 V6
+#define D1 V7
+#define A2 V8
+#define B2 V9
+#define C2 V10
+#define D2 V11
+#define T0 V12
+#define T1 V13
+#define T2 V14
+
+#define K0 V15
+#define K1 V16
+#define K2 V17
+#define K3 V18
+#define K4 V19
+#define K5 V20
+
+#define FOUR V21
+#define SIXTEEN V22
+#define TWENTY4 V23
+#define TWENTY V24
+#define TWELVE V25
+#define TWENTY5 V26
+#define SEVEN V27
+
+#define INPPERM V28
+#define OUTPERM V29
+#define OUTMASK V30
+
+#define DD0 V31
+#define DD1 SEVEN
+#define DD2 T0
+#define DD3 T1
+#define DD4 T2
+
+DATA ·consts+0x00(SB)/8, $0x3320646e61707865
+DATA ·consts+0x08(SB)/8, $0x6b20657479622d32
+DATA ·consts+0x10(SB)/8, $0x0000000000000001
+DATA ·consts+0x18(SB)/8, $0x0000000000000000
+DATA ·consts+0x20(SB)/8, $0x0000000000000004
+DATA ·consts+0x28(SB)/8, $0x0000000000000000
+DATA ·consts+0x30(SB)/8, $0x0a0b08090e0f0c0d
+DATA ·consts+0x38(SB)/8, $0x0203000106070405
+DATA ·consts+0x40(SB)/8, $0x090a0b080d0e0f0c
+DATA ·consts+0x48(SB)/8, $0x0102030005060704
+GLOBL ·consts(SB), RODATA, $80
+
+//func chaCha20_ctr32_vmx(out, inp *byte, len int, key *[32]byte, counter *[16]byte)
+TEXT ·chaCha20_ctr32_vmx(SB),NOSPLIT|NOFRAME,$0
+ // Load the arguments inside the registers
+ MOVD out+0(FP), OUT
+ MOVD inp+8(FP), INP
+ MOVD len+16(FP), LEN
+ MOVD key+24(FP), KEY
+ MOVD counter+32(FP), CNT
+
+ MOVD $·consts(SB), CONSTS // point to consts addr
+
+ MOVD $16, X0
+ MOVD $32, X1
+ MOVD $48, X2
+ MOVD $64, X3
+ MOVD $31, X4
+ MOVD $15, X5
+
+ // Load key
+ LVX (KEY)(R0), K1
+ LVSR (KEY)(R0), T0
+ LVX (KEY)(X0), K2
+ LVX (KEY)(X4), DD0
+
+ // Load counter
+ LVX (CNT)(R0), K3
+ LVSR (CNT)(R0), T1
+ LVX (CNT)(X5), DD1
+
+ // Load constants
+ LVX (CONSTS)(R0), K0
+ LVX (CONSTS)(X0), K5
+ LVX (CONSTS)(X1), FOUR
+ LVX (CONSTS)(X2), SIXTEEN
+ LVX (CONSTS)(X3), TWENTY4
+
+ // Align key and counter
+ VPERM K2, K1, T0, K1
+ VPERM DD0, K2, T0, K2
+ VPERM DD1, K3, T1, K3
+
+ // Load counter to GPR
+ MOVWZ 0(CNT), CNT0
+ MOVWZ 4(CNT), CNT1
+ MOVWZ 8(CNT), CNT2
+ MOVWZ 12(CNT), CNT3
+
+ // Adjust vectors for the initial state
+ VADDUWM K3, K5, K3
+ VADDUWM K3, K5, K4
+ VADDUWM K4, K5, K5
+
+ // Synthesized constants
+ VSPLTISW $-12, TWENTY
+ VSPLTISW $12, TWELVE
+ VSPLTISW $-7, TWENTY5
+
+ VXOR T0, T0, T0
+ VSPLTISW $-1, OUTMASK
+ LVSR (INP)(R0), INPPERM
+ LVSL (OUT)(R0), OUTPERM
+ VPERM OUTMASK, T0, OUTPERM, OUTMASK
+
+loop_outer_vmx:
+ // Load constant
+ MOVD $0x61707865, CON0
+ MOVD $0x3320646e, CON1
+ MOVD $0x79622d32, CON2
+ MOVD $0x6b206574, CON3
+
+ VOR K0, K0, A0
+ VOR K0, K0, A1
+ VOR K0, K0, A2
+ VOR K1, K1, B0
+
+ MOVD $10, TEMP
+
+ // Load key to GPR
+ MOVWZ 0(KEY), X4
+ MOVWZ 4(KEY), X5
+ MOVWZ 8(KEY), X6
+ MOVWZ 12(KEY), X7
+ VOR K1, K1, B1
+ VOR K1, K1, B2
+ MOVWZ 16(KEY), X8
+ MOVWZ 0(CNT), X12
+ MOVWZ 20(KEY), X9
+ MOVWZ 4(CNT), X13
+ VOR K2, K2, C0
+ VOR K2, K2, C1
+ MOVWZ 24(KEY), X10
+ MOVWZ 8(CNT), X14
+ VOR K2, K2, C2
+ VOR K3, K3, D0
+ MOVWZ 28(KEY), X11
+ MOVWZ 12(CNT), X15
+ VOR K4, K4, D1
+ VOR K5, K5, D2
+
+ MOVD X4, TMP0
+ MOVD X5, TMP1
+ MOVD X6, TMP2
+ MOVD X7, TMP3
+ VSPLTISW $7, SEVEN
+
+ MOVD TEMP, CTR
+
+loop_vmx:
+ // CRYPTOGAMS uses a macro to create a loop using perl. This isn't possible
+ // using assembly macros. Therefore, the macro expansion result was used
+ // in order to maintain the algorithm efficiency.
+ // This loop generates three keystream blocks using VMX instructions and,
+ // in parallel, one keystream block using scalar instructions.
+ ADD X4, X0, X0
+ ADD X5, X1, X1
+ VADDUWM A0, B0, A0
+ VADDUWM A1, B1, A1
+ ADD X6, X2, X2
+ ADD X7, X3, X3
+ VADDUWM A2, B2, A2
+ VXOR D0, A0, D0
+ XOR X0, X12, X12
+ XOR X1, X13, X13
+ VXOR D1, A1, D1
+ VXOR D2, A2, D2
+ XOR X2, X14, X14
+ XOR X3, X15, X15
+ VPERM D0, D0, SIXTEEN, D0
+ VPERM D1, D1, SIXTEEN, D1
+ ROTLW $16, X12, X12
+ ROTLW $16, X13, X13
+ VPERM D2, D2, SIXTEEN, D2
+ VADDUWM C0, D0, C0
+ ROTLW $16, X14, X14
+ ROTLW $16, X15, X15
+ VADDUWM C1, D1, C1
+ VADDUWM C2, D2, C2
+ ADD X12, X8, X8
+ ADD X13, X9, X9
+ VXOR B0, C0, T0
+ VXOR B1, C1, T1
+ ADD X14, X10, X10
+ ADD X15, X11, X11
+ VXOR B2, C2, T2
+ VRLW T0, TWELVE, B0
+ XOR X8, X4, X4
+ XOR X9, X5, X5
+ VRLW T1, TWELVE, B1
+ VRLW T2, TWELVE, B2
+ XOR X10, X6, X6
+ XOR X11, X7, X7
+ VADDUWM A0, B0, A0
+ VADDUWM A1, B1, A1
+ ROTLW $12, X4, X4
+ ROTLW $12, X5, X5
+ VADDUWM A2, B2, A2
+ VXOR D0, A0, D0
+ ROTLW $12, X6, X6
+ ROTLW $12, X7, X7
+ VXOR D1, A1, D1
+ VXOR D2, A2, D2
+ ADD X4, X0, X0
+ ADD X5, X1, X1
+ VPERM D0, D0, TWENTY4, D0
+ VPERM D1, D1, TWENTY4, D1
+ ADD X6, X2, X2
+ ADD X7, X3, X3
+ VPERM D2, D2, TWENTY4, D2
+ VADDUWM C0, D0, C0
+ XOR X0, X12, X12
+ XOR X1, X13, X13
+ VADDUWM C1, D1, C1
+ VADDUWM C2, D2, C2
+ XOR X2, X14, X14
+ XOR X3, X15, X15
+ VXOR B0, C0, T0
+ VXOR B1, C1, T1
+ ROTLW $8, X12, X12
+ ROTLW $8, X13, X13
+ VXOR B2, C2, T2
+ VRLW T0, SEVEN, B0
+ ROTLW $8, X14, X14
+ ROTLW $8, X15, X15
+ VRLW T1, SEVEN, B1
+ VRLW T2, SEVEN, B2
+ ADD X12, X8, X8
+ ADD X13, X9, X9
+ VSLDOI $8, C0, C0, C0
+ VSLDOI $8, C1, C1, C1
+ ADD X14, X10, X10
+ ADD X15, X11, X11
+ VSLDOI $8, C2, C2, C2
+ VSLDOI $12, B0, B0, B0
+ XOR X8, X4, X4
+ XOR X9, X5, X5
+ VSLDOI $12, B1, B1, B1
+ VSLDOI $12, B2, B2, B2
+ XOR X10, X6, X6
+ XOR X11, X7, X7
+ VSLDOI $4, D0, D0, D0
+ VSLDOI $4, D1, D1, D1
+ ROTLW $7, X4, X4
+ ROTLW $7, X5, X5
+ VSLDOI $4, D2, D2, D2
+ VADDUWM A0, B0, A0
+ ROTLW $7, X6, X6
+ ROTLW $7, X7, X7
+ VADDUWM A1, B1, A1
+ VADDUWM A2, B2, A2
+ ADD X5, X0, X0
+ ADD X6, X1, X1
+ VXOR D0, A0, D0
+ VXOR D1, A1, D1
+ ADD X7, X2, X2
+ ADD X4, X3, X3
+ VXOR D2, A2, D2
+ VPERM D0, D0, SIXTEEN, D0
+ XOR X0, X15, X15
+ XOR X1, X12, X12
+ VPERM D1, D1, SIXTEEN, D1
+ VPERM D2, D2, SIXTEEN, D2
+ XOR X2, X13, X13
+ XOR X3, X14, X14
+ VADDUWM C0, D0, C0
+ VADDUWM C1, D1, C1
+ ROTLW $16, X15, X15
+ ROTLW $16, X12, X12
+ VADDUWM C2, D2, C2
+ VXOR B0, C0, T0
+ ROTLW $16, X13, X13
+ ROTLW $16, X14, X14
+ VXOR B1, C1, T1
+ VXOR B2, C2, T2
+ ADD X15, X10, X10
+ ADD X12, X11, X11
+ VRLW T0, TWELVE, B0
+ VRLW T1, TWELVE, B1
+ ADD X13, X8, X8
+ ADD X14, X9, X9
+ VRLW T2, TWELVE, B2
+ VADDUWM A0, B0, A0
+ XOR X10, X5, X5
+ XOR X11, X6, X6
+ VADDUWM A1, B1, A1
+ VADDUWM A2, B2, A2
+ XOR X8, X7, X7
+ XOR X9, X4, X4
+ VXOR D0, A0, D0
+ VXOR D1, A1, D1
+ ROTLW $12, X5, X5
+ ROTLW $12, X6, X6
+ VXOR D2, A2, D2
+ VPERM D0, D0, TWENTY4, D0
+ ROTLW $12, X7, X7
+ ROTLW $12, X4, X4
+ VPERM D1, D1, TWENTY4, D1
+ VPERM D2, D2, TWENTY4, D2
+ ADD X5, X0, X0
+ ADD X6, X1, X1
+ VADDUWM C0, D0, C0
+ VADDUWM C1, D1, C1
+ ADD X7, X2, X2
+ ADD X4, X3, X3
+ VADDUWM C2, D2, C2
+ VXOR B0, C0, T0
+ XOR X0, X15, X15
+ XOR X1, X12, X12
+ VXOR B1, C1, T1
+ VXOR B2, C2, T2
+ XOR X2, X13, X13
+ XOR X3, X14, X14
+ VRLW T0, SEVEN, B0
+ VRLW T1, SEVEN, B1
+ ROTLW $8, X15, X15
+ ROTLW $8, X12, X12
+ VRLW T2, SEVEN, B2
+ VSLDOI $8, C0, C0, C0
+ ROTLW $8, X13, X13
+ ROTLW $8, X14, X14
+ VSLDOI $8, C1, C1, C1
+ VSLDOI $8, C2, C2, C2
+ ADD X15, X10, X10
+ ADD X12, X11, X11
+ VSLDOI $4, B0, B0, B0
+ VSLDOI $4, B1, B1, B1
+ ADD X13, X8, X8
+ ADD X14, X9, X9
+ VSLDOI $4, B2, B2, B2
+ VSLDOI $12, D0, D0, D0
+ XOR X10, X5, X5
+ XOR X11, X6, X6
+ VSLDOI $12, D1, D1, D1
+ VSLDOI $12, D2, D2, D2
+ XOR X8, X7, X7
+ XOR X9, X4, X4
+ ROTLW $7, X5, X5
+ ROTLW $7, X6, X6
+ ROTLW $7, X7, X7
+ ROTLW $7, X4, X4
+ BC 0x10, 0, loop_vmx
+
+ SUB $256, LEN, LEN
+
+ // Accumulate key block
+ ADD $0x61707865, X0, X0
+ ADD $0x3320646e, X1, X1
+ ADD $0x79622d32, X2, X2
+ ADD $0x6b206574, X3, X3
+ ADD TMP0, X4, X4
+ ADD TMP1, X5, X5
+ ADD TMP2, X6, X6
+ ADD TMP3, X7, X7
+ MOVWZ 16(KEY), TMP0
+ MOVWZ 20(KEY), TMP1
+ MOVWZ 24(KEY), TMP2
+ MOVWZ 28(KEY), TMP3
+ ADD TMP0, X8, X8
+ ADD TMP1, X9, X9
+ ADD TMP2, X10, X10
+ ADD TMP3, X11, X11
+
+ MOVWZ 12(CNT), TMP0
+ MOVWZ 8(CNT), TMP1
+ MOVWZ 4(CNT), TMP2
+ MOVWZ 0(CNT), TEMP
+ ADD TMP0, X15, X15
+ ADD TMP1, X14, X14
+ ADD TMP2, X13, X13
+ ADD TEMP, X12, X12
+
+ // Accumulate key block
+ VADDUWM A0, K0, A0
+ VADDUWM A1, K0, A1
+ VADDUWM A2, K0, A2
+ VADDUWM B0, K1, B0
+ VADDUWM B1, K1, B1
+ VADDUWM B2, K1, B2
+ VADDUWM C0, K2, C0
+ VADDUWM C1, K2, C1
+ VADDUWM C2, K2, C2
+ VADDUWM D0, K3, D0
+ VADDUWM D1, K4, D1
+ VADDUWM D2, K5, D2
+
+ // Increment counter
+ ADD $4, TEMP, TEMP
+ MOVW TEMP, 0(CNT)
+
+ VADDUWM K3, FOUR, K3
+ VADDUWM K4, FOUR, K4
+ VADDUWM K5, FOUR, K5
+
+ // XOR the input slice (INP) with the keystream, which is stored in GPRs (X0-X3).
+
+ // Load input (aligned or not)
+ MOVWZ 0(INP), TMP0
+ MOVWZ 4(INP), TMP1
+ MOVWZ 8(INP), TMP2
+ MOVWZ 12(INP), TMP3
+
+ // XOR with input
+ XOR TMP0, X0, X0
+ XOR TMP1, X1, X1
+ XOR TMP2, X2, X2
+ XOR TMP3, X3, X3
+ MOVWZ 16(INP), TMP0
+ MOVWZ 20(INP), TMP1
+ MOVWZ 24(INP), TMP2
+ MOVWZ 28(INP), TMP3
+ XOR TMP0, X4, X4
+ XOR TMP1, X5, X5
+ XOR TMP2, X6, X6
+ XOR TMP3, X7, X7
+ MOVWZ 32(INP), TMP0
+ MOVWZ 36(INP), TMP1
+ MOVWZ 40(INP), TMP2
+ MOVWZ 44(INP), TMP3
+ XOR TMP0, X8, X8
+ XOR TMP1, X9, X9
+ XOR TMP2, X10, X10
+ XOR TMP3, X11, X11
+ MOVWZ 48(INP), TMP0
+ MOVWZ 52(INP), TMP1
+ MOVWZ 56(INP), TMP2
+ MOVWZ 60(INP), TMP3
+ XOR TMP0, X12, X12
+ XOR TMP1, X13, X13
+ XOR TMP2, X14, X14
+ XOR TMP3, X15, X15
+
+ // Store output (aligned or not)
+ MOVW X0, 0(OUT)
+ MOVW X1, 4(OUT)
+ MOVW X2, 8(OUT)
+ MOVW X3, 12(OUT)
+
+ ADD $64, INP, INP // INP points to the end of the slice for the alignment code below
+
+ MOVW X4, 16(OUT)
+ MOVD $16, TMP0
+ MOVW X5, 20(OUT)
+ MOVD $32, TMP1
+ MOVW X6, 24(OUT)
+ MOVD $48, TMP2
+ MOVW X7, 28(OUT)
+ MOVD $64, TMP3
+ MOVW X8, 32(OUT)
+ MOVW X9, 36(OUT)
+ MOVW X10, 40(OUT)
+ MOVW X11, 44(OUT)
+ MOVW X12, 48(OUT)
+ MOVW X13, 52(OUT)
+ MOVW X14, 56(OUT)
+ MOVW X15, 60(OUT)
+ ADD $64, OUT, OUT
+
+ // Load input
+ LVX (INP)(R0), DD0
+ LVX (INP)(TMP0), DD1
+ LVX (INP)(TMP1), DD2
+ LVX (INP)(TMP2), DD3
+ LVX (INP)(TMP3), DD4
+ ADD $64, INP, INP
+
+ VPERM DD1, DD0, INPPERM, DD0 // Align input
+ VPERM DD2, DD1, INPPERM, DD1
+ VPERM DD3, DD2, INPPERM, DD2
+ VPERM DD4, DD3, INPPERM, DD3
+ VXOR A0, DD0, A0 // XOR with input
+ VXOR B0, DD1, B0
+ LVX (INP)(TMP0), DD1 // Keep loading input
+ VXOR C0, DD2, C0
+ LVX (INP)(TMP1), DD2
+ VXOR D0, DD3, D0
+ LVX (INP)(TMP2), DD3
+ LVX (INP)(TMP3), DD0
+ ADD $64, INP, INP
+ MOVD $63, TMP3 // 63 is not a typo
+ VPERM A0, A0, OUTPERM, A0
+ VPERM B0, B0, OUTPERM, B0
+ VPERM C0, C0, OUTPERM, C0
+ VPERM D0, D0, OUTPERM, D0
+
+ VPERM DD1, DD4, INPPERM, DD4 // Align input
+ VPERM DD2, DD1, INPPERM, DD1
+ VPERM DD3, DD2, INPPERM, DD2
+ VPERM DD0, DD3, INPPERM, DD3
+ VXOR A1, DD4, A1
+ VXOR B1, DD1, B1
+ LVX (INP)(TMP0), DD1 // Keep loading
+ VXOR C1, DD2, C1
+ LVX (INP)(TMP1), DD2
+ VXOR D1, DD3, D1
+ LVX (INP)(TMP2), DD3
+
+ // Note that the LVX address is always rounded down to the nearest 16-byte
+ // boundary, and that it always points to at most 15 bytes beyond the end of
+ // the slice, so we cannot cross a page boundary.
+ LVX (INP)(TMP3), DD4 // Redundant in aligned case.
+ ADD $64, INP, INP
+ VPERM A1, A1, OUTPERM, A1 // Pre-misalign output
+ VPERM B1, B1, OUTPERM, B1
+ VPERM C1, C1, OUTPERM, C1
+ VPERM D1, D1, OUTPERM, D1
+
+ VPERM DD1, DD0, INPPERM, DD0 // Align Input
+ VPERM DD2, DD1, INPPERM, DD1
+ VPERM DD3, DD2, INPPERM, DD2
+ VPERM DD4, DD3, INPPERM, DD3
+ VXOR A2, DD0, A2
+ VXOR B2, DD1, B2
+ VXOR C2, DD2, C2
+ VXOR D2, DD3, D2
+ VPERM A2, A2, OUTPERM, A2
+ VPERM B2, B2, OUTPERM, B2
+ VPERM C2, C2, OUTPERM, C2
+ VPERM D2, D2, OUTPERM, D2
+
+ ANDCC $15, OUT, X1 // Is out aligned?
+ MOVD OUT, X0
+
+ VSEL A0, B0, OUTMASK, DD0 // Collect pre-misaligned output
+ VSEL B0, C0, OUTMASK, DD1
+ VSEL C0, D0, OUTMASK, DD2
+ VSEL D0, A1, OUTMASK, DD3
+ VSEL A1, B1, OUTMASK, B0
+ VSEL B1, C1, OUTMASK, C0
+ VSEL C1, D1, OUTMASK, D0
+ VSEL D1, A2, OUTMASK, A1
+ VSEL A2, B2, OUTMASK, B1
+ VSEL B2, C2, OUTMASK, C1
+ VSEL C2, D2, OUTMASK, D1
+
+ STVX DD0, (OUT+TMP0)
+ STVX DD1, (OUT+TMP1)
+ STVX DD2, (OUT+TMP2)
+ ADD $64, OUT, OUT
+ STVX DD3, (OUT+R0)
+ STVX B0, (OUT+TMP0)
+ STVX C0, (OUT+TMP1)
+ STVX D0, (OUT+TMP2)
+ ADD $64, OUT, OUT
+ STVX A1, (OUT+R0)
+ STVX B1, (OUT+TMP0)
+ STVX C1, (OUT+TMP1)
+ STVX D1, (OUT+TMP2)
+ ADD $64, OUT, OUT
+
+ BEQ aligned_vmx
+
+ SUB X1, OUT, X2 // in misaligned case edges
+ MOVD $0, X3 // are written byte-by-byte
+
+unaligned_tail_vmx:
+ STVEBX D2, (X2+X3)
+ ADD $1, X3, X3
+ CMPW X3, X1
+ BNE unaligned_tail_vmx
+ SUB X1, X0, X2
+
+unaligned_head_vmx:
+ STVEBX A0, (X2+X1)
+ CMPW X1, $15
+ ADD $1, X1, X1
+ BNE unaligned_head_vmx
+
+ CMPU LEN, $255 // done with 256-byte block yet?
+ BGT loop_outer_vmx
+
+ JMP done_vmx
+
+aligned_vmx:
+ STVX A0, (X0+R0)
+ CMPU LEN, $255 // done with 256-byte block yet?
+ BGT loop_outer_vmx
+
+done_vmx:
+ RET
diff --git a/src/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go b/src/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go
index 47eac0314c..bf8beba670 100644
--- a/src/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go
+++ b/src/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !arm64,!s390x arm64,!go1.11 gccgo appengine
+// +build !ppc64le,!arm64,!s390x arm64,!go1.11 gccgo appengine
package chacha20
diff --git a/src/vendor/golang.org/x/crypto/internal/chacha20/chacha_ppc64le.go b/src/vendor/golang.org/x/crypto/internal/chacha20/chacha_ppc64le.go
new file mode 100644
index 0000000000..638cb5e5de
--- /dev/null
+++ b/src/vendor/golang.org/x/crypto/internal/chacha20/chacha_ppc64le.go
@@ -0,0 +1,52 @@
+// Copyright 2019 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.
+
+// +build ppc64le,!gccgo,!appengine
+
+package chacha20
+
+import "encoding/binary"
+
+const (
+ bufSize = 256
+ haveAsm = true
+)
+
+//go:noescape
+func chaCha20_ctr32_vmx(out, inp *byte, len int, key *[8]uint32, counter *uint32)
+
+func (c *Cipher) xorKeyStreamAsm(dst, src []byte) {
+ if len(src) >= bufSize {
+ chaCha20_ctr32_vmx(&dst[0], &src[0], len(src)-len(src)%bufSize, &c.key, &c.counter)
+ }
+ if len(src)%bufSize != 0 {
+ chaCha20_ctr32_vmx(&c.buf[0], &c.buf[0], bufSize, &c.key, &c.counter)
+ start := len(src) - len(src)%bufSize
+ ts, td, tb := src[start:], dst[start:], c.buf[:]
+ // Unroll loop to XOR 32 bytes per iteration.
+ for i := 0; i < len(ts)-32; i += 32 {
+ td, tb = td[:len(ts)], tb[:len(ts)] // bounds check elimination
+ s0 := binary.LittleEndian.Uint64(ts[0:8])
+ s1 := binary.LittleEndian.Uint64(ts[8:16])
+ s2 := binary.LittleEndian.Uint64(ts[16:24])
+ s3 := binary.LittleEndian.Uint64(ts[24:32])
+ b0 := binary.LittleEndian.Uint64(tb[0:8])
+ b1 := binary.LittleEndian.Uint64(tb[8:16])
+ b2 := binary.LittleEndian.Uint64(tb[16:24])
+ b3 := binary.LittleEndian.Uint64(tb[24:32])
+ binary.LittleEndian.PutUint64(td[0:8], s0^b0)
+ binary.LittleEndian.PutUint64(td[8:16], s1^b1)
+ binary.LittleEndian.PutUint64(td[16:24], s2^b2)
+ binary.LittleEndian.PutUint64(td[24:32], s3^b3)
+ ts, td, tb = ts[32:], td[32:], tb[32:]
+ }
+ td, tb = td[:len(ts)], tb[:len(ts)] // bounds check elimination
+ for i, v := range ts {
+ td[i] = tb[i] ^ v
+ }
+ c.len = bufSize - (len(src) % bufSize)
+
+ }
+
+}
diff --git a/src/vendor/golang.org/x/crypto/poly1305/mac_noasm.go b/src/vendor/golang.org/x/crypto/poly1305/mac_noasm.go
index 8387d29998..a8dd589ae3 100644
--- a/src/vendor/golang.org/x/crypto/poly1305/mac_noasm.go
+++ b/src/vendor/golang.org/x/crypto/poly1305/mac_noasm.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !amd64 gccgo appengine
+// +build !amd64,!ppc64le gccgo appengine
package poly1305
diff --git a/src/vendor/golang.org/x/crypto/poly1305/sum_noasm.go b/src/vendor/golang.org/x/crypto/poly1305/sum_noasm.go
index fcdef46ab6..8a9c2070b9 100644
--- a/src/vendor/golang.org/x/crypto/poly1305/sum_noasm.go
+++ b/src/vendor/golang.org/x/crypto/poly1305/sum_noasm.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build s390x,!go1.11 !arm,!amd64,!s390x gccgo appengine nacl
+// +build s390x,!go1.11 !arm,!amd64,!s390x,!ppc64le gccgo appengine nacl
package poly1305
diff --git a/src/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go b/src/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go
new file mode 100644
index 0000000000..2402b6371b
--- /dev/null
+++ b/src/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go
@@ -0,0 +1,68 @@
+// Copyright 2019 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.
+
+// +build ppc64le,!gccgo,!appengine
+
+package poly1305
+
+//go:noescape
+func initialize(state *[7]uint64, key *[32]byte)
+
+//go:noescape
+func update(state *[7]uint64, msg []byte)
+
+//go:noescape
+func finalize(tag *[TagSize]byte, state *[7]uint64)
+
+// Sum generates an authenticator for m using a one-time key and puts the
+// 16-byte result into out. Authenticating two different messages with the same
+// key allows an attacker to forge messages at will.
+func Sum(out *[16]byte, m []byte, key *[32]byte) {
+ h := newMAC(key)
+ h.Write(m)
+ h.Sum(out)
+}
+
+func newMAC(key *[32]byte) (h mac) {
+ initialize(&h.state, key)
+ return
+}
+
+type mac struct {
+ state [7]uint64 // := uint64{ h0, h1, h2, r0, r1, pad0, pad1 }
+
+ buffer [TagSize]byte
+ offset int
+}
+
+func (h *mac) Write(p []byte) (n int, err error) {
+ n = len(p)
+ if h.offset > 0 {
+ remaining := TagSize - h.offset
+ if n < remaining {
+ h.offset += copy(h.buffer[h.offset:], p)
+ return n, nil
+ }
+ copy(h.buffer[h.offset:], p[:remaining])
+ p = p[remaining:]
+ h.offset = 0
+ update(&h.state, h.buffer[:])
+ }
+ if nn := len(p) - (len(p) % TagSize); nn > 0 {
+ update(&h.state, p[:nn])
+ p = p[nn:]
+ }
+ if len(p) > 0 {
+ h.offset += copy(h.buffer[h.offset:], p)
+ }
+ return n, nil
+}
+
+func (h *mac) Sum(out *[16]byte) {
+ state := h.state
+ if h.offset > 0 {
+ update(&state, h.buffer[:h.offset])
+ }
+ finalize(out, &state)
+}
diff --git a/src/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s b/src/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s
new file mode 100644
index 0000000000..55c7167ec9
--- /dev/null
+++ b/src/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s
@@ -0,0 +1,247 @@
+// Copyright 2019 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.
+
+// +build ppc64le,!gccgo,!appengine
+
+#include "textflag.h"
+
+// This was ported from the amd64 implementation.
+
+#define POLY1305_ADD(msg, h0, h1, h2, t0, t1, t2) \
+ MOVD (msg), t0; \
+ MOVD 8(msg), t1; \
+ MOVD $1, t2; \
+ ADDC t0, h0, h0; \
+ ADDE t1, h1, h1; \
+ ADDE t2, h2; \
+ ADD $16, msg
+
+#define POLY1305_MUL(h0, h1, h2, r0, r1, t0, t1, t2, t3, t4, t5) \
+ MULLD r0, h0, t0; \
+ MULLD r0, h1, t4; \
+ MULHDU r0, h0, t1; \
+ MULHDU r0, h1, t5; \
+ ADDC t4, t1, t1; \
+ MULLD r0, h2, t2; \
+ ADDZE t5; \
+ MULHDU r1, h0, t4; \
+ MULLD r1, h0, h0; \
+ ADD t5, t2, t2; \
+ ADDC h0, t1, t1; \
+ MULLD h2, r1, t3; \
+ ADDZE t4, h0; \
+ MULHDU r1, h1, t5; \
+ MULLD r1, h1, t4; \
+ ADDC t4, t2, t2; \
+ ADDE t5, t3, t3; \
+ ADDC h0, t2, t2; \
+ MOVD $-4, t4; \
+ MOVD t0, h0; \
+ MOVD t1, h1; \
+ ADDZE t3; \
+ ANDCC $3, t2, h2; \
+ AND t2, t4, t0; \
+ ADDC t0, h0, h0; \
+ ADDE t3, h1, h1; \
+ SLD $62, t3, t4; \
+ SRD $2, t2; \
+ ADDZE h2; \
+ OR t4, t2, t2; \
+ SRD $2, t3; \
+ ADDC t2, h0, h0; \
+ ADDE t3, h1, h1; \
+ ADDZE h2
+
+DATA ·poly1305Mask<>+0x00(SB)/8, $0x0FFFFFFC0FFFFFFF
+DATA ·poly1305Mask<>+0x08(SB)/8, $0x0FFFFFFC0FFFFFFC
+GLOBL ·poly1305Mask<>(SB), RODATA, $16
+
+// func update(state *[7]uint64, msg []byte)
+
+TEXT ·update(SB), $0-32
+ MOVD state+0(FP), R3
+ MOVD msg_base+8(FP), R4
+ MOVD msg_len+16(FP), R5
+
+ MOVD 0(R3), R8 // h0
+ MOVD 8(R3), R9 // h1
+ MOVD 16(R3), R10 // h2
+ MOVD 24(R3), R11 // r0
+ MOVD 32(R3), R12 // r1
+
+ CMP R5, $16
+ BLT bytes_between_0_and_15
+
+loop:
+ POLY1305_ADD(R4, R8, R9, R10, R20, R21, R22)
+
+multiply:
+ POLY1305_MUL(R8, R9, R10, R11, R12, R16, R17, R18, R14, R20, R21)
+ ADD $-16, R5
+ CMP R5, $16
+ BGE loop
+
+bytes_between_0_and_15:
+ CMP $0, R5
+ BEQ done
+ MOVD $0, R16 // h0
+ MOVD $0, R17 // h1
+
+flush_buffer:
+ CMP R5, $8
+ BLE just1
+
+ MOVD $8, R21
+ SUB R21, R5, R21
+
+ // Greater than 8 -- load the rightmost remaining bytes in msg
+ // and put into R17 (h1)
+ MOVD (R4)(R21), R17
+ MOVD $16, R22
+
+ // Find the offset to those bytes
+ SUB R5, R22, R22
+ SLD $3, R22
+
+ // Shift to get only the bytes in msg
+ SRD R22, R17, R17
+
+ // Put 1 at high end
+ MOVD $1, R23
+ SLD $3, R21
+ SLD R21, R23, R23
+ OR R23, R17, R17
+
+ // Remainder is 8
+ MOVD $8, R5
+
+just1:
+ CMP R5, $8
+ BLT less8
+
+ // Exactly 8
+ MOVD (R4), R16
+
+ CMP $0, R17
+
+ // Check if we've already set R17; if not
+ // set 1 to indicate end of msg.
+ BNE carry
+ MOVD $1, R17
+ BR carry
+
+less8:
+ MOVD $0, R16 // h0
+ MOVD $0, R22 // shift count
+ CMP R5, $4
+ BLT less4
+ MOVWZ (R4), R16
+ ADD $4, R4
+ ADD $-4, R5
+ MOVD $32, R22
+
+less4:
+ CMP R5, $2
+ BLT less2
+ MOVHZ (R4), R21
+ SLD R22, R21, R21
+ OR R16, R21, R16
+ ADD $16, R22
+ ADD $-2, R5
+ ADD $2, R4
+
+less2:
+ CMP $0, R5
+ BEQ insert1
+ MOVBZ (R4), R21
+ SLD R22, R21, R21
+ OR R16, R21, R16
+ ADD $8, R22
+
+insert1:
+ // Insert 1 at end of msg
+ MOVD $1, R21
+ SLD R22, R21, R21
+ OR R16, R21, R16
+
+carry:
+ // Add new values to h0, h1, h2
+ ADDC R16, R8
+ ADDE R17, R9
+ ADDE $0, R10
+ MOVD $16, R5
+ ADD R5, R4
+ BR multiply
+
+done:
+ // Save h0, h1, h2 in state
+ MOVD R8, 0(R3)
+ MOVD R9, 8(R3)
+ MOVD R10, 16(R3)
+ RET
+
+// func initialize(state *[7]uint64, key *[32]byte)
+TEXT ·initialize(SB), $0-16
+ MOVD state+0(FP), R3
+ MOVD key+8(FP), R4
+
+ // state[0...7] is initialized with zero
+ // Load key
+ MOVD 0(R4), R5
+ MOVD 8(R4), R6
+ MOVD 16(R4), R7
+ MOVD 24(R4), R8
+
+ // Address of key mask
+ MOVD $·poly1305Mask<>(SB), R9
+
+ // Save original key in state
+ MOVD R7, 40(R3)
+ MOVD R8, 48(R3)
+
+ // Get mask
+ MOVD (R9), R7
+ MOVD 8(R9), R8
+
+ // And with key
+ AND R5, R7, R5
+ AND R6, R8, R6
+
+ // Save masked key in state
+ MOVD R5, 24(R3)
+ MOVD R6, 32(R3)
+ RET
+
+// func finalize(tag *[TagSize]byte, state *[7]uint64)
+TEXT ·finalize(SB), $0-16
+ MOVD tag+0(FP), R3
+ MOVD state+8(FP), R4
+
+ // Get h0, h1, h2 from state
+ MOVD 0(R4), R5
+ MOVD 8(R4), R6
+ MOVD 16(R4), R7
+
+ // Save h0, h1
+ MOVD R5, R8
+ MOVD R6, R9
+ MOVD $3, R20
+ MOVD $-1, R21
+ SUBC $-5, R5
+ SUBE R21, R6
+ SUBE R20, R7
+ MOVD $0, R21
+ SUBZE R21
+
+ // Check for carry
+ CMP $0, R21
+ ISEL $2, R5, R8, R5
+ ISEL $2, R6, R9, R6
+ MOVD 40(R4), R8
+ MOVD 48(R4), R9
+ ADDC R8, R5
+ ADDE R9, R6
+ MOVD R5, 0(R3)
+ MOVD R6, 8(R3)
+ RET
diff --git a/src/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s b/src/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s
similarity index 100%
rename from src/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
rename to src/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s
diff --git a/src/vendor/golang.org/x/sys/cpu/cpu_aix_ppc64.go b/src/vendor/golang.org/x/sys/cpu/cpu_aix_ppc64.go
index d8c26a048d..be60272247 100644
--- a/src/vendor/golang.org/x/sys/cpu/cpu_aix_ppc64.go
+++ b/src/vendor/golang.org/x/sys/cpu/cpu_aix_ppc64.go
@@ -6,8 +6,6 @@
package cpu
-import "golang.org/x/sys/unix"
-
const cacheLineSize = 128
const (
@@ -18,7 +16,7 @@ const (
)
func init() {
- impl := unix.Getsystemcfg(_SC_IMPL)
+ impl := getsystemcfg(_SC_IMPL)
if impl&_IMPL_POWER8 != 0 {
PPC64.IsPOWER8 = true
}
@@ -28,3 +26,9 @@ func init() {
Initialized = true
}
+
+func getsystemcfg(label int) (n uint64) {
+ r0, _ := callgetsystemcfg(label)
+ n = uint64(r0)
+ return
+}
diff --git a/src/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go b/src/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go
new file mode 100644
index 0000000000..78fe25e86f
--- /dev/null
+++ b/src/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go
@@ -0,0 +1,36 @@
+// Copyright 2019 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.
+
+// Minimal copy of x/sys/unix so the cpu package can make a
+// system call on AIX without depending on x/sys/unix.
+// (See golang.org/issue/32102)
+
+// +build aix,ppc64
+// +build !gccgo
+
+package cpu
+
+import (
+ "syscall"
+ "unsafe"
+)
+
+//go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o"
+
+//go:linkname libc_getsystemcfg libc_getsystemcfg
+
+type syscallFunc uintptr
+
+var libc_getsystemcfg syscallFunc
+
+type errno = syscall.Errno
+
+// Implemented in runtime/syscall_aix.go.
+func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno)
+func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno)
+
+func callgetsystemcfg(label int) (r1 uintptr, e1 errno) {
+ r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getsystemcfg)), 1, uintptr(label), 0, 0, 0, 0, 0)
+ return
+}
diff --git a/src/vendor/golang.org/x/sys/unix/.gitignore b/src/vendor/golang.org/x/sys/unix/.gitignore
deleted file mode 100644
index e3e0fc6f89..0000000000
--- a/src/vendor/golang.org/x/sys/unix/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-_obj/
-unix.test
diff --git a/src/vendor/golang.org/x/sys/unix/README.md b/src/vendor/golang.org/x/sys/unix/README.md
deleted file mode 100644
index eb2f78ae29..0000000000
--- a/src/vendor/golang.org/x/sys/unix/README.md
+++ /dev/null
@@ -1,173 +0,0 @@
-# Building `sys/unix`
-
-The sys/unix package provides access to the raw system call interface of the
-underlying operating system. See: https://godoc.org/golang.org/x/sys/unix
-
-Porting Go to a new architecture/OS combination or adding syscalls, types, or
-constants to an existing architecture/OS pair requires some manual effort;
-however, there are tools that automate much of the process.
-
-## Build Systems
-
-There are currently two ways we generate the necessary files. We are currently
-migrating the build system to use containers so the builds are reproducible.
-This is being done on an OS-by-OS basis. Please update this documentation as
-components of the build system change.
-
-### Old Build System (currently for `GOOS != "linux"`)
-
-The old build system generates the Go files based on the C header files
-present on your system. This means that files
-for a given GOOS/GOARCH pair must be generated on a system with that OS and
-architecture. This also means that the generated code can differ from system
-to system, based on differences in the header files.
-
-To avoid this, if you are using the old build system, only generate the Go
-files on an installation with unmodified header files. It is also important to
-keep track of which version of the OS the files were generated from (ex.
-Darwin 14 vs Darwin 15). This makes it easier to track the progress of changes
-and have each OS upgrade correspond to a single change.
-
-To build the files for your current OS and architecture, make sure GOOS and
-GOARCH are set correctly and run `mkall.sh`. This will generate the files for
-your specific system. Running `mkall.sh -n` shows the commands that will be run.
-
-Requirements: bash, go
-
-### New Build System (currently for `GOOS == "linux"`)
-
-The new build system uses a Docker container to generate the go files directly
-from source checkouts of the kernel and various system libraries. This means
-that on any platform that supports Docker, all the files using the new build
-system can be generated at once, and generated files will not change based on
-what the person running the scripts has installed on their computer.
-
-The OS specific files for the new build system are located in the `${GOOS}`
-directory, and the build is coordinated by the `${GOOS}/mkall.go` program. When
-the kernel or system library updates, modify the Dockerfile at
-`${GOOS}/Dockerfile` to checkout the new release of the source.
-
-To build all the files under the new build system, you must be on an amd64/Linux
-system and have your GOOS and GOARCH set accordingly. Running `mkall.sh` will
-then generate all of the files for all of the GOOS/GOARCH pairs in the new build
-system. Running `mkall.sh -n` shows the commands that will be run.
-
-Requirements: bash, go, docker
-
-## Component files
-
-This section describes the various files used in the code generation process.
-It also contains instructions on how to modify these files to add a new
-architecture/OS or to add additional syscalls, types, or constants. Note that
-if you are using the new build system, the scripts/programs cannot be called normally.
-They must be called from within the docker container.
-
-### asm files
-
-The hand-written assembly file at `asm_${GOOS}_${GOARCH}.s` implements system
-call dispatch. There are three entry points:
-```
- func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
- func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
- func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
-```
-The first and second are the standard ones; they differ only in how many
-arguments can be passed to the kernel. The third is for low-level use by the
-ForkExec wrapper. Unlike the first two, it does not call into the scheduler to
-let it know that a system call is running.
-
-When porting Go to an new architecture/OS, this file must be implemented for
-each GOOS/GOARCH pair.
-
-### mksysnum
-
-Mksysnum is a Go program located at `${GOOS}/mksysnum.go` (or `mksysnum_${GOOS}.go`
-for the old system). This program takes in a list of header files containing the
-syscall number declarations and parses them to produce the corresponding list of
-Go numeric constants. See `zsysnum_${GOOS}_${GOARCH}.go` for the generated
-constants.
-
-Adding new syscall numbers is mostly done by running the build on a sufficiently
-new installation of the target OS (or updating the source checkouts for the
-new build system). However, depending on the OS, you make need to update the
-parsing in mksysnum.
-
-### mksyscall.go
-
-The `syscall.go`, `syscall_${GOOS}.go`, `syscall_${GOOS}_${GOARCH}.go` are
-hand-written Go files which implement system calls (for unix, the specific OS,
-or the specific OS/Architecture pair respectively) that need special handling
-and list `//sys` comments giving prototypes for ones that can be generated.
-
-The mksyscall.go program takes the `//sys` and `//sysnb` comments and converts
-them into syscalls. This requires the name of the prototype in the comment to
-match a syscall number in the `zsysnum_${GOOS}_${GOARCH}.go` file. The function
-prototype can be exported (capitalized) or not.
-
-Adding a new syscall often just requires adding a new `//sys` function prototype
-with the desired arguments and a capitalized name so it is exported. However, if
-you want the interface to the syscall to be different, often one will make an
-unexported `//sys` prototype, an then write a custom wrapper in
-`syscall_${GOOS}.go`.
-
-### types files
-
-For each OS, there is a hand-written Go file at `${GOOS}/types.go` (or
-`types_${GOOS}.go` on the old system). This file includes standard C headers and
-creates Go type aliases to the corresponding C types. The file is then fed
-through godef to get the Go compatible definitions. Finally, the generated code
-is fed though mkpost.go to format the code correctly and remove any hidden or
-private identifiers. This cleaned-up code is written to
-`ztypes_${GOOS}_${GOARCH}.go`.
-
-The hardest part about preparing this file is figuring out which headers to
-include and which symbols need to be `#define`d to get the actual data
-structures that pass through to the kernel system calls. Some C libraries
-preset alternate versions for binary compatibility and translate them on the
-way in and out of system calls, but there is almost always a `#define` that can
-get the real ones.
-See `types_darwin.go` and `linux/types.go` for examples.
-
-To add a new type, add in the necessary include statement at the top of the
-file (if it is not already there) and add in a type alias line. Note that if
-your type is significantly different on different architectures, you may need
-some `#if/#elif` macros in your include statements.
-
-### mkerrors.sh
-
-This script is used to generate the system's various constants. This doesn't
-just include the error numbers and error strings, but also the signal numbers
-an a wide variety of miscellaneous constants. The constants come from the list
-of include files in the `includes_${uname}` variable. A regex then picks out
-the desired `#define` statements, and generates the corresponding Go constants.
-The error numbers and strings are generated from `#include `, and the
-signal numbers and strings are generated from `#include `. All of
-these constants are written to `zerrors_${GOOS}_${GOARCH}.go` via a C program,
-`_errors.c`, which prints out all the constants.
-
-To add a constant, add the header that includes it to the appropriate variable.
-Then, edit the regex (if necessary) to match the desired constant. Avoid making
-the regex too broad to avoid matching unintended constants.
-
-
-## Generated files
-
-### `zerror_${GOOS}_${GOARCH}.go`
-
-A file containing all of the system's generated error numbers, error strings,
-signal numbers, and constants. Generated by `mkerrors.sh` (see above).
-
-### `zsyscall_${GOOS}_${GOARCH}.go`
-
-A file containing all the generated syscalls for a specific GOOS and GOARCH.
-Generated by `mksyscall.go` (see above).
-
-### `zsysnum_${GOOS}_${GOARCH}.go`
-
-A list of numeric constants for all the syscall number of the specific GOOS
-and GOARCH. Generated by mksysnum (see above).
-
-### `ztypes_${GOOS}_${GOARCH}.go`
-
-A file containing Go types for passing into (or returning from) syscalls.
-Generated by godefs and the types file (see above).
diff --git a/src/vendor/golang.org/x/sys/unix/affinity_linux.go b/src/vendor/golang.org/x/sys/unix/affinity_linux.go
deleted file mode 100644
index 72afe3338c..0000000000
--- a/src/vendor/golang.org/x/sys/unix/affinity_linux.go
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright 2018 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.
-
-// CPU affinity functions
-
-package unix
-
-import (
- "unsafe"
-)
-
-const cpuSetSize = _CPU_SETSIZE / _NCPUBITS
-
-// CPUSet represents a CPU affinity mask.
-type CPUSet [cpuSetSize]cpuMask
-
-func schedAffinity(trap uintptr, pid int, set *CPUSet) error {
- _, _, e := RawSyscall(trap, uintptr(pid), uintptr(unsafe.Sizeof(*set)), uintptr(unsafe.Pointer(set)))
- if e != 0 {
- return errnoErr(e)
- }
- return nil
-}
-
-// SchedGetaffinity gets the CPU affinity mask of the thread specified by pid.
-// If pid is 0 the calling thread is used.
-func SchedGetaffinity(pid int, set *CPUSet) error {
- return schedAffinity(SYS_SCHED_GETAFFINITY, pid, set)
-}
-
-// SchedSetaffinity sets the CPU affinity mask of the thread specified by pid.
-// If pid is 0 the calling thread is used.
-func SchedSetaffinity(pid int, set *CPUSet) error {
- return schedAffinity(SYS_SCHED_SETAFFINITY, pid, set)
-}
-
-// Zero clears the set s, so that it contains no CPUs.
-func (s *CPUSet) Zero() {
- for i := range s {
- s[i] = 0
- }
-}
-
-func cpuBitsIndex(cpu int) int {
- return cpu / _NCPUBITS
-}
-
-func cpuBitsMask(cpu int) cpuMask {
- return cpuMask(1 << (uint(cpu) % _NCPUBITS))
-}
-
-// Set adds cpu to the set s.
-func (s *CPUSet) Set(cpu int) {
- i := cpuBitsIndex(cpu)
- if i < len(s) {
- s[i] |= cpuBitsMask(cpu)
- }
-}
-
-// Clear removes cpu from the set s.
-func (s *CPUSet) Clear(cpu int) {
- i := cpuBitsIndex(cpu)
- if i < len(s) {
- s[i] &^= cpuBitsMask(cpu)
- }
-}
-
-// IsSet reports whether cpu is in the set s.
-func (s *CPUSet) IsSet(cpu int) bool {
- i := cpuBitsIndex(cpu)
- if i < len(s) {
- return s[i]&cpuBitsMask(cpu) != 0
- }
- return false
-}
-
-// Count returns the number of CPUs in the set s.
-func (s *CPUSet) Count() int {
- c := 0
- for _, b := range s {
- c += onesCount64(uint64(b))
- }
- return c
-}
-
-// onesCount64 is a copy of Go 1.9's math/bits.OnesCount64.
-// Once this package can require Go 1.9, we can delete this
-// and update the caller to use bits.OnesCount64.
-func onesCount64(x uint64) int {
- const m0 = 0x5555555555555555 // 01010101 ...
- const m1 = 0x3333333333333333 // 00110011 ...
- const m2 = 0x0f0f0f0f0f0f0f0f // 00001111 ...
- const m3 = 0x00ff00ff00ff00ff // etc.
- const m4 = 0x0000ffff0000ffff
-
- // Implementation: Parallel summing of adjacent bits.
- // See "Hacker's Delight", Chap. 5: Counting Bits.
- // The following pattern shows the general approach:
- //
- // x = x>>1&(m0&m) + x&(m0&m)
- // x = x>>2&(m1&m) + x&(m1&m)
- // x = x>>4&(m2&m) + x&(m2&m)
- // x = x>>8&(m3&m) + x&(m3&m)
- // x = x>>16&(m4&m) + x&(m4&m)
- // x = x>>32&(m5&m) + x&(m5&m)
- // return int(x)
- //
- // Masking (& operations) can be left away when there's no
- // danger that a field's sum will carry over into the next
- // field: Since the result cannot be > 64, 8 bits is enough
- // and we can ignore the masks for the shifts by 8 and up.
- // Per "Hacker's Delight", the first line can be simplified
- // more, but it saves at best one instruction, so we leave
- // it alone for clarity.
- const m = 1<<64 - 1
- x = x>>1&(m0&m) + x&(m0&m)
- x = x>>2&(m1&m) + x&(m1&m)
- x = (x>>4 + x) & (m2 & m)
- x += x >> 8
- x += x >> 16
- x += x >> 32
- return int(x) & (1<<7 - 1)
-}
diff --git a/src/vendor/golang.org/x/sys/unix/aliases.go b/src/vendor/golang.org/x/sys/unix/aliases.go
deleted file mode 100644
index 951fce4d0d..0000000000
--- a/src/vendor/golang.org/x/sys/unix/aliases.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2018 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.
-
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-// +build go1.9
-
-package unix
-
-import "syscall"
-
-type Signal = syscall.Signal
-type Errno = syscall.Errno
-type SysProcAttr = syscall.SysProcAttr
diff --git a/src/vendor/golang.org/x/sys/unix/asm_darwin_386.s b/src/vendor/golang.org/x/sys/unix/asm_darwin_386.s
deleted file mode 100644
index 8a7278319e..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_darwin_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s b/src/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s
deleted file mode 100644
index 6321421f27..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_darwin_arm.s b/src/vendor/golang.org/x/sys/unix/asm_darwin_arm.s
deleted file mode 100644
index 333242d506..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_darwin_arm.s
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2015 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.
-
-// +build !gccgo
-// +build arm,darwin
-
-#include "textflag.h"
-
-//
-// System call support for ARM, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s b/src/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
deleted file mode 100644
index 97e0174371..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2015 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.
-
-// +build !gccgo
-// +build arm64,darwin
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- B syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s b/src/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
deleted file mode 100644
index 603dd5728c..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, DragonFly
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_freebsd_386.s b/src/vendor/golang.org/x/sys/unix/asm_freebsd_386.s
deleted file mode 100644
index c9a0a26015..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_freebsd_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s b/src/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
deleted file mode 100644
index 35172477c8..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s b/src/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
deleted file mode 100644
index 9227c875bf..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2012 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s b/src/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
deleted file mode 100644
index d9318cbf03..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2018 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM64, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_linux_386.s b/src/vendor/golang.org/x/sys/unix/asm_linux_386.s
deleted file mode 100644
index 448bebbb59..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_linux_386.s
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2009 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for 386, Linux
-//
-
-// See ../runtime/sys_linux_386.s for the reason why we always use int 0x80
-// instead of the glibc-specific "CALL 0x10(GS)".
-#define INVOKE_SYSCALL INT $0x80
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
- CALL runtime·entersyscall(SB)
- MOVL trap+0(FP), AX // syscall entry
- MOVL a1+4(FP), BX
- MOVL a2+8(FP), CX
- MOVL a3+12(FP), DX
- MOVL $0, SI
- MOVL $0, DI
- INVOKE_SYSCALL
- MOVL AX, r1+16(FP)
- MOVL DX, r2+20(FP)
- CALL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
- MOVL trap+0(FP), AX // syscall entry
- MOVL a1+4(FP), BX
- MOVL a2+8(FP), CX
- MOVL a3+12(FP), DX
- MOVL $0, SI
- MOVL $0, DI
- INVOKE_SYSCALL
- MOVL AX, r1+16(FP)
- MOVL DX, r2+20(FP)
- RET
-
-TEXT ·socketcall(SB),NOSPLIT,$0-36
- JMP syscall·socketcall(SB)
-
-TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
- JMP syscall·rawsocketcall(SB)
-
-TEXT ·seek(SB),NOSPLIT,$0-28
- JMP syscall·seek(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_linux_amd64.s b/src/vendor/golang.org/x/sys/unix/asm_linux_amd64.s
deleted file mode 100644
index c6468a9588..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_linux_amd64.s
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2009 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for AMD64, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- CALL runtime·entersyscall(SB)
- MOVQ a1+8(FP), DI
- MOVQ a2+16(FP), SI
- MOVQ a3+24(FP), DX
- MOVQ $0, R10
- MOVQ $0, R8
- MOVQ $0, R9
- MOVQ trap+0(FP), AX // syscall entry
- SYSCALL
- MOVQ AX, r1+32(FP)
- MOVQ DX, r2+40(FP)
- CALL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVQ a1+8(FP), DI
- MOVQ a2+16(FP), SI
- MOVQ a3+24(FP), DX
- MOVQ $0, R10
- MOVQ $0, R8
- MOVQ $0, R9
- MOVQ trap+0(FP), AX // syscall entry
- SYSCALL
- MOVQ AX, r1+32(FP)
- MOVQ DX, r2+40(FP)
- RET
-
-TEXT ·gettimeofday(SB),NOSPLIT,$0-16
- JMP syscall·gettimeofday(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_linux_arm.s b/src/vendor/golang.org/x/sys/unix/asm_linux_arm.s
deleted file mode 100644
index cf0f3575c1..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_linux_arm.s
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2009 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for arm, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
- BL runtime·entersyscall(SB)
- MOVW trap+0(FP), R7
- MOVW a1+4(FP), R0
- MOVW a2+8(FP), R1
- MOVW a3+12(FP), R2
- MOVW $0, R3
- MOVW $0, R4
- MOVW $0, R5
- SWI $0
- MOVW R0, r1+16(FP)
- MOVW $0, R0
- MOVW R0, r2+20(FP)
- BL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
- MOVW trap+0(FP), R7 // syscall entry
- MOVW a1+4(FP), R0
- MOVW a2+8(FP), R1
- MOVW a3+12(FP), R2
- SWI $0
- MOVW R0, r1+16(FP)
- MOVW $0, R0
- MOVW R0, r2+20(FP)
- RET
-
-TEXT ·seek(SB),NOSPLIT,$0-28
- B syscall·seek(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_linux_arm64.s b/src/vendor/golang.org/x/sys/unix/asm_linux_arm64.s
deleted file mode 100644
index afe6fdf6b1..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_linux_arm64.s
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2015 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.
-
-// +build linux
-// +build arm64
-// +build !gccgo
-
-#include "textflag.h"
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- B syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- BL runtime·entersyscall(SB)
- MOVD a1+8(FP), R0
- MOVD a2+16(FP), R1
- MOVD a3+24(FP), R2
- MOVD $0, R3
- MOVD $0, R4
- MOVD $0, R5
- MOVD trap+0(FP), R8 // syscall entry
- SVC
- MOVD R0, r1+32(FP) // r1
- MOVD R1, r2+40(FP) // r2
- BL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- B syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVD a1+8(FP), R0
- MOVD a2+16(FP), R1
- MOVD a3+24(FP), R2
- MOVD $0, R3
- MOVD $0, R4
- MOVD $0, R5
- MOVD trap+0(FP), R8 // syscall entry
- SVC
- MOVD R0, r1+32(FP)
- MOVD R1, r2+40(FP)
- RET
diff --git a/src/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s b/src/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
deleted file mode 100644
index ab9d63831a..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2015 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.
-
-// +build linux
-// +build mips64 mips64le
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for mips64, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- JAL runtime·entersyscall(SB)
- MOVV a1+8(FP), R4
- MOVV a2+16(FP), R5
- MOVV a3+24(FP), R6
- MOVV R0, R7
- MOVV R0, R8
- MOVV R0, R9
- MOVV trap+0(FP), R2 // syscall entry
- SYSCALL
- MOVV R2, r1+32(FP)
- MOVV R3, r2+40(FP)
- JAL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVV a1+8(FP), R4
- MOVV a2+16(FP), R5
- MOVV a3+24(FP), R6
- MOVV R0, R7
- MOVV R0, R8
- MOVV R0, R9
- MOVV trap+0(FP), R2 // syscall entry
- SYSCALL
- MOVV R2, r1+32(FP)
- MOVV R3, r2+40(FP)
- RET
diff --git a/src/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s b/src/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
deleted file mode 100644
index 99e5399045..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2016 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.
-
-// +build linux
-// +build mips mipsle
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for mips, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
- JAL runtime·entersyscall(SB)
- MOVW a1+4(FP), R4
- MOVW a2+8(FP), R5
- MOVW a3+12(FP), R6
- MOVW R0, R7
- MOVW trap+0(FP), R2 // syscall entry
- SYSCALL
- MOVW R2, r1+16(FP) // r1
- MOVW R3, r2+20(FP) // r2
- JAL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
- MOVW a1+4(FP), R4
- MOVW a2+8(FP), R5
- MOVW a3+12(FP), R6
- MOVW trap+0(FP), R2 // syscall entry
- SYSCALL
- MOVW R2, r1+16(FP)
- MOVW R3, r2+20(FP)
- RET
diff --git a/src/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s b/src/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
deleted file mode 100644
index 88f7125578..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2014 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.
-
-// +build linux
-// +build ppc64 ppc64le
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for ppc64, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- BL runtime·entersyscall(SB)
- MOVD a1+8(FP), R3
- MOVD a2+16(FP), R4
- MOVD a3+24(FP), R5
- MOVD R0, R6
- MOVD R0, R7
- MOVD R0, R8
- MOVD trap+0(FP), R9 // syscall entry
- SYSCALL R9
- MOVD R3, r1+32(FP)
- MOVD R4, r2+40(FP)
- BL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVD a1+8(FP), R3
- MOVD a2+16(FP), R4
- MOVD a3+24(FP), R5
- MOVD R0, R6
- MOVD R0, R7
- MOVD R0, R8
- MOVD trap+0(FP), R9 // syscall entry
- SYSCALL R9
- MOVD R3, r1+32(FP)
- MOVD R4, r2+40(FP)
- RET
diff --git a/src/vendor/golang.org/x/sys/unix/asm_linux_s390x.s b/src/vendor/golang.org/x/sys/unix/asm_linux_s390x.s
deleted file mode 100644
index a5a863c6bd..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_linux_s390x.s
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2016 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.
-
-// +build s390x
-// +build linux
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for s390x, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- BR syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- BR syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- BL runtime·entersyscall(SB)
- MOVD a1+8(FP), R2
- MOVD a2+16(FP), R3
- MOVD a3+24(FP), R4
- MOVD $0, R5
- MOVD $0, R6
- MOVD $0, R7
- MOVD trap+0(FP), R1 // syscall entry
- SYSCALL
- MOVD R2, r1+32(FP)
- MOVD R3, r2+40(FP)
- BL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- BR syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- BR syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVD a1+8(FP), R2
- MOVD a2+16(FP), R3
- MOVD a3+24(FP), R4
- MOVD $0, R5
- MOVD $0, R6
- MOVD $0, R7
- MOVD trap+0(FP), R1 // syscall entry
- SYSCALL
- MOVD R2, r1+32(FP)
- MOVD R3, r2+40(FP)
- RET
diff --git a/src/vendor/golang.org/x/sys/unix/asm_netbsd_386.s b/src/vendor/golang.org/x/sys/unix/asm_netbsd_386.s
deleted file mode 100644
index 48bdcd7632..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_netbsd_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s b/src/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s
deleted file mode 100644
index 2ede05c72f..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s b/src/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s
deleted file mode 100644
index e8928571c4..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2013 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s b/src/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
deleted file mode 100644
index 6f98ba5a37..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2019 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM64, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- B syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_openbsd_386.s b/src/vendor/golang.org/x/sys/unix/asm_openbsd_386.s
deleted file mode 100644
index 00576f3c83..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_openbsd_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s b/src/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
deleted file mode 100644
index 790ef77f86..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s b/src/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
deleted file mode 100644
index 469bfa1003..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2017 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s b/src/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s
deleted file mode 100644
index 0cedea3d39..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2019 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for arm64, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s b/src/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
deleted file mode 100644
index ded8260f3e..0000000000
--- a/src/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2014 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.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go
-//
-
-TEXT ·sysvicall6(SB),NOSPLIT,$0-88
- JMP syscall·sysvicall6(SB)
-
-TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88
- JMP syscall·rawSysvicall6(SB)
diff --git a/src/vendor/golang.org/x/sys/unix/bluetooth_linux.go b/src/vendor/golang.org/x/sys/unix/bluetooth_linux.go
deleted file mode 100644
index 6e32296970..0000000000
--- a/src/vendor/golang.org/x/sys/unix/bluetooth_linux.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2016 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.
-
-// Bluetooth sockets and messages
-
-package unix
-
-// Bluetooth Protocols
-const (
- BTPROTO_L2CAP = 0
- BTPROTO_HCI = 1
- BTPROTO_SCO = 2
- BTPROTO_RFCOMM = 3
- BTPROTO_BNEP = 4
- BTPROTO_CMTP = 5
- BTPROTO_HIDP = 6
- BTPROTO_AVDTP = 7
-)
-
-const (
- HCI_CHANNEL_RAW = 0
- HCI_CHANNEL_USER = 1
- HCI_CHANNEL_MONITOR = 2
- HCI_CHANNEL_CONTROL = 3
-)
-
-// Socketoption Level
-const (
- SOL_BLUETOOTH = 0x112
- SOL_HCI = 0x0
- SOL_L2CAP = 0x6
- SOL_RFCOMM = 0x12
- SOL_SCO = 0x11
-)
diff --git a/src/vendor/golang.org/x/sys/unix/cap_freebsd.go b/src/vendor/golang.org/x/sys/unix/cap_freebsd.go
deleted file mode 100644
index df52048773..0000000000
--- a/src/vendor/golang.org/x/sys/unix/cap_freebsd.go
+++ /dev/null
@@ -1,195 +0,0 @@
-// Copyright 2017 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.
-
-// +build freebsd
-
-package unix
-
-import (
- "errors"
- "fmt"
-)
-
-// Go implementation of C mostly found in /usr/src/sys/kern/subr_capability.c
-
-const (
- // This is the version of CapRights this package understands. See C implementation for parallels.
- capRightsGoVersion = CAP_RIGHTS_VERSION_00
- capArSizeMin = CAP_RIGHTS_VERSION_00 + 2
- capArSizeMax = capRightsGoVersion + 2
-)
-
-var (
- bit2idx = []int{
- -1, 0, 1, -1, 2, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1,
- 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- }
-)
-
-func capidxbit(right uint64) int {
- return int((right >> 57) & 0x1f)
-}
-
-func rightToIndex(right uint64) (int, error) {
- idx := capidxbit(right)
- if idx < 0 || idx >= len(bit2idx) {
- return -2, fmt.Errorf("index for right 0x%x out of range", right)
- }
- return bit2idx[idx], nil
-}
-
-func caprver(right uint64) int {
- return int(right >> 62)
-}
-
-func capver(rights *CapRights) int {
- return caprver(rights.Rights[0])
-}
-
-func caparsize(rights *CapRights) int {
- return capver(rights) + 2
-}
-
-// CapRightsSet sets the permissions in setrights in rights.
-func CapRightsSet(rights *CapRights, setrights []uint64) error {
- // This is essentially a copy of cap_rights_vset()
- if capver(rights) != CAP_RIGHTS_VERSION_00 {
- return fmt.Errorf("bad rights version %d", capver(rights))
- }
-
- n := caparsize(rights)
- if n < capArSizeMin || n > capArSizeMax {
- return errors.New("bad rights size")
- }
-
- for _, right := range setrights {
- if caprver(right) != CAP_RIGHTS_VERSION_00 {
- return errors.New("bad right version")
- }
- i, err := rightToIndex(right)
- if err != nil {
- return err
- }
- if i >= n {
- return errors.New("index overflow")
- }
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return errors.New("index mismatch")
- }
- rights.Rights[i] |= right
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return errors.New("index mismatch (after assign)")
- }
- }
-
- return nil
-}
-
-// CapRightsClear clears the permissions in clearrights from rights.
-func CapRightsClear(rights *CapRights, clearrights []uint64) error {
- // This is essentially a copy of cap_rights_vclear()
- if capver(rights) != CAP_RIGHTS_VERSION_00 {
- return fmt.Errorf("bad rights version %d", capver(rights))
- }
-
- n := caparsize(rights)
- if n < capArSizeMin || n > capArSizeMax {
- return errors.New("bad rights size")
- }
-
- for _, right := range clearrights {
- if caprver(right) != CAP_RIGHTS_VERSION_00 {
- return errors.New("bad right version")
- }
- i, err := rightToIndex(right)
- if err != nil {
- return err
- }
- if i >= n {
- return errors.New("index overflow")
- }
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return errors.New("index mismatch")
- }
- rights.Rights[i] &= ^(right & 0x01FFFFFFFFFFFFFF)
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return errors.New("index mismatch (after assign)")
- }
- }
-
- return nil
-}
-
-// CapRightsIsSet checks whether all the permissions in setrights are present in rights.
-func CapRightsIsSet(rights *CapRights, setrights []uint64) (bool, error) {
- // This is essentially a copy of cap_rights_is_vset()
- if capver(rights) != CAP_RIGHTS_VERSION_00 {
- return false, fmt.Errorf("bad rights version %d", capver(rights))
- }
-
- n := caparsize(rights)
- if n < capArSizeMin || n > capArSizeMax {
- return false, errors.New("bad rights size")
- }
-
- for _, right := range setrights {
- if caprver(right) != CAP_RIGHTS_VERSION_00 {
- return false, errors.New("bad right version")
- }
- i, err := rightToIndex(right)
- if err != nil {
- return false, err
- }
- if i >= n {
- return false, errors.New("index overflow")
- }
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return false, errors.New("index mismatch")
- }
- if (rights.Rights[i] & right) != right {
- return false, nil
- }
- }
-
- return true, nil
-}
-
-func capright(idx uint64, bit uint64) uint64 {
- return ((1 << (57 + idx)) | bit)
-}
-
-// CapRightsInit returns a pointer to an initialised CapRights structure filled with rights.
-// See man cap_rights_init(3) and rights(4).
-func CapRightsInit(rights []uint64) (*CapRights, error) {
- var r CapRights
- r.Rights[0] = (capRightsGoVersion << 62) | capright(0, 0)
- r.Rights[1] = capright(1, 0)
-
- err := CapRightsSet(&r, rights)
- if err != nil {
- return nil, err
- }
- return &r, nil
-}
-
-// CapRightsLimit reduces the operations permitted on fd to at most those contained in rights.
-// The capability rights on fd can never be increased by CapRightsLimit.
-// See man cap_rights_limit(2) and rights(4).
-func CapRightsLimit(fd uintptr, rights *CapRights) error {
- return capRightsLimit(int(fd), rights)
-}
-
-// CapRightsGet returns a CapRights structure containing the operations permitted on fd.
-// See man cap_rights_get(3) and rights(4).
-func CapRightsGet(fd uintptr) (*CapRights, error) {
- r, err := CapRightsInit(nil)
- if err != nil {
- return nil, err
- }
- err = capRightsGet(capRightsGoVersion, int(fd), r)
- if err != nil {
- return nil, err
- }
- return r, nil
-}
diff --git a/src/vendor/golang.org/x/sys/unix/constants.go b/src/vendor/golang.org/x/sys/unix/constants.go
deleted file mode 100644
index 3a6ac648dd..0000000000
--- a/src/vendor/golang.org/x/sys/unix/constants.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2015 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.
-
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-const (
- R_OK = 0x4
- W_OK = 0x2
- X_OK = 0x1
-)
diff --git a/src/vendor/golang.org/x/sys/unix/dev_aix_ppc.go b/src/vendor/golang.org/x/sys/unix/dev_aix_ppc.go
deleted file mode 100644
index 5e5fb45104..0000000000
--- a/src/vendor/golang.org/x/sys/unix/dev_aix_ppc.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2018 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.
-
-// +build aix
-// +build ppc
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used by AIX.
-
-package unix
-
-// Major returns the major component of a Linux device number.
-func Major(dev uint64) uint32 {
- return uint32((dev >> 16) & 0xffff)
-}
-
-// Minor returns the minor component of a Linux device number.
-func Minor(dev uint64) uint32 {
- return uint32(dev & 0xffff)
-}
-
-// Mkdev returns a Linux device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- return uint64(((major) << 16) | (minor))
-}
diff --git a/src/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go b/src/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
deleted file mode 100644
index 8b401244c4..0000000000
--- a/src/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2018 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.
-
-// +build aix
-// +build ppc64
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used AIX.
-
-package unix
-
-// Major returns the major component of a Linux device number.
-func Major(dev uint64) uint32 {
- return uint32((dev & 0x3fffffff00000000) >> 32)
-}
-
-// Minor returns the minor component of a Linux device number.
-func Minor(dev uint64) uint32 {
- return uint32((dev & 0x00000000ffffffff) >> 0)
-}
-
-// Mkdev returns a Linux device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- var DEVNO64 uint64
- DEVNO64 = 0x8000000000000000
- return ((uint64(major) << 32) | (uint64(minor) & 0x00000000FFFFFFFF) | DEVNO64)
-}
diff --git a/src/vendor/golang.org/x/sys/unix/dev_darwin.go b/src/vendor/golang.org/x/sys/unix/dev_darwin.go
deleted file mode 100644
index 8d1dc0fa3d..0000000000
--- a/src/vendor/golang.org/x/sys/unix/dev_darwin.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2017 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.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in Darwin's sys/types.h header.
-
-package unix
-
-// Major returns the major component of a Darwin device number.
-func Major(dev uint64) uint32 {
- return uint32((dev >> 24) & 0xff)
-}
-
-// Minor returns the minor component of a Darwin device number.
-func Minor(dev uint64) uint32 {
- return uint32(dev & 0xffffff)
-}
-
-// Mkdev returns a Darwin device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- return (uint64(major) << 24) | uint64(minor)
-}
diff --git a/src/vendor/golang.org/x/sys/unix/dev_dragonfly.go b/src/vendor/golang.org/x/sys/unix/dev_dragonfly.go
deleted file mode 100644
index 8502f202ce..0000000000
--- a/src/vendor/golang.org/x/sys/unix/dev_dragonfly.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2017 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.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in Dragonfly's sys/types.h header.
-//
-// The information below is extracted and adapted from sys/types.h:
-//
-// Minor gives a cookie instead of an index since in order to avoid changing the
-// meanings of bits 0-15 or wasting time and space shifting bits 16-31 for
-// devices that don't use them.
-
-package unix
-
-// Major returns the major component of a DragonFlyBSD device number.
-func Major(dev uint64) uint32 {
- return uint32((dev >> 8) & 0xff)
-}
-
-// Minor returns the minor component of a DragonFlyBSD device number.
-func Minor(dev uint64) uint32 {
- return uint32(dev & 0xffff00ff)
-}
-
-// Mkdev returns a DragonFlyBSD device number generated from the given major and
-// minor components.
-func Mkdev(major, minor uint32) uint64 {
- return (uint64(major) << 8) | uint64(minor)
-}
diff --git a/src/vendor/golang.org/x/sys/unix/dev_freebsd.go b/src/vendor/golang.org/x/sys/unix/dev_freebsd.go
deleted file mode 100644
index eba3b4bd38..0000000000
--- a/src/vendor/golang.org/x/sys/unix/dev_freebsd.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2017 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.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in FreeBSD's sys/types.h header.
-//
-// The information below is extracted and adapted from sys/types.h:
-//
-// Minor gives a cookie instead of an index since in order to avoid changing the
-// meanings of bits 0-15 or wasting time and space shifting bits 16-31 for
-// devices that don't use them.
-
-package unix
-
-// Major returns the major component of a FreeBSD device number.
-func Major(dev uint64) uint32 {
- return uint32((dev >> 8) & 0xff)
-}
-
-// Minor returns the minor component of a FreeBSD device number.
-func Minor(dev uint64) uint32 {
- return uint32(dev & 0xffff00ff)
-}
-
-// Mkdev returns a FreeBSD device number generated from the given major and
-// minor components.
-func Mkdev(major, minor uint32) uint64 {
- return (uint64(major) << 8) | uint64(minor)
-}
diff --git a/src/vendor/golang.org/x/sys/unix/dev_linux.go b/src/vendor/golang.org/x/sys/unix/dev_linux.go
deleted file mode 100644
index d165d6f308..0000000000
--- a/src/vendor/golang.org/x/sys/unix/dev_linux.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2017 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.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used by the Linux kernel and glibc.
-//
-// The information below is extracted and adapted from bits/sysmacros.h in the
-// glibc sources:
-//
-// dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's
-// default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major
-// number and m is a hex digit of the minor number. This is backward compatible
-// with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also
-// backward compatible with the Linux kernel, which for some architectures uses
-// 32-bit dev_t, encoded as mmmM MMmm.
-
-package unix
-
-// Major returns the major component of a Linux device number.
-func Major(dev uint64) uint32 {
- major := uint32((dev & 0x00000000000fff00) >> 8)
- major |= uint32((dev & 0xfffff00000000000) >> 32)
- return major
-}
-
-// Minor returns the minor component of a Linux device number.
-func Minor(dev uint64) uint32 {
- minor := uint32((dev & 0x00000000000000ff) >> 0)
- minor |= uint32((dev & 0x00000ffffff00000) >> 12)
- return minor
-}
-
-// Mkdev returns a Linux device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- dev := (uint64(major) & 0x00000fff) << 8
- dev |= (uint64(major) & 0xfffff000) << 32
- dev |= (uint64(minor) & 0x000000ff) << 0
- dev |= (uint64(minor) & 0xffffff00) << 12
- return dev
-}
diff --git a/src/vendor/golang.org/x/sys/unix/dev_netbsd.go b/src/vendor/golang.org/x/sys/unix/dev_netbsd.go
deleted file mode 100644
index b4a203d0c5..0000000000
--- a/src/vendor/golang.org/x/sys/unix/dev_netbsd.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2017 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.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in NetBSD's sys/types.h header.
-
-package unix
-
-// Major returns the major component of a NetBSD device number.
-func Major(dev uint64) uint32 {
- return uint32((dev & 0x000fff00) >> 8)
-}
-
-// Minor returns the minor component of a NetBSD device number.
-func Minor(dev uint64) uint32 {
- minor := uint32((dev & 0x000000ff) >> 0)
- minor |= uint32((dev & 0xfff00000) >> 12)
- return minor
-}
-
-// Mkdev returns a NetBSD device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- dev := (uint64(major) << 8) & 0x000fff00
- dev |= (uint64(minor) << 12) & 0xfff00000
- dev |= (uint64(minor) << 0) & 0x000000ff
- return dev
-}
diff --git a/src/vendor/golang.org/x/sys/unix/dev_openbsd.go b/src/vendor/golang.org/x/sys/unix/dev_openbsd.go
deleted file mode 100644
index f3430c42ff..0000000000
--- a/src/vendor/golang.org/x/sys/unix/dev_openbsd.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2017 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.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in OpenBSD's sys/types.h header.
-
-package unix
-
-// Major returns the major component of an OpenBSD device number.
-func Major(dev uint64) uint32 {
- return uint32((dev & 0x0000ff00) >> 8)
-}
-
-// Minor returns the minor component of an OpenBSD device number.
-func Minor(dev uint64) uint32 {
- minor := uint32((dev & 0x000000ff) >> 0)
- minor |= uint32((dev & 0xffff0000) >> 8)
- return minor
-}
-
-// Mkdev returns an OpenBSD device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- dev := (uint64(major) << 8) & 0x0000ff00
- dev |= (uint64(minor) << 8) & 0xffff0000
- dev |= (uint64(minor) << 0) & 0x000000ff
- return dev
-}
diff --git a/src/vendor/golang.org/x/sys/unix/dirent.go b/src/vendor/golang.org/x/sys/unix/dirent.go
deleted file mode 100644
index 4407c505a3..0000000000
--- a/src/vendor/golang.org/x/sys/unix/dirent.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2009 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.
-
-// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris
-
-package unix
-
-import "syscall"
-
-// ParseDirent parses up to max directory entries in buf,
-// appending the names to names. It returns the number of
-// bytes consumed from buf, the number of entries added
-// to names, and the new names slice.
-func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) {
- return syscall.ParseDirent(buf, max, names)
-}
diff --git a/src/vendor/golang.org/x/sys/unix/endian_big.go b/src/vendor/golang.org/x/sys/unix/endian_big.go
deleted file mode 100644
index 5e9269063f..0000000000
--- a/src/vendor/golang.org/x/sys/unix/endian_big.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2016 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.
-//
-// +build ppc64 s390x mips mips64
-
-package unix
-
-const isBigEndian = true
diff --git a/src/vendor/golang.org/x/sys/unix/endian_little.go b/src/vendor/golang.org/x/sys/unix/endian_little.go
deleted file mode 100644
index 085df2d8dd..0000000000
--- a/src/vendor/golang.org/x/sys/unix/endian_little.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2016 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.
-//
-// +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le
-
-package unix
-
-const isBigEndian = false
diff --git a/src/vendor/golang.org/x/sys/unix/env_unix.go b/src/vendor/golang.org/x/sys/unix/env_unix.go
deleted file mode 100644
index 84178b0a13..0000000000
--- a/src/vendor/golang.org/x/sys/unix/env_unix.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2010 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.
-
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-
-// Unix environment variables.
-
-package unix
-
-import "syscall"
-
-func Getenv(key string) (value string, found bool) {
- return syscall.Getenv(key)
-}
-
-func Setenv(key, value string) error {
- return syscall.Setenv(key, value)
-}
-
-func Clearenv() {
- syscall.Clearenv()
-}
-
-func Environ() []string {
- return syscall.Environ()
-}
-
-func Unsetenv(key string) error {
- return syscall.Unsetenv(key)
-}
diff --git a/src/vendor/golang.org/x/sys/unix/errors_freebsd_386.go b/src/vendor/golang.org/x/sys/unix/errors_freebsd_386.go
deleted file mode 100644
index c56bc8b05e..0000000000
--- a/src/vendor/golang.org/x/sys/unix/errors_freebsd_386.go
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright 2017 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.
-
-// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
-// them here for backwards compatibility.
-
-package unix
-
-const (
- IFF_SMART = 0x20
- IFT_1822 = 0x2
- IFT_A12MPPSWITCH = 0x82
- IFT_AAL2 = 0xbb
- IFT_AAL5 = 0x31
- IFT_ADSL = 0x5e
- IFT_AFLANE8023 = 0x3b
- IFT_AFLANE8025 = 0x3c
- IFT_ARAP = 0x58
- IFT_ARCNET = 0x23
- IFT_ARCNETPLUS = 0x24
- IFT_ASYNC = 0x54
- IFT_ATM = 0x25
- IFT_ATMDXI = 0x69
- IFT_ATMFUNI = 0x6a
- IFT_ATMIMA = 0x6b
- IFT_ATMLOGICAL = 0x50
- IFT_ATMRADIO = 0xbd
- IFT_ATMSUBINTERFACE = 0x86
- IFT_ATMVCIENDPT = 0xc2
- IFT_ATMVIRTUAL = 0x95
- IFT_BGPPOLICYACCOUNTING = 0xa2
- IFT_BSC = 0x53
- IFT_CCTEMUL = 0x3d
- IFT_CEPT = 0x13
- IFT_CES = 0x85
- IFT_CHANNEL = 0x46
- IFT_CNR = 0x55
- IFT_COFFEE = 0x84
- IFT_COMPOSITELINK = 0x9b
- IFT_DCN = 0x8d
- IFT_DIGITALPOWERLINE = 0x8a
- IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
- IFT_DLSW = 0x4a
- IFT_DOCSCABLEDOWNSTREAM = 0x80
- IFT_DOCSCABLEMACLAYER = 0x7f
- IFT_DOCSCABLEUPSTREAM = 0x81
- IFT_DS0 = 0x51
- IFT_DS0BUNDLE = 0x52
- IFT_DS1FDL = 0xaa
- IFT_DS3 = 0x1e
- IFT_DTM = 0x8c
- IFT_DVBASILN = 0xac
- IFT_DVBASIOUT = 0xad
- IFT_DVBRCCDOWNSTREAM = 0x93
- IFT_DVBRCCMACLAYER = 0x92
- IFT_DVBRCCUPSTREAM = 0x94
- IFT_ENC = 0xf4
- IFT_EON = 0x19
- IFT_EPLRS = 0x57
- IFT_ESCON = 0x49
- IFT_ETHER = 0x6
- IFT_FAITH = 0xf2
- IFT_FAST = 0x7d
- IFT_FASTETHER = 0x3e
- IFT_FASTETHERFX = 0x45
- IFT_FDDI = 0xf
- IFT_FIBRECHANNEL = 0x38
- IFT_FRAMERELAYINTERCONNECT = 0x3a
- IFT_FRAMERELAYMPI = 0x5c
- IFT_FRDLCIENDPT = 0xc1
- IFT_FRELAY = 0x20
- IFT_FRELAYDCE = 0x2c
- IFT_FRF16MFRBUNDLE = 0xa3
- IFT_FRFORWARD = 0x9e
- IFT_G703AT2MB = 0x43
- IFT_G703AT64K = 0x42
- IFT_GIF = 0xf0
- IFT_GIGABITETHERNET = 0x75
- IFT_GR303IDT = 0xb2
- IFT_GR303RDT = 0xb1
- IFT_H323GATEKEEPER = 0xa4
- IFT_H323PROXY = 0xa5
- IFT_HDH1822 = 0x3
- IFT_HDLC = 0x76
- IFT_HDSL2 = 0xa8
- IFT_HIPERLAN2 = 0xb7
- IFT_HIPPI = 0x2f
- IFT_HIPPIINTERFACE = 0x39
- IFT_HOSTPAD = 0x5a
- IFT_HSSI = 0x2e
- IFT_HY = 0xe
- IFT_IBM370PARCHAN = 0x48
- IFT_IDSL = 0x9a
- IFT_IEEE80211 = 0x47
- IFT_IEEE80212 = 0x37
- IFT_IEEE8023ADLAG = 0xa1
- IFT_IFGSN = 0x91
- IFT_IMT = 0xbe
- IFT_INTERLEAVE = 0x7c
- IFT_IP = 0x7e
- IFT_IPFORWARD = 0x8e
- IFT_IPOVERATM = 0x72
- IFT_IPOVERCDLC = 0x6d
- IFT_IPOVERCLAW = 0x6e
- IFT_IPSWITCH = 0x4e
- IFT_IPXIP = 0xf9
- IFT_ISDN = 0x3f
- IFT_ISDNBASIC = 0x14
- IFT_ISDNPRIMARY = 0x15
- IFT_ISDNS = 0x4b
- IFT_ISDNU = 0x4c
- IFT_ISO88022LLC = 0x29
- IFT_ISO88023 = 0x7
- IFT_ISO88024 = 0x8
- IFT_ISO88025 = 0x9
- IFT_ISO88025CRFPINT = 0x62
- IFT_ISO88025DTR = 0x56
- IFT_ISO88025FIBER = 0x73
- IFT_ISO88026 = 0xa
- IFT_ISUP = 0xb3
- IFT_L3IPXVLAN = 0x89
- IFT_LAPB = 0x10
- IFT_LAPD = 0x4d
- IFT_LAPF = 0x77
- IFT_LOCALTALK = 0x2a
- IFT_LOOP = 0x18
- IFT_MEDIAMAILOVERIP = 0x8b
- IFT_MFSIGLINK = 0xa7
- IFT_MIOX25 = 0x26
- IFT_MODEM = 0x30
- IFT_MPC = 0x71
- IFT_MPLS = 0xa6
- IFT_MPLSTUNNEL = 0x96
- IFT_MSDSL = 0x8f
- IFT_MVL = 0xbf
- IFT_MYRINET = 0x63
- IFT_NFAS = 0xaf
- IFT_NSIP = 0x1b
- IFT_OPTICALCHANNEL = 0xc3
- IFT_OPTICALTRANSPORT = 0xc4
- IFT_OTHER = 0x1
- IFT_P10 = 0xc
- IFT_P80 = 0xd
- IFT_PARA = 0x22
- IFT_PFLOG = 0xf6
- IFT_PFSYNC = 0xf7
- IFT_PLC = 0xae
- IFT_POS = 0xab
- IFT_PPPMULTILINKBUNDLE = 0x6c
- IFT_PROPBWAP2MP = 0xb8
- IFT_PROPCNLS = 0x59
- IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
- IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
- IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
- IFT_PROPMUX = 0x36
- IFT_PROPWIRELESSP2P = 0x9d
- IFT_PTPSERIAL = 0x16
- IFT_PVC = 0xf1
- IFT_QLLC = 0x44
- IFT_RADIOMAC = 0xbc
- IFT_RADSL = 0x5f
- IFT_REACHDSL = 0xc0
- IFT_RFC1483 = 0x9f
- IFT_RS232 = 0x21
- IFT_RSRB = 0x4f
- IFT_SDLC = 0x11
- IFT_SDSL = 0x60
- IFT_SHDSL = 0xa9
- IFT_SIP = 0x1f
- IFT_SLIP = 0x1c
- IFT_SMDSDXI = 0x2b
- IFT_SMDSICIP = 0x34
- IFT_SONET = 0x27
- IFT_SONETOVERHEADCHANNEL = 0xb9
- IFT_SONETPATH = 0x32
- IFT_SONETVT = 0x33
- IFT_SRP = 0x97
- IFT_SS7SIGLINK = 0x9c
- IFT_STACKTOSTACK = 0x6f
- IFT_STARLAN = 0xb
- IFT_STF = 0xd7
- IFT_T1 = 0x12
- IFT_TDLC = 0x74
- IFT_TERMPAD = 0x5b
- IFT_TR008 = 0xb0
- IFT_TRANSPHDLC = 0x7b
- IFT_TUNNEL = 0x83
- IFT_ULTRA = 0x1d
- IFT_USB = 0xa0
- IFT_V11 = 0x40
- IFT_V35 = 0x2d
- IFT_V36 = 0x41
- IFT_V37 = 0x78
- IFT_VDSL = 0x61
- IFT_VIRTUALIPADDRESS = 0x70
- IFT_VOICEEM = 0x64
- IFT_VOICEENCAP = 0x67
- IFT_VOICEFXO = 0x65
- IFT_VOICEFXS = 0x66
- IFT_VOICEOVERATM = 0x98
- IFT_VOICEOVERFRAMERELAY = 0x99
- IFT_VOICEOVERIP = 0x68
- IFT_X213 = 0x5d
- IFT_X25 = 0x5
- IFT_X25DDN = 0x4
- IFT_X25HUNTGROUP = 0x7a
- IFT_X25MLP = 0x79
- IFT_X25PLE = 0x28
- IFT_XETHER = 0x1a
- IPPROTO_MAXID = 0x34
- IPV6_FAITH = 0x1d
- IP_FAITH = 0x16
- MAP_NORESERVE = 0x40
- MAP_RENAME = 0x20
- NET_RT_MAXID = 0x6
- RTF_PRCLONING = 0x10000
- RTM_OLDADD = 0x9
- RTM_OLDDEL = 0xa
- SIOCADDRT = 0x8030720a
- SIOCALIFADDR = 0x8118691b
- SIOCDELRT = 0x8030720b
- SIOCDLIFADDR = 0x8118691d
- SIOCGLIFADDR = 0xc118691c
- SIOCGLIFPHYADDR = 0xc118694b
- SIOCSLIFPHYADDR = 0x8118694a
-)
diff --git a/src/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go b/src/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go
deleted file mode 100644
index 3e9771175a..0000000000
--- a/src/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright 2017 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.
-
-// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
-// them here for backwards compatibility.
-
-package unix
-
-const (
- IFF_SMART = 0x20
- IFT_1822 = 0x2
- IFT_A12MPPSWITCH = 0x82
- IFT_AAL2 = 0xbb
- IFT_AAL5 = 0x31
- IFT_ADSL = 0x5e
- IFT_AFLANE8023 = 0x3b
- IFT_AFLANE8025 = 0x3c
- IFT_ARAP = 0x58
- IFT_ARCNET = 0x23
- IFT_ARCNETPLUS = 0x24
- IFT_ASYNC = 0x54
- IFT_ATM = 0x25
- IFT_ATMDXI = 0x69
- IFT_ATMFUNI = 0x6a
- IFT_ATMIMA = 0x6b
- IFT_ATMLOGICAL = 0x50
- IFT_ATMRADIO = 0xbd
- IFT_ATMSUBINTERFACE = 0x86
- IFT_ATMVCIENDPT = 0xc2
- IFT_ATMVIRTUAL = 0x95
- IFT_BGPPOLICYACCOUNTING = 0xa2
- IFT_BSC = 0x53
- IFT_CCTEMUL = 0x3d
- IFT_CEPT = 0x13
- IFT_CES = 0x85
- IFT_CHANNEL = 0x46
- IFT_CNR = 0x55
- IFT_COFFEE = 0x84
- IFT_COMPOSITELINK = 0x9b
- IFT_DCN = 0x8d
- IFT_DIGITALPOWERLINE = 0x8a
- IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
- IFT_DLSW = 0x4a
- IFT_DOCSCABLEDOWNSTREAM = 0x80
- IFT_DOCSCABLEMACLAYER = 0x7f
- IFT_DOCSCABLEUPSTREAM = 0x81
- IFT_DS0 = 0x51
- IFT_DS0BUNDLE = 0x52
- IFT_DS1FDL = 0xaa
- IFT_DS3 = 0x1e
- IFT_DTM = 0x8c
- IFT_DVBASILN = 0xac
- IFT_DVBASIOUT = 0xad
- IFT_DVBRCCDOWNSTREAM = 0x93
- IFT_DVBRCCMACLAYER = 0x92
- IFT_DVBRCCUPSTREAM = 0x94
- IFT_ENC = 0xf4
- IFT_EON = 0x19
- IFT_EPLRS = 0x57
- IFT_ESCON = 0x49
- IFT_ETHER = 0x6
- IFT_FAITH = 0xf2
- IFT_FAST = 0x7d
- IFT_FASTETHER = 0x3e
- IFT_FASTETHERFX = 0x45
- IFT_FDDI = 0xf
- IFT_FIBRECHANNEL = 0x38
- IFT_FRAMERELAYINTERCONNECT = 0x3a
- IFT_FRAMERELAYMPI = 0x5c
- IFT_FRDLCIENDPT = 0xc1
- IFT_FRELAY = 0x20
- IFT_FRELAYDCE = 0x2c
- IFT_FRF16MFRBUNDLE = 0xa3
- IFT_FRFORWARD = 0x9e
- IFT_G703AT2MB = 0x43
- IFT_G703AT64K = 0x42
- IFT_GIF = 0xf0
- IFT_GIGABITETHERNET = 0x75
- IFT_GR303IDT = 0xb2
- IFT_GR303RDT = 0xb1
- IFT_H323GATEKEEPER = 0xa4
- IFT_H323PROXY = 0xa5
- IFT_HDH1822 = 0x3
- IFT_HDLC = 0x76
- IFT_HDSL2 = 0xa8
- IFT_HIPERLAN2 = 0xb7
- IFT_HIPPI = 0x2f
- IFT_HIPPIINTERFACE = 0x39
- IFT_HOSTPAD = 0x5a
- IFT_HSSI = 0x2e
- IFT_HY = 0xe
- IFT_IBM370PARCHAN = 0x48
- IFT_IDSL = 0x9a
- IFT_IEEE80211 = 0x47
- IFT_IEEE80212 = 0x37
- IFT_IEEE8023ADLAG = 0xa1
- IFT_IFGSN = 0x91
- IFT_IMT = 0xbe
- IFT_INTERLEAVE = 0x7c
- IFT_IP = 0x7e
- IFT_IPFORWARD = 0x8e
- IFT_IPOVERATM = 0x72
- IFT_IPOVERCDLC = 0x6d
- IFT_IPOVERCLAW = 0x6e
- IFT_IPSWITCH = 0x4e
- IFT_IPXIP = 0xf9
- IFT_ISDN = 0x3f
- IFT_ISDNBASIC = 0x14
- IFT_ISDNPRIMARY = 0x15
- IFT_ISDNS = 0x4b
- IFT_ISDNU = 0x4c
- IFT_ISO88022LLC = 0x29
- IFT_ISO88023 = 0x7
- IFT_ISO88024 = 0x8
- IFT_ISO88025 = 0x9
- IFT_ISO88025CRFPINT = 0x62
- IFT_ISO88025DTR = 0x56
- IFT_ISO88025FIBER = 0x73
- IFT_ISO88026 = 0xa
- IFT_ISUP = 0xb3
- IFT_L3IPXVLAN = 0x89
- IFT_LAPB = 0x10
- IFT_LAPD = 0x4d
- IFT_LAPF = 0x77
- IFT_LOCALTALK = 0x2a
- IFT_LOOP = 0x18
- IFT_MEDIAMAILOVERIP = 0x8b
- IFT_MFSIGLINK = 0xa7
- IFT_MIOX25 = 0x26
- IFT_MODEM = 0x30
- IFT_MPC = 0x71
- IFT_MPLS = 0xa6
- IFT_MPLSTUNNEL = 0x96
- IFT_MSDSL = 0x8f
- IFT_MVL = 0xbf
- IFT_MYRINET = 0x63
- IFT_NFAS = 0xaf
- IFT_NSIP = 0x1b
- IFT_OPTICALCHANNEL = 0xc3
- IFT_OPTICALTRANSPORT = 0xc4
- IFT_OTHER = 0x1
- IFT_P10 = 0xc
- IFT_P80 = 0xd
- IFT_PARA = 0x22
- IFT_PFLOG = 0xf6
- IFT_PFSYNC = 0xf7
- IFT_PLC = 0xae
- IFT_POS = 0xab
- IFT_PPPMULTILINKBUNDLE = 0x6c
- IFT_PROPBWAP2MP = 0xb8
- IFT_PROPCNLS = 0x59
- IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
- IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
- IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
- IFT_PROPMUX = 0x36
- IFT_PROPWIRELESSP2P = 0x9d
- IFT_PTPSERIAL = 0x16
- IFT_PVC = 0xf1
- IFT_QLLC = 0x44
- IFT_RADIOMAC = 0xbc
- IFT_RADSL = 0x5f
- IFT_REACHDSL = 0xc0
- IFT_RFC1483 = 0x9f
- IFT_RS232 = 0x21
- IFT_RSRB = 0x4f
- IFT_SDLC = 0x11
- IFT_SDSL = 0x60
- IFT_SHDSL = 0xa9
- IFT_SIP = 0x1f
- IFT_SLIP = 0x1c
- IFT_SMDSDXI = 0x2b
- IFT_SMDSICIP = 0x34
- IFT_SONET = 0x27
- IFT_SONETOVERHEADCHANNEL = 0xb9
- IFT_SONETPATH = 0x32
- IFT_SONETVT = 0x33
- IFT_SRP = 0x97
- IFT_SS7SIGLINK = 0x9c
- IFT_STACKTOSTACK = 0x6f
- IFT_STARLAN = 0xb
- IFT_STF = 0xd7
- IFT_T1 = 0x12
- IFT_TDLC = 0x74
- IFT_TERMPAD = 0x5b
- IFT_TR008 = 0xb0
- IFT_TRANSPHDLC = 0x7b
- IFT_TUNNEL = 0x83
- IFT_ULTRA = 0x1d
- IFT_USB = 0xa0
- IFT_V11 = 0x40
- IFT_V35 = 0x2d
- IFT_V36 = 0x41
- IFT_V37 = 0x78
- IFT_VDSL = 0x61
- IFT_VIRTUALIPADDRESS = 0x70
- IFT_VOICEEM = 0x64
- IFT_VOICEENCAP = 0x67
- IFT_VOICEFXO = 0x65
- IFT_VOICEFXS = 0x66
- IFT_VOICEOVERATM = 0x98
- IFT_VOICEOVERFRAMERELAY = 0x99
- IFT_VOICEOVERIP = 0x68
- IFT_X213 = 0x5d
- IFT_X25 = 0x5
- IFT_X25DDN = 0x4
- IFT_X25HUNTGROUP = 0x7a
- IFT_X25MLP = 0x79
- IFT_X25PLE = 0x28
- IFT_XETHER = 0x1a
- IPPROTO_MAXID = 0x34
- IPV6_FAITH = 0x1d
- IP_FAITH = 0x16
- MAP_NORESERVE = 0x40
- MAP_RENAME = 0x20
- NET_RT_MAXID = 0x6
- RTF_PRCLONING = 0x10000
- RTM_OLDADD = 0x9
- RTM_OLDDEL = 0xa
- SIOCADDRT = 0x8040720a
- SIOCALIFADDR = 0x8118691b
- SIOCDELRT = 0x8040720b
- SIOCDLIFADDR = 0x8118691d
- SIOCGLIFADDR = 0xc118691c
- SIOCGLIFPHYADDR = 0xc118694b
- SIOCSLIFPHYADDR = 0x8118694a
-)
diff --git a/src/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go b/src/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go
deleted file mode 100644
index 856dca3254..0000000000
--- a/src/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go
+++ /dev/null
@@ -1,226 +0,0 @@
-// Copyright 2017 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 unix
-
-const (
- IFT_1822 = 0x2
- IFT_A12MPPSWITCH = 0x82
- IFT_AAL2 = 0xbb
- IFT_AAL5 = 0x31
- IFT_ADSL = 0x5e
- IFT_AFLANE8023 = 0x3b
- IFT_AFLANE8025 = 0x3c
- IFT_ARAP = 0x58
- IFT_ARCNET = 0x23
- IFT_ARCNETPLUS = 0x24
- IFT_ASYNC = 0x54
- IFT_ATM = 0x25
- IFT_ATMDXI = 0x69
- IFT_ATMFUNI = 0x6a
- IFT_ATMIMA = 0x6b
- IFT_ATMLOGICAL = 0x50
- IFT_ATMRADIO = 0xbd
- IFT_ATMSUBINTERFACE = 0x86
- IFT_ATMVCIENDPT = 0xc2
- IFT_ATMVIRTUAL = 0x95
- IFT_BGPPOLICYACCOUNTING = 0xa2
- IFT_BSC = 0x53
- IFT_CCTEMUL = 0x3d
- IFT_CEPT = 0x13
- IFT_CES = 0x85
- IFT_CHANNEL = 0x46
- IFT_CNR = 0x55
- IFT_COFFEE = 0x84
- IFT_COMPOSITELINK = 0x9b
- IFT_DCN = 0x8d
- IFT_DIGITALPOWERLINE = 0x8a
- IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
- IFT_DLSW = 0x4a
- IFT_DOCSCABLEDOWNSTREAM = 0x80
- IFT_DOCSCABLEMACLAYER = 0x7f
- IFT_DOCSCABLEUPSTREAM = 0x81
- IFT_DS0 = 0x51
- IFT_DS0BUNDLE = 0x52
- IFT_DS1FDL = 0xaa
- IFT_DS3 = 0x1e
- IFT_DTM = 0x8c
- IFT_DVBASILN = 0xac
- IFT_DVBASIOUT = 0xad
- IFT_DVBRCCDOWNSTREAM = 0x93
- IFT_DVBRCCMACLAYER = 0x92
- IFT_DVBRCCUPSTREAM = 0x94
- IFT_ENC = 0xf4
- IFT_EON = 0x19
- IFT_EPLRS = 0x57
- IFT_ESCON = 0x49
- IFT_ETHER = 0x6
- IFT_FAST = 0x7d
- IFT_FASTETHER = 0x3e
- IFT_FASTETHERFX = 0x45
- IFT_FDDI = 0xf
- IFT_FIBRECHANNEL = 0x38
- IFT_FRAMERELAYINTERCONNECT = 0x3a
- IFT_FRAMERELAYMPI = 0x5c
- IFT_FRDLCIENDPT = 0xc1
- IFT_FRELAY = 0x20
- IFT_FRELAYDCE = 0x2c
- IFT_FRF16MFRBUNDLE = 0xa3
- IFT_FRFORWARD = 0x9e
- IFT_G703AT2MB = 0x43
- IFT_G703AT64K = 0x42
- IFT_GIF = 0xf0
- IFT_GIGABITETHERNET = 0x75
- IFT_GR303IDT = 0xb2
- IFT_GR303RDT = 0xb1
- IFT_H323GATEKEEPER = 0xa4
- IFT_H323PROXY = 0xa5
- IFT_HDH1822 = 0x3
- IFT_HDLC = 0x76
- IFT_HDSL2 = 0xa8
- IFT_HIPERLAN2 = 0xb7
- IFT_HIPPI = 0x2f
- IFT_HIPPIINTERFACE = 0x39
- IFT_HOSTPAD = 0x5a
- IFT_HSSI = 0x2e
- IFT_HY = 0xe
- IFT_IBM370PARCHAN = 0x48
- IFT_IDSL = 0x9a
- IFT_IEEE80211 = 0x47
- IFT_IEEE80212 = 0x37
- IFT_IEEE8023ADLAG = 0xa1
- IFT_IFGSN = 0x91
- IFT_IMT = 0xbe
- IFT_INTERLEAVE = 0x7c
- IFT_IP = 0x7e
- IFT_IPFORWARD = 0x8e
- IFT_IPOVERATM = 0x72
- IFT_IPOVERCDLC = 0x6d
- IFT_IPOVERCLAW = 0x6e
- IFT_IPSWITCH = 0x4e
- IFT_ISDN = 0x3f
- IFT_ISDNBASIC = 0x14
- IFT_ISDNPRIMARY = 0x15
- IFT_ISDNS = 0x4b
- IFT_ISDNU = 0x4c
- IFT_ISO88022LLC = 0x29
- IFT_ISO88023 = 0x7
- IFT_ISO88024 = 0x8
- IFT_ISO88025 = 0x9
- IFT_ISO88025CRFPINT = 0x62
- IFT_ISO88025DTR = 0x56
- IFT_ISO88025FIBER = 0x73
- IFT_ISO88026 = 0xa
- IFT_ISUP = 0xb3
- IFT_L3IPXVLAN = 0x89
- IFT_LAPB = 0x10
- IFT_LAPD = 0x4d
- IFT_LAPF = 0x77
- IFT_LOCALTALK = 0x2a
- IFT_LOOP = 0x18
- IFT_MEDIAMAILOVERIP = 0x8b
- IFT_MFSIGLINK = 0xa7
- IFT_MIOX25 = 0x26
- IFT_MODEM = 0x30
- IFT_MPC = 0x71
- IFT_MPLS = 0xa6
- IFT_MPLSTUNNEL = 0x96
- IFT_MSDSL = 0x8f
- IFT_MVL = 0xbf
- IFT_MYRINET = 0x63
- IFT_NFAS = 0xaf
- IFT_NSIP = 0x1b
- IFT_OPTICALCHANNEL = 0xc3
- IFT_OPTICALTRANSPORT = 0xc4
- IFT_OTHER = 0x1
- IFT_P10 = 0xc
- IFT_P80 = 0xd
- IFT_PARA = 0x22
- IFT_PFLOG = 0xf6
- IFT_PFSYNC = 0xf7
- IFT_PLC = 0xae
- IFT_POS = 0xab
- IFT_PPPMULTILINKBUNDLE = 0x6c
- IFT_PROPBWAP2MP = 0xb8
- IFT_PROPCNLS = 0x59
- IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
- IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
- IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
- IFT_PROPMUX = 0x36
- IFT_PROPWIRELESSP2P = 0x9d
- IFT_PTPSERIAL = 0x16
- IFT_PVC = 0xf1
- IFT_QLLC = 0x44
- IFT_RADIOMAC = 0xbc
- IFT_RADSL = 0x5f
- IFT_REACHDSL = 0xc0
- IFT_RFC1483 = 0x9f
- IFT_RS232 = 0x21
- IFT_RSRB = 0x4f
- IFT_SDLC = 0x11
- IFT_SDSL = 0x60
- IFT_SHDSL = 0xa9
- IFT_SIP = 0x1f
- IFT_SLIP = 0x1c
- IFT_SMDSDXI = 0x2b
- IFT_SMDSICIP = 0x34
- IFT_SONET = 0x27
- IFT_SONETOVERHEADCHANNEL = 0xb9
- IFT_SONETPATH = 0x32
- IFT_SONETVT = 0x33
- IFT_SRP = 0x97
- IFT_SS7SIGLINK = 0x9c
- IFT_STACKTOSTACK = 0x6f
- IFT_STARLAN = 0xb
- IFT_STF = 0xd7
- IFT_T1 = 0x12
- IFT_TDLC = 0x74
- IFT_TERMPAD = 0x5b
- IFT_TR008 = 0xb0
- IFT_TRANSPHDLC = 0x7b
- IFT_TUNNEL = 0x83
- IFT_ULTRA = 0x1d
- IFT_USB = 0xa0
- IFT_V11 = 0x40
- IFT_V35 = 0x2d
- IFT_V36 = 0x41
- IFT_V37 = 0x78
- IFT_VDSL = 0x61
- IFT_VIRTUALIPADDRESS = 0x70
- IFT_VOICEEM = 0x64
- IFT_VOICEENCAP = 0x67
- IFT_VOICEFXO = 0x65
- IFT_VOICEFXS = 0x66
- IFT_VOICEOVERATM = 0x98
- IFT_VOICEOVERFRAMERELAY = 0x99
- IFT_VOICEOVERIP = 0x68
- IFT_X213 = 0x5d
- IFT_X25 = 0x5
- IFT_X25DDN = 0x4
- IFT_X25HUNTGROUP = 0x7a
- IFT_X25MLP = 0x79
- IFT_X25PLE = 0x28
- IFT_XETHER = 0x1a
-
- // missing constants on FreeBSD-11.1-RELEASE, copied from old values in ztypes_freebsd_arm.go
- IFF_SMART = 0x20
- IFT_FAITH = 0xf2
- IFT_IPXIP = 0xf9
- IPPROTO_MAXID = 0x34
- IPV6_FAITH = 0x1d
- IP_FAITH = 0x16
- MAP_NORESERVE = 0x40
- MAP_RENAME = 0x20
- NET_RT_MAXID = 0x6
- RTF_PRCLONING = 0x10000
- RTM_OLDADD = 0x9
- RTM_OLDDEL = 0xa
- SIOCADDRT = 0x8030720a
- SIOCALIFADDR = 0x8118691b
- SIOCDELRT = 0x8030720b
- SIOCDLIFADDR = 0x8118691d
- SIOCGLIFADDR = 0xc118691c
- SIOCGLIFPHYADDR = 0xc118694b
- SIOCSLIFPHYADDR = 0x8118694a
-)
diff --git a/src/vendor/golang.org/x/sys/unix/fcntl.go b/src/vendor/golang.org/x/sys/unix/fcntl.go
deleted file mode 100644
index 39c03f1ef1..0000000000
--- a/src/vendor/golang.org/x/sys/unix/fcntl.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2014 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.
-
-// +build dragonfly freebsd linux netbsd openbsd
-
-package unix
-
-import "unsafe"
-
-// fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux
-// systems by flock_linux_32bit.go to be SYS_FCNTL64.
-var fcntl64Syscall uintptr = SYS_FCNTL
-
-// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
-func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
- valptr, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(arg))
- var err error
- if errno != 0 {
- err = errno
- }
- return int(valptr), err
-}
-
-// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
-func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
- _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk)))
- if errno == 0 {
- return nil
- }
- return errno
-}
diff --git a/src/vendor/golang.org/x/sys/unix/fcntl_darwin.go b/src/vendor/golang.org/x/sys/unix/fcntl_darwin.go
deleted file mode 100644
index 5868a4a47b..0000000000
--- a/src/vendor/golang.org/x/sys/unix/fcntl_darwin.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2019 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 unix
-
-import "unsafe"
-
-// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
-func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
- return fcntl(int(fd), cmd, arg)
-}
-
-// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
-func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
- _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk))))
- return err
-}
diff --git a/src/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go b/src/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
deleted file mode 100644
index fc0e50e037..0000000000
--- a/src/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build linux,386 linux,arm linux,mips linux,mipsle
-
-// Copyright 2014 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 unix
-
-func init() {
- // On 32-bit Linux systems, the fcntl syscall that matches Go's
- // Flock_t type is SYS_FCNTL64, not SYS_FCNTL.
- fcntl64Syscall = SYS_FCNTL64
-}
diff --git a/src/vendor/golang.org/x/sys/unix/gccgo.go b/src/vendor/golang.org/x/sys/unix/gccgo.go
deleted file mode 100644
index cd6f5a6133..0000000000
--- a/src/vendor/golang.org/x/sys/unix/gccgo.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2015 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.
-
-// +build gccgo
-// +build !aix
-
-package unix
-
-import "syscall"
-
-// We can't use the gc-syntax .s files for gccgo. On the plus side
-// much of the functionality can be written directly in Go.
-
-//extern gccgoRealSyscallNoError
-func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
-
-//extern gccgoRealSyscall
-func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
-
-func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
- syscall.Entersyscall()
- r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
- syscall.Exitsyscall()
- return r, 0
-}
-
-func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- syscall.Entersyscall()
- r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
- syscall.Exitsyscall()
- return r, 0, syscall.Errno(errno)
-}
-
-func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- syscall.Entersyscall()
- r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
- syscall.Exitsyscall()
- return r, 0, syscall.Errno(errno)
-}
-
-func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- syscall.Entersyscall()
- r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9)
- syscall.Exitsyscall()
- return r, 0, syscall.Errno(errno)
-}
-
-func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
- r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
- return r, 0
-}
-
-func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
- return r, 0, syscall.Errno(errno)
-}
-
-func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
- return r, 0, syscall.Errno(errno)
-}
diff --git a/src/vendor/golang.org/x/sys/unix/gccgo_c.c b/src/vendor/golang.org/x/sys/unix/gccgo_c.c
deleted file mode 100644
index c44730c5e9..0000000000
--- a/src/vendor/golang.org/x/sys/unix/gccgo_c.c
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2015 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.
-
-// +build gccgo
-// +build !aix
-
-#include
-#include
-#include
-
-#define _STRINGIFY2_(x) #x
-#define _STRINGIFY_(x) _STRINGIFY2_(x)
-#define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__)
-
-// Call syscall from C code because the gccgo support for calling from
-// Go to C does not support varargs functions.
-
-struct ret {
- uintptr_t r;
- uintptr_t err;
-};
-
-struct ret
-gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
-{
- struct ret r;
-
- errno = 0;
- r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
- r.err = errno;
- return r;
-}
-
-uintptr_t
-gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
-{
- return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
-}
diff --git a/src/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go b/src/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
deleted file mode 100644
index 251a977a81..0000000000
--- a/src/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2015 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.
-
-// +build gccgo,linux,amd64
-
-package unix
-
-import "syscall"
-
-//extern gettimeofday
-func realGettimeofday(*Timeval, *byte) int32
-
-func gettimeofday(tv *Timeval) (err syscall.Errno) {
- r := realGettimeofday(tv, nil)
- if r < 0 {
- return syscall.GetErrno()
- }
- return 0
-}
diff --git a/src/vendor/golang.org/x/sys/unix/ioctl.go b/src/vendor/golang.org/x/sys/unix/ioctl.go
deleted file mode 100644
index f121a8d64b..0000000000
--- a/src/vendor/golang.org/x/sys/unix/ioctl.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2018 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.
-
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-import "runtime"
-
-// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
-//
-// To change fd's window size, the req argument should be TIOCSWINSZ.
-func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
- // TODO: if we get the chance, remove the req parameter and
- // hardcode TIOCSWINSZ.
- err := ioctlSetWinsize(fd, req, value)
- runtime.KeepAlive(value)
- return err
-}
-
-// IoctlSetTermios performs an ioctl on fd with a *Termios.
-//
-// The req value will usually be TCSETA or TIOCSETA.
-func IoctlSetTermios(fd int, req uint, value *Termios) error {
- // TODO: if we get the chance, remove the req parameter.
- err := ioctlSetTermios(fd, req, value)
- runtime.KeepAlive(value)
- return err
-}
diff --git a/src/vendor/golang.org/x/sys/unix/mkall.sh b/src/vendor/golang.org/x/sys/unix/mkall.sh
deleted file mode 100644
index 80d00707bb..0000000000
--- a/src/vendor/golang.org/x/sys/unix/mkall.sh
+++ /dev/null
@@ -1,227 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2009 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.
-
-# This script runs or (given -n) prints suggested commands to generate files for
-# the Architecture/OS specified by the GOARCH and GOOS environment variables.
-# See README.md for more information about how the build system works.
-
-GOOSARCH="${GOOS}_${GOARCH}"
-
-# defaults
-mksyscall="go run mksyscall.go"
-mkerrors="./mkerrors.sh"
-zerrors="zerrors_$GOOSARCH.go"
-mksysctl=""
-zsysctl="zsysctl_$GOOSARCH.go"
-mksysnum=
-mktypes=
-mkasm=
-run="sh"
-cmd=""
-
-case "$1" in
--syscalls)
- for i in zsyscall*go
- do
- # Run the command line that appears in the first line
- # of the generated file to regenerate it.
- sed 1q $i | sed 's;^// ;;' | sh > _$i && gofmt < _$i > $i
- rm _$i
- done
- exit 0
- ;;
--n)
- run="cat"
- cmd="echo"
- shift
-esac
-
-case "$#" in
-0)
- ;;
-*)
- echo 'usage: mkall.sh [-n]' 1>&2
- exit 2
-esac
-
-if [[ "$GOOS" = "linux" ]]; then
- # Use the Docker-based build system
- # Files generated through docker (use $cmd so you can Ctl-C the build or run)
- $cmd docker build --tag generate:$GOOS $GOOS
- $cmd docker run --interactive --tty --volume $(dirname "$(readlink -f "$0")"):/build generate:$GOOS
- exit
-fi
-
-GOOSARCH_in=syscall_$GOOSARCH.go
-case "$GOOSARCH" in
-_* | *_ | _)
- echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
- exit 1
- ;;
-aix_ppc)
- mkerrors="$mkerrors -maix32"
- mksyscall="go run mksyscall_aix_ppc.go -aix"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-aix_ppc64)
- mkerrors="$mkerrors -maix64"
- mksyscall="go run mksyscall_aix_ppc64.go -aix"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-darwin_386)
- mkerrors="$mkerrors -m32"
- mksyscall="go run mksyscall.go -l32"
- mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- mkasm="go run mkasm_darwin.go"
- ;;
-darwin_amd64)
- mkerrors="$mkerrors -m64"
- mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- mkasm="go run mkasm_darwin.go"
- ;;
-darwin_arm)
- mkerrors="$mkerrors"
- mksyscall="go run mksyscall.go -l32"
- mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- mkasm="go run mkasm_darwin.go"
- ;;
-darwin_arm64)
- mkerrors="$mkerrors -m64"
- mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- mkasm="go run mkasm_darwin.go"
- ;;
-dragonfly_amd64)
- mkerrors="$mkerrors -m64"
- mksyscall="go run mksyscall.go -dragonfly"
- mksysnum="go run mksysnum.go 'https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-freebsd_386)
- mkerrors="$mkerrors -m32"
- mksyscall="go run mksyscall.go -l32"
- mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-freebsd_amd64)
- mkerrors="$mkerrors -m64"
- mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-freebsd_arm)
- mkerrors="$mkerrors"
- mksyscall="go run mksyscall.go -l32 -arm"
- mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
- # Let the type of C char be signed for making the bare syscall
- # API consistent across platforms.
- mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
- ;;
-freebsd_arm64)
- mkerrors="$mkerrors -m64"
- mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-netbsd_386)
- mkerrors="$mkerrors -m32"
- mksyscall="go run mksyscall.go -l32 -netbsd"
- mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-netbsd_amd64)
- mkerrors="$mkerrors -m64"
- mksyscall="go run mksyscall.go -netbsd"
- mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-netbsd_arm)
- mkerrors="$mkerrors"
- mksyscall="go run mksyscall.go -l32 -netbsd -arm"
- mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
- # Let the type of C char be signed for making the bare syscall
- # API consistent across platforms.
- mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
- ;;
-netbsd_arm64)
- mkerrors="$mkerrors -m64"
- mksyscall="go run mksyscall.go -netbsd"
- mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-openbsd_386)
- mkerrors="$mkerrors -m32"
- mksyscall="go run mksyscall.go -l32 -openbsd"
- mksysctl="go run mksysctl_openbsd.go"
- mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-openbsd_amd64)
- mkerrors="$mkerrors -m64"
- mksyscall="go run mksyscall.go -openbsd"
- mksysctl="go run mksysctl_openbsd.go"
- mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-openbsd_arm)
- mkerrors="$mkerrors"
- mksyscall="go run mksyscall.go -l32 -openbsd -arm"
- mksysctl="go run mksysctl_openbsd.go"
- mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
- # Let the type of C char be signed for making the bare syscall
- # API consistent across platforms.
- mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
- ;;
-openbsd_arm64)
- mkerrors="$mkerrors -m64"
- mksyscall="go run mksyscall.go -openbsd"
- mksysctl="go run mksysctl_openbsd.go"
- mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
- # Let the type of C char be signed for making the bare syscall
- # API consistent across platforms.
- mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
- ;;
-solaris_amd64)
- mksyscall="go run mksyscall_solaris.go"
- mkerrors="$mkerrors -m64"
- mksysnum=
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-*)
- echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
- exit 1
- ;;
-esac
-
-(
- if [ -n "$mkerrors" ]; then echo "$mkerrors |gofmt >$zerrors"; fi
- case "$GOOS" in
- *)
- syscall_goos="syscall_$GOOS.go"
- case "$GOOS" in
- darwin | dragonfly | freebsd | netbsd | openbsd)
- syscall_goos="syscall_bsd.go $syscall_goos"
- ;;
- esac
- if [ -n "$mksyscall" ]; then
- if [ "$GOOSARCH" == "aix_ppc64" ]; then
- # aix/ppc64 script generates files instead of writing to stdin.
- echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ;
- elif [ "$GOOS" == "darwin" ]; then
- # pre-1.12, direct syscalls
- echo "$mksyscall -tags $GOOS,$GOARCH,!go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.1_11.go";
- # 1.12 and later, syscalls via libSystem
- echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
- else
- echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
- fi
- fi
- esac
- if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
- if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
- if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go"; fi
- if [ -n "$mkasm" ]; then echo "$mkasm $GOARCH"; fi
-) | $run
diff --git a/src/vendor/golang.org/x/sys/unix/mkerrors.sh b/src/vendor/golang.org/x/sys/unix/mkerrors.sh
deleted file mode 100644
index 82979b3cf4..0000000000
--- a/src/vendor/golang.org/x/sys/unix/mkerrors.sh
+++ /dev/null
@@ -1,662 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2009 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.
-
-# Generate Go code listing errors and other #defined constant
-# values (ENAMETOOLONG etc.), by asking the preprocessor
-# about the definitions.
-
-unset LANG
-export LC_ALL=C
-export LC_CTYPE=C
-
-if test -z "$GOARCH" -o -z "$GOOS"; then
- echo 1>&2 "GOARCH or GOOS not defined in environment"
- exit 1
-fi
-
-# Check that we are using the new build system if we should
-if [[ "$GOOS" = "linux" ]] && [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then
- echo 1>&2 "In the Docker based build system, mkerrors should not be called directly."
- echo 1>&2 "See README.md"
- exit 1
-fi
-
-if [[ "$GOOS" = "aix" ]]; then
- CC=${CC:-gcc}
-else
- CC=${CC:-cc}
-fi
-
-if [[ "$GOOS" = "solaris" ]]; then
- # Assumes GNU versions of utilities in PATH.
- export PATH=/usr/gnu/bin:$PATH
-fi
-
-uname=$(uname)
-
-includes_AIX='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define AF_LOCAL AF_UNIX
-'
-
-includes_Darwin='
-#define _DARWIN_C_SOURCE
-#define KERNEL
-#define _DARWIN_USE_64_BIT_INODE
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-'
-
-includes_DragonFly='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-'
-
-includes_FreeBSD='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#if __FreeBSD__ >= 10
-#define IFT_CARP 0xf8 // IFT_CARP is deprecated in FreeBSD 10
-#undef SIOCAIFADDR
-#define SIOCAIFADDR _IOW(105, 26, struct oifaliasreq) // ifaliasreq contains if_data
-#undef SIOCSIFPHYADDR
-#define SIOCSIFPHYADDR _IOW(105, 70, struct oifaliasreq) // ifaliasreq contains if_data
-#endif
-'
-
-includes_Linux='
-#define _LARGEFILE_SOURCE
-#define _LARGEFILE64_SOURCE
-#ifndef __LP64__
-#define _FILE_OFFSET_BITS 64
-#endif
-#define _GNU_SOURCE
-
-// is broken on powerpc64, as it fails to include definitions of
-// these structures. We just include them copied from .
-#if defined(__powerpc__)
-struct sgttyb {
- char sg_ispeed;
- char sg_ospeed;
- char sg_erase;
- char sg_kill;
- short sg_flags;
-};
-
-struct tchars {
- char t_intrc;
- char t_quitc;
- char t_startc;
- char t_stopc;
- char t_eofc;
- char t_brkc;
-};
-
-struct ltchars {
- char t_suspc;
- char t_dsuspc;
- char t_rprntc;
- char t_flushc;
- char t_werasc;
- char t_lnextc;
-};
-#endif
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#if defined(__sparc__)
-// On sparc{,64}, the kernel defines struct termios2 itself which clashes with the
-// definition in glibc. As only the error constants are needed here, include the
-// generic termibits.h (which is included by termbits.h on sparc).
-#include
-#else
-#include
-#endif
-
-#ifndef MSG_FASTOPEN
-#define MSG_FASTOPEN 0x20000000
-#endif
-
-#ifndef PTRACE_GETREGS
-#define PTRACE_GETREGS 0xc
-#endif
-
-#ifndef PTRACE_SETREGS
-#define PTRACE_SETREGS 0xd
-#endif
-
-#ifndef SOL_NETLINK
-#define SOL_NETLINK 270
-#endif
-
-#ifdef SOL_BLUETOOTH
-// SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h
-// but it is already in bluetooth_linux.go
-#undef SOL_BLUETOOTH
-#endif
-
-// Certain constants are missing from the fs/crypto UAPI
-#define FS_KEY_DESC_PREFIX "fscrypt:"
-#define FS_KEY_DESC_PREFIX_SIZE 8
-#define FS_MAX_KEY_SIZE 64
-'
-
-includes_NetBSD='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-// Needed since refers to it...
-#define schedppq 1
-'
-
-includes_OpenBSD='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-// We keep some constants not supported in OpenBSD 5.5 and beyond for
-// the promise of compatibility.
-#define EMUL_ENABLED 0x1
-#define EMUL_NATIVE 0x2
-#define IPV6_FAITH 0x1d
-#define IPV6_OPTIONS 0x1
-#define IPV6_RTHDR_STRICT 0x1
-#define IPV6_SOCKOPT_RESERVED1 0x3
-#define SIOCGIFGENERIC 0xc020693a
-#define SIOCSIFGENERIC 0x80206939
-#define WALTSIG 0x4
-'
-
-includes_SunOS='
-#include
-#include
-#include
-#include