1. 05 Nov, 2018 20 commits
  2. 04 Nov, 2018 2 commits
  3. 03 Nov, 2018 6 commits
  4. 02 Nov, 2018 12 commits
    • Carl Mastrangelo's avatar
      net/http: speed up ServeMux matching · 1645dfa2
      Carl Mastrangelo authored
      Scanning through all path patterns is not necessary, since the
      paths do not change frequently.  Instead, maintain a sorted list
      of path prefixes and return the first match.
      
      name            old time/op  new time/op  delta
      ServerMatch-12   134ns ± 3%    17ns ± 4%  -86.95%  (p=0.000 n=19+20)
      
      Change-Id: I15b4483dc30db413321435ee6815fc9bf2bcc546
      Reviewed-on: https://go-review.googlesource.com/c/144937Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      1645dfa2
    • Brad Fitzpatrick's avatar
      all: use "reports whether" consistently in the few places that didn't · 3813edf2
      Brad Fitzpatrick authored
      Go documentation style for boolean funcs is to say:
      
          // Foo reports whether ...
          func Foo() bool
      
      (rather than "returns true if")
      
      This CL also replaces 4 uses of "iff" with the same "reports whether"
      wording, which doesn't lose any meaning, and will prevent people from
      sending typo fixes when they don't realize it's "if and only if". In
      the past I think we've had the typo CLs updated to just say "reports
      whether". So do them all at once.
      
      (Inspired by the addition of another "returns true if" in CL 146938
      in fd_plan9.go)
      
      Created with:
      
      $ perl -i -npe 's/returns true if/reports whether/' $(git grep -l "returns true iff" | grep -v vendor)
      $ perl -i -npe 's/returns true if/reports whether/' $(git grep -l "returns true if" | grep -v vendor)
      
      Change-Id: Ided502237f5ab0d25cb625dbab12529c361a8b9f
      Reviewed-on: https://go-review.googlesource.com/c/147037Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      3813edf2
    • Robert Griesemer's avatar
      cmd/compile/internal/gc: add tracing support to debug type checking · e25823ed
      Robert Griesemer authored
      The compiler must first be built with the constant enableTrace set
      to true (typecheck.go). After that, the -t flag becomes available
      which enables tracing output of type-checking functions.
      
      With enableTrace == false, the tracing code becomes dead code
      and won't affect the compiler.
      
      Typical output might look like this:
      
      path/y.go:4:6: typecheck 0xc00033e180 DCLTYPE <node DCLTYPE> tc=0
      path/y.go:4:6: . typecheck1 0xc00033e180 DCLTYPE <node DCLTYPE> tc=2
      path/y.go:4:6: . . typecheck 0xc000331a40 TYPE T tc=1
      path/y.go:4:6: . . . typecheck1 0xc000331a40 TYPE T tc=2
      path/y.go:4:6: . . . . typecheckdef 0xc000331a40 TYPE T tc=2
      path/y.go:4:6: . . . . => 0xc000331a40 TYPE T tc=2 type=*T
      path/y.go:4:6: . . . => 0xc000331a40 TYPE T tc=2 type=*T
      path/y.go:4:6: . . => 0xc000331a40 TYPE T tc=1 type=*T
      path/y.go:4:6: . => 0xc00033e180 DCLTYPE <node DCLTYPE> tc=2 type=<T>
      path/y.go:4:6: => 0xc00033e180 DCLTYPE <node DCLTYPE> tc=1 type=<T>
      
      Disabled by default.
      
      Change-Id: Ifd8385290d1cf0d3fc5e8468b2f4ab84e8eff338
      Reviewed-on: https://go-review.googlesource.com/c/146782Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      e25823ed
    • Filippo Valsorda's avatar
      crypto/tls: implement TLS 1.3 server handshake (base) · c21ba09b
      Filippo Valsorda authored
      Implement a basic TLS 1.3 server handshake, only enabled if explicitly
      requested with MaxVersion.
      
      This CL intentionally leaves for future CLs:
        - PSK modes and resumption
        - client authentication
        - compatibility mode ChangeCipherSpecs
        - early data skipping
        - post-handshake messages
        - downgrade protection
        - KeyLogWriter support
        - TLS_FALLBACK_SCSV processing
      
      It also leaves a few areas up for a wider refactor (maybe in Go 1.13):
        - the certificate selection logic can be significantly improved,
          including supporting and surfacing signature_algorithms_cert, but
          this isn't new in TLS 1.3 (see comment in processClientHello)
        - handshake_server_tls13.go can be dried up and broken into more
          meaningful, smaller functions, but it felt premature to do before
          PSK and client auth support
        - the monstrous ClientHello equality check in doHelloRetryRequest can
          get both cleaner and more complete with collaboration from the
          parsing layer, which can come at the same time as extension
          duplicates detection
      
      Updates #9671
      
      Change-Id: Id9db2b6ecc2eea21bf9b59b6d1d9c84a7435151c
      Reviewed-on: https://go-review.googlesource.com/c/147017
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      c21ba09b
    • Filippo Valsorda's avatar
      crypto/tls: implement TLS 1.3 client handshake (base) · 4caa1276
      Filippo Valsorda authored
      Implement a basic TLS 1.3 client handshake, only enabled if explicitly
      requested with MaxVersion.
      
      This CL intentionally leaves for future CLs:
        - PSK modes and resumption
        - client authentication
        - post-handshake messages
        - downgrade protection
        - KeyLogWriter support
      
      Updates #9671
      
      Change-Id: Ieb6130fb6f25aea4f0d39e3a2448dfc942e1de7a
      Reviewed-on: https://go-review.googlesource.com/c/146559
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      4caa1276
    • Filippo Valsorda's avatar
      crypto/tls: advertise and accept rsa_pss_rsae signature algorithms · ee7e4433
      Filippo Valsorda authored
      crypto/x509 already supports PSS signatures (with rsaEncryption OID),
      and crypto/tls support was added in CL 79736. Advertise support for the
      algorithms and accept them as a peer.
      
      Note that this is about PSS signatures from regular RSA public keys.
      RSA-PSS only public keys (with RSASSA-PSS OID) are supported in neither
      crypto/tls nor crypto/x509. See RFC 8446, Section 4.2.3.
      
      testdata/Server-TLSv12-ClientAuthRequested* got modified because the
      CertificateRequest carries the supported signature algorithms.
      
      The net/smtp tests changed because 512 bits keys are too small for PSS.
      
      Based on Peter Wu's CL 79738, who did all the actual work in CL 79736.
      
      Updates #9671
      
      Change-Id: I4a31e9c6e152ff4c50a5c8a274edd610d5fff231
      Reviewed-on: https://go-review.googlesource.com/c/146258
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      ee7e4433
    • Filippo Valsorda's avatar
      crypto/tls: implement TLS 1.3 version negotiation · 7f5dce08
      Filippo Valsorda authored
      RFC 8446 recommends using the supported_versions extension to negotiate
      lower versions as well, so begin by implementing it to negotiate the
      currently supported versions.
      
      Note that pickTLSVersion was incorrectly negotiating the ServerHello
      version down on the client. If the server had illegally sent a version
      higher than the ClientHello version, the client would have just
      downgraded it, hopefully failing later in the handshake.
      
      In TestGetConfigForClient, we were hitting the record version check
      because the server would select TLS 1.1, the handshake would fail on the
      client which required TLS 1.2, which would then send a TLS 1.0 record
      header on its fatal alert (not having negotiated a version), while the
      server would expect a TLS 1.1 header at that point. Now, the client gets
      to communicate the minimum version through the extension and the
      handshake fails on the server.
      
      Updates #9671
      
      Change-Id: Ie33c7124c0c769f62e10baad51cbed745c424e5b
      Reviewed-on: https://go-review.googlesource.com/c/146217
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      7f5dce08
    • Filippo Valsorda's avatar
      crypto/tls: implement TLS 1.3 version-specific messages · 0663fe98
      Filippo Valsorda authored
      Note that there is significant code duplication due to extensions with
      the same format appearing in different messages in TLS 1.3. This will be
      cleaned up in a future refactor once CL 145317 is merged.
      
      Enforcing the presence/absence of each extension in each message is left
      to the upper layer, based on both protocol version and extensions
      advertised in CH and CR. Duplicated extensions and unknown extensions in
      SH, EE, HRR, and CT will be tightened up in a future CL.
      
      The TLS 1.2 CertificateStatus message was restricted to accepting only
      type OCSP as any other type (none of which are specified so far) would
      have to be negotiated.
      
      Updates #9671
      
      Change-Id: I7c42394c5cc0af01faa84b9b9f25fdc6e7cfbb9e
      Reviewed-on: https://go-review.googlesource.com/c/145477Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      0663fe98
    • Filippo Valsorda's avatar
      crypto/tls: implement TLS 1.3 cryptographic computations · 84d6a7ab
      Filippo Valsorda authored
      Vendors golang.org/x/crypto/hkdf at e84da0312774c21d64ee2317962ef669b27ffb41
      
      Updates #9671
      
      Change-Id: I2610c4a66756e2a6f21f9823dcbe39edd9c9ea21
      Reviewed-on: https://go-review.googlesource.com/c/145298Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      84d6a7ab
    • Filippo Valsorda's avatar
      crypto/tls: implement TLS 1.3 record layer and cipher suites · ef21689a
      Filippo Valsorda authored
      Updates #9671
      
      Change-Id: I1ea7b724975c0841d01f4536eebb23956b30d5ea
      Reviewed-on: https://go-review.googlesource.com/c/145297Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      ef21689a
    • Filippo Valsorda's avatar
      crypto/tls: implement TLS 1.3 extensions for ClientHello and ServerHello · 7aee7990
      Filippo Valsorda authored
      Updates #9671
      
      Change-Id: Ia68224aca866dc3c98af1fccbe56bfb3f22da9f6
      Reviewed-on: https://go-review.googlesource.com/c/144578
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      7aee7990
    • Alan Donovan's avatar
      go/build: add go1.12 release tag · 61e2b75a
      Alan Donovan authored
      Change-Id: I82e3f9140e5d14f02beef64c474a3ae88fe256e1
      Reviewed-on: https://go-review.googlesource.com/c/147219
      Run-TryBot: Alan Donovan <adonovan@google.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      61e2b75a