crypto/tls: pick ECDHE curves based on server preference.

Currently an ECDHE handshake uses the client's curve preference. This
generally means that we use P-521. However, P-521's strength is
mismatched with the rest of the cipher suite in most cases and we have
a fast, constant-time implementation of P-256.

With this change, Go servers will use P-256 where the client supports
it although that can be overridden in the Config.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://codereview.appspot.com/66060043
crypto/tls: report TLS version in ConnectionState.

Fixes issue 7231.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/68250043
net/http: use TCP Keep-Alives on DefaultTransport's connections

Update Issue 3362

Also set a 30 second timeout, instead of relying on the
operating system's timeout, which if often but not always 3
minutes.

LGTM=crawshaw
R=rsc, crawshaw
CC=golang-codereviews
https://codereview.appspot.com/68330046
go/printer: fix alignment of comments in labeled statements

Does not change src, misc formatting.

Fixes issue 5623.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://codereview.appspot.com/68400043
runtime, net: add support for GOOS=solaris

LGTM=dave, rsc
R=golang-codereviews, minux.ma, mikioh.mikioh, dave, iant, rsc
CC=golang-codereviews
https://codereview.appspot.com/36030043

Committer: Russ Cox <rsc@golang.org>
syscall: generate zfiles for GOOS=solaris

LGTM=minux.ma, mikioh.mikioh
R=golang-codereviews, minux.ma, gobot, jsing, mikioh.mikioh, dave
CC=golang-codereviews
https://codereview.appspot.com/36010043

Committer: Mikio Hara <mikioh.mikioh@gmail.com>
syscall: add support for GOOS=solaris

These are only the new files, autogenerated files are in a
different CL to keep the size down.

LGTM=dave, minux.ma, jsing
R=golang-codereviews, dave, jsing, gobot, minux.ma, rsc, iant, mikioh.mikioh
CC=golang-codereviews
https://codereview.appspot.com/36000043

Committer: Joel Sing <jsing@google.com>
sync: use RunParallel in benchmarks

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/68050043
syscall: add mmap test

This CL adds a test that calls Mmap and Munmap through Syscall9
as the canary that detects assembly fragment breakage. For now
there is no package test that uses Syscall9 in the standard
library across all Unix-like systems.

Note that the package runtime owns its assembly fragments, so
this canary never works for runtime breakage.

LGTM=iant, bradfitz
R=iant, minux.ma, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/61520049
runtime: use monotonic clock for timers on linux/arm

Update issue 6007

LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews
https://codereview.appspot.com/67730048
all: merge NaCl branch (part 1)

See golang.org/s/go13nacl for design overview.

This CL is the mostly mechanical changes from rsc's Go 1.2 based NaCl branch, specifically 39cb35750369 to 500771b477cf from https://code.google.com/r/rsc-go13nacl. This CL does not include working NaCl support, there are probably two or three more large merges to come.

CL 15750044 is not included as it involves more invasive changes to the linker which will need to be merged separately.

The exact change lists included are

15050047: syscall: support for Native Client
15360044: syscall: unzip implementation for Native Client
15370044: syscall: Native Client SRPC implementation
15400047: cmd/dist, cmd/go, go/build, test: support for Native Client
15410048: runtime: support for Native Client
15410049: syscall: file descriptor table for Native Client
15410050: syscall: in-memory file system for Native Client
15440048: all: update +build lines for Native Client port
15540045: cmd/6g, cmd/8g, cmd/gc: support for Native Client
15570045: os: support for Native Client
15680044: crypto/..., hash/crc32, reflect, sync/atomic: support for amd64p32
15690044: net: support for Native Client
15690048: runtime: support for fake time like on Go Playground
15690051: build: disable various tests on Native Client

LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/68150047

Committer: Russ Cox <rsc@golang.org>
cmd/go: document new -exec flag on run/test

The new flag was added by CL 68150047 (part of the NaCl replay),
but the change, like the original, omitted documentation of the
new behavior.

LGTM=r
R=r
CC=golang-codereviews
https://codereview.appspot.com/68580043
doc/go1.3: note a couple more crypto changes.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/68600043
net/http: add Transport.TLSHandshakeTimeout; set it by default

Update Issue 3362

LGTM=agl
R=agl
CC=golang-codereviews
https://codereview.appspot.com/68150045
cmd/go: fix bug in remote package discovery

The parser was assuming it would find <body> or </head>.
If the entire response is just <meta> tags, it finds EOF and
treats that as an error. It's not.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://codereview.appspot.com/68520044
runtime: fix 386, arm build

CL 68150047 lost runtime.panicdivide.

TBR=dfc
CC=golang-codereviews
https://codereview.appspot.com/68610043
spec: clarify default "true" condition/tag in for/switch statements

An absent condition/tag in for and switch statements is equivalent
to the predeclared constant true; not simply the expression true
(which might lead to a locally defined true).

Not a language change.

Fixes issue 7404.

LGTM=iant, r
R=r, iant, rsc, ken
CC=golang-codereviews
https://codereview.appspot.com/68150046
crypto/sha1: restore accidental removal of arm build tag

Regression from https://codereview.appspot.com/68490043/diff/60001/src/pkg/crypto/sha1/sha1block_decl.go

Fixes arm build.

TBR=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/68080046
runtime: add prototype for panicdivide

LGTM=bradfitz
R=golang-codereviews, bradfitz, khr
CC=golang-codereviews
https://codereview.appspot.com/68680043
syscall: fix solaris build

Solaris does not define syscall.{Mmap,Munmap}. Move the Mmap test to a new file and exclude solaris as discussed.

LGTM=aram
R=aram, mikioh.mikioh, iant
CC=golang-codereviews
https://codereview.appspot.com/68720043