crypto/tls: Support ECDSA keys in generate_cert.go

R=golang-codereviews, bradfitz, agl
CC=golang-codereviews
https://codereview.appspot.com/117180043

Committer: Adam Langley <agl@golang.org>
encoding/asn1: only omit optional elements matching default value.

ASN.1 elements can be optional, and can have a default value.
Traditionally, Go has omitted elements that are optional and that have
the zero value. I believe that's a bug (see [1]).

This change causes an optional element with a default value to only be
omitted when it has that default value. The previous behaviour of
omitting optional, zero elements with no default is retained because
it's used quite a lot and will break things if changed.

[1] https://groups.google.com/d/msg/Golang-nuts/9Ss6o9CW-Yo/KL_V7hFlyOAJ

Fixes issue 7780.

R=bradfitz

LGTM=bradfitz
R=golang-codereviews, bradfitz, rsc
CC=golang-codereviews, r
https://codereview.appspot.com/86960045
crypto/tls: check curve equation in ECDHE.

This change causes a TLS client and server to verify that received
elliptic curve points are on the expected curve. This isn't actually
necessary in the Go TLS stack, but Watson Ladd has convinced me that
it's worthwhile because it's pretty cheap and it removes the
possibility that some change in the future (e.g. tls-unique) will
depend on it without the author checking that precondition.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://codereview.appspot.com/115290046
time: make it clearer that the reference time is the reference time.
Because the reference time is the reference time but beginners seem
to think otherwise, make it clearer you can't choose the reference time.

LGTM=josharian, dave
R=golang-codereviews, josharian, dave
CC=golang-codereviews
https://codereview.appspot.com/117250044
image/png: use branch-free abs function

benchmark                        old ns/op     new ns/op     delta
BenchmarkPaeth                   5.06          6.02          +18.97%
BenchmarkDecodeGray              1010551       956911        -5.31%
BenchmarkDecodeNRGBAGradient     3877813       3754160       -3.19%
BenchmarkDecodeNRGBAOpaque       3194058       3079094       -3.60%
BenchmarkDecodePaletted          699243        700211        +0.14%
BenchmarkDecodeRGB               2835733       2692120       -5.06%
BenchmarkDecodeInterlacing       3651805       3563124       -2.43%
BenchmarkEncodeGray              4399183       4404113       +0.11%
BenchmarkEncodeNRGBOpaque        13323627      13306485      -0.13%
BenchmarkEncodeNRGBA             15840092      15751188      -0.56%
BenchmarkEncodePaletted          4396622       4404373       +0.18%
BenchmarkEncodeRGBOpaque         13320475      13279189      -0.31%
BenchmarkEncodeRGBA              36898392      36781002      -0.32%

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://codereview.appspot.com/117290043

Committer: Nigel Tao <nigeltao@golang.org>
runtime: simpler and faster GC

Implement the design described in:
https://docs.google.com/document/d/1v4Oqa0WwHunqlb8C3ObL_uNQw3DfSY-ztoA-4wWbKcg/pub

Summary of the changes:
GC uses "2-bits per word" pointer type info embed directly into bitmap.
Scanning of stacks/data/heap is unified.
The old spans types go away.
Compiler generates "sparse" 4-bits type info for GC (directly for GC bitmap).
Linker generates "dense" 2-bits type info for data/bss (the same as stacks use).

Summary of results:
-1680 lines of code total (-1000+ in mgc0.c only)
-25% memory consumption
-3-7% binary size
-15% GC pause reduction
-7% run time reduction

LGTM=khr
R=golang-codereviews, rsc, christoph, khr
CC=golang-codereviews, rlh
https://codereview.appspot.com/106260045
cmd/ld: better diagnostics on unaligned symbols
Want to see why builders are failing.
Then decide whether to rollback or fix.

TBR=khr
R=khr
CC=golang-codereviews
https://codereview.appspot.com/114510043
net: prevent spurious on-connect events via epoll on linux

On Linux, adding a socket descriptor to epoll instance before getting
the EINPROGRESS return value from connect system call could be a root
cause of spurious on-connect events.

See golang.org/issue/8276, golang.org/issue/8426 for further information.

All credit to Jason Eggleston <jason@eggnet.com>

Fixes issue 8276.
Fixes issue 8426.

LGTM=dvyukov
R=dvyukov, golang-codereviews, adg, dave, iant, alex.brainman
CC=golang-codereviews
https://codereview.appspot.com/120820043
runtime: mark global var as NOPTR

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://codereview.appspot.com/119300043
runtime: mark global var as NOPTR

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://codereview.appspot.com/120280044
runtime: verify hmap type size

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, khr
https://codereview.appspot.com/114510044
runtime: generate type info for chans

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, khr
https://codereview.appspot.com/115280043
A+C: Mihai Borobocea (individual CLA)

Generated by a+c.

R=gobot
CC=golang-codereviews
https://codereview.appspot.com/115370044
cmd/gc: don't allow escaping arguments in the runtime package.

This is a case that was missed in https://codereview.appspot.com/105280047/

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/120910043
fmt: measure width in runes not bytes with %c and %q for ints

This is meant to share my progress on Issue 8275, if it's useful to you. I'm not familiar with the formatter's internals, so this change is likely naive.

Change these calls to measure width in runes not bytes:
fmt.Printf("(%5q)\n", '§')
fmt.Printf("(%3c)\n", '§')

 Fixes issue 8275.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://codereview.appspot.com/104320043

Committer: Rob Pike <r@golang.org>
A+C: fixed doubled entry
Delete an erroneously doubled name in both files. Once is enough.

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://codereview.appspot.com/118420043
undo CL 101460043 / 746e175af5d2

preparing for the syscall package freeze.

««« original CL description
syscall: add source-specific multicast socket options for Darwin

Update issue 8266

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://codereview.appspot.com/101460043
»»»

LGTM=r
R=r
CC=golang-codereviews
https://codereview.appspot.com/115350043
undo CL 102610045 / 7244ce3ae9db

preparing for the syscall package freeze.

««« original CL description
syscall: regenerate z-files for darwin

Updates z-files from 10.7 kernel-based to 10.9 kernel-based.

LGTM=iant
R=golang-codereviews, bradfitz, iant
CC=golang-codereviews
https://codereview.appspot.com/102610045
»»»

LGTM=r
R=r
CC=golang-codereviews
https://codereview.appspot.com/114530044
bufio: fix rot13Reader bug in test

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/118410043
undo CL 104290043 / 1d13818e6b3d

preparing for the syscall package freeze.

««« original CL description
syscall: add source-specific multicast socket options for FreeBSD

Update issue 8266

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://codereview.appspot.com/104290043
»»»

LGTM=r
R=r
CC=golang-codereviews
https://codereview.appspot.com/113660043