Skip to content

[pull] master from golang:master#46

Merged
pull[bot] merged 18 commits into
trailofbits:masterfrom
golang:master
May 21, 2026
Merged

[pull] master from golang:master#46
pull[bot] merged 18 commits into
trailofbits:masterfrom
golang:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 21, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

griesemer and others added 18 commits May 20, 2026 12:36
…tive

Per comment on (now abandoned) CL 780104.

Change-Id: Ic9ccfdbb6d3755c2f0589fbe5bffab096a8c508e
Reviewed-on: https://go-review.googlesource.com/c/go/+/780106
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Michael Podtserkovskii <michaelpo@meta.com>
Repeated squaring forms the bulk of these add chains.
Doing it in a dedicated routine with local variables is faster.

Introduce SquareN for this, and switch to an add chain geared towards
maximizing runs of repeated squares.

Unrolling the SquareN loop 5x gains a few percentage points more;
this could be done as desired in a follow-up.

A planned follow-up will use this newfound speed to delete amd64 asm.


Microbenchmarks:

goos: darwin
goarch: arm64
pkg: crypto/internal/fips140/edwards25519
cpu: Apple M3 Max
                               │      a      │                  b                   │
                               │   sec/op    │   sec/op     vs base                 │
EncodingDecoding-16              5.842µ ± 0%   4.703µ ± 0%  -19.51% (n=100)
ScalarBaseMult-16                9.157µ ± 0%   9.178µ ± 0%   +0.23% (p=0.000 n=100)
ScalarMult-16                    29.28µ ± 0%   29.25µ ± 0%   -0.09% (n=100)
VarTimeDoubleScalarBaseMult-16   27.46µ ± 0%   27.46µ ± 0%   -0.02% (p=0.002 n=100)
geomean                          14.40µ        13.64µ        -5.25%

pkg: crypto/internal/fips140/edwards25519/field
            │      a      │                  b                   │
            │   sec/op    │   sec/op     vs base                 │
Add-16        3.364n ± 0%   3.350n ± 0%   -0.43% (p=0.000 n=100)
Multiply-16   14.15n ± 0%   14.15n ± 0%    0.00% (p=0.000 n=100)
Square-16     10.32n ± 0%   10.25n ± 0%   -0.68% (n=100)
Invert-16     2.734µ ± 0%   2.331µ ± 0%  -14.74% (n=100)
Mult32-16     5.067n ± 0%   4.926n ± 0%   -2.78% (n=100)
Bytes-16      4.595n ± 0%   4.580n ± 0%        ~ (p=0.052 n=100)
geomean       17.75n        17.16n        -3.31%


Macrobenchmarks:

goos: darwin
goarch: arm64
pkg: crypto/ed25519
cpu: Apple M3 Max
                  │   before    │               after                │
                  │   sec/op    │   sec/op     vs base               │
KeyGeneration-16    13.84µ ± 2%   12.92µ ± 1%  -6.65% (p=0.000 n=30)
NewKeyFromSeed-16   13.60µ ± 3%   12.91µ ± 1%  -5.09% (p=0.000 n=30)
Signing-16          16.14µ ± 3%   15.75µ ± 1%  -2.45% (p=0.000 n=30)
Verification-16     35.47µ ± 2%   34.84µ ± 0%  -1.79% (p=0.001 n=30)
geomean             18.12µ        17.39µ       -4.02%

Change-Id: I30d09b8d15fa9d1d64863a21d26c1c9ce4d8e9cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/760760
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
The preceding commit made the compiler-generated code faster
than the assembly.

Since the generic/assembly split is gone, use nicer function names.
The fact that they are functions instead of methods is itself a vestige
of their assembly roots. But unwinding that makes for a large diff.

goos: linux
goarch: amd64
cpu: AMD Ryzen Threadripper PRO 7975WX 32-Cores

pkg: crypto/ed25519
                │   before    │               after                │
                │   sec/op    │   sec/op     vs base               │
KeyGeneration-64    12.70µ ± 1%   12.38µ ± 2%  -2.53% (p=0.000 n=30)
NewKeyFromSeed-64   12.52µ ± 0%   12.27µ ± 1%  -2.00% (p=0.000 n=30)
Signing-64          15.42µ ± 0%   14.81µ ± 0%  -3.97% (p=0.000 n=30)
Verification-64     34.84µ ± 0%   34.68µ ± 0%  -0.44% (p=0.006 n=30)
geomean             17.10µ        16.71µ       -2.24%

pkg: crypto/internal/fips140/edwards25519
                                │   before    │                after                │
                                │   sec/op    │   sec/op     vs base                │
EncodingDecoding-64              5.159µ ± 0%   4.589µ ± 1%  -11.05% (p=0.000 n=30)
ScalarBaseMult-64                9.761µ ± 0%   9.780µ ± 1%        ~ (p=0.965 n=30)
ScalarMult-64                    31.99µ ± 0%   32.46µ ± 0%   +1.47% (p=0.000 n=30)
VarTimeDoubleScalarBaseMult-64   29.82µ ± 0%   30.16µ ± 0%   +1.14% (p=0.000 n=30)
geomean                          14.80µ        14.48µ        -2.20%

pkg: crypto/internal/fips140/edwards25519/field
            │   before    │                after                │
            │   sec/op    │   sec/op     vs base                │
Add-64        2.571n ± 2%   2.573n ± 1%        ~ (p=0.460 n=30)
Multiply-64   10.67n ± 0%   10.62n ± 0%   -0.47% (p=0.001 n=30)
Square-64     8.849n ± 0%   8.412n ± 0%   -4.94% (p=0.000 n=30)
Invert-64     2.401µ ± 0%   2.156µ ± 2%  -10.20% (p=0.000 n=30)
Mult32-64     3.226n ± 0%   3.240n ± 0%   +0.47% (p=0.004 n=30)
Bytes-64      7.974n ± 1%   7.905n ± 1%   -0.87% (p=0.015 n=30)
geomean       15.70n        15.27n        -2.74%


Change-Id: I995209e72e202e7ca4e436615424120ef09e8b37
Reviewed-on: https://go-review.googlesource.com/c/go/+/778500
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Streamline the godoc comments across Addr, AddrPort and Prefix in terms
of wording and godoc links. Add more and correct godoc links.

Change-Id: Id806ddcfafc9a99af483a9a6c94c6288d1ee4939
Reviewed-on: https://go-review.googlesource.com/c/go/+/779640
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
- added a handfull of test cases to TestLineDirectives that were
  removed and added to TestLineDirectivesPaths in CL 706795
- rewrote TestLineDirectivesWithDir into a simpler, more readable form
- removed TestLineDirectivesPaths and moved its cases into the
  existing TestLineDirectives function

This cleanup now leaves one dedicated, simple test function that
tests the new directory-relative line-directive behavior.

Follow-up on CL 706795.

Change-Id: I1025a54ba9de034235bceaaa0cc416b7acb5cb73
Reviewed-on: https://go-review.googlesource.com/c/go/+/780660
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Podtserkovskii <michaelpo@meta.com>
CL 743860 broke -l=4 builds by introducing an allocation in
runtime.printfloat64. Since -l=4 is very rarely used, skip the one test
using it until it is fixed.

Updates #79547

Change-Id: Id180cfc66a76c70fa980b3efeb1440156a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/780760
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
We now will only generate size specialized functions for size clases
less than or equal to 7. This brings down the size of the generated
functions from around 21k to around 16k.

For #79286

Change-Id: I1adafd3674004069ed6461ef63228bfc6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/780300
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Like CL 761200, pass the -std flag to the assembler during
bootstrap.

Change-Id: I37931c21ed33bbaefebfe3e66cc8bd7a503b5185
Reviewed-on: https://go-review.googlesource.com/c/go/+/780402
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
For linknames within the standard library, we can use the new
linknamestd pragma. Apply it to linknames added in 1.27 cycle, as
they cannot be accessed externally.

Change-Id: I97f78ddcb6ca27718337dcfc8d3c581a5acd2b73
Reviewed-on: https://go-review.googlesource.com/c/go/+/780680
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Add a new optional interface for driver.Rows which permits
the driver to scan directly into the user-provided []any.

Export the convertAssign function, to permit drivers
to fall back to the old assignment path.

Using the prior Rows interface, a driver provides values
with a function like:

  func (rows *Rows) Next(dest []Value) error {
    dest[0] = "some value"
    return nil
  }

Using the new RowsColumnScanner interface, the
equivalent is:

  func (rows *Rows) ScanColumn(scanCtx driver.ScanContext, index int, dest any) error {
    return sql.ConvertAssign(scanCtx, dest, "some value")
  }

Fixes #67546

Change-Id: I421f5639a12c78c76d377534b5a82f846a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/777961
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Expand the documentation on Decoder.UnreadBuffer regarding
what exactly it returns, what guarantees are provided, and
how to properly use it for the most common use-case of
obtaining everything else after the last parsed token.

Also update documentation in v1 json.Decoder.Buffered method,
which is trivially implemented under the hood
using Decoder.UnreadBuffer.

Updates #79498

Change-Id: I9c4a9350e97b74d77d4a74dd191fba6097ae332a
Reviewed-on: https://go-review.googlesource.com/c/go/+/779981
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
This is the equivalent of CL 775180 for Unmarshal.

Also, since the jsonv2 package is imported with a specific name,
the hot-link can reference the local package name directly,
instead of relying on a full-qualified package import path.

Change-Id: I1223eeaac2d2aed53cfc681b5582e697813f2a36
Reviewed-on: https://go-review.googlesource.com/c/go/+/780107
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
This rolls up to include CL 780780, preparing us for the freeze.

Change-Id: I69561591332e377fddac20af99d85cf92f8bc2cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/780801
TryBot-Bypass: Mark Freeman <markfreeman@google.com>
Reviewed-by: Neal Patel <nealpatel@google.com>
This change adds String methods to the types TypeList, TypeParamList
and Instance. The format is unspecified and is provided merely as
a debugging aid.

Fixes #79287

Change-Id: Ic283ea57bac6465b47b8b81b1fa4590641b639cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/780581
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Change-Id: I6a6a4656c554e26151dc73287b68d6665a824dc3
Reviewed-on: https://go-review.googlesource.com/c/go/+/669895
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Neal Patel <neal@golang.org>
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
…t code

Made the following changes:

  * gofmt -r "(a) -> a"
  * "type p256OrdUint1 = uint64"
  * go run github.com/mdempsky/unconvert@latest -apply
  * gofmt -r "uint64(0x0) -> 0"
  * sed -E '/^\tvar x[0-9]+ uint64$/d; s/^\t(_|x[0-9]+)(, x[0-9]+)? = /\t\1\2 := /'
  * renamed p256OrdMontgomeryDomainFieldElement to p256OrdMontElement
  * replaced p256OrdNonMontgomeryDomainFieldElement with p256OrdElement

Change-Id: I996f76aa429e0c4ca049ee76a506e09d6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/749140
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Neal Patel <neal@golang.org>
Reviewed-by: Neal Patel <nealpatel@google.com>
…tion

This reduces the regression of CL 669895 by about half on arm64.

host: linux-amd64_c2s16
                      3227c96   12743b9   ccb659c   9a11e9167c3
                        sec/op       vs base       vs base       vs base
Sign/P256-16            33.38µ       +5.23%        +5.04%        +5.41%
Verify/P256-16          74.11µ       +2.54%        +2.49%        +2.69%
GenerateKey/P256-16     14.61µ         ~             ~             ~
geomean                 33.06µ       +2.50%        +2.41%        +2.63%

                        B/op         vs base       vs base       vs base
Sign/P256-16            5.922Ki      -0.53%        -0.53%        -0.53%
Verify/P256-16            576.0      -5.56%        -5.56%        -5.56%
GenerateKey/P256-16       984.0        ~             ~             ~
geomean                 1.474Ki      -2.06%        -2.06%        -2.06%

                        allocs/op    vs base       vs base       vs base
Sign/P256-16              59.00      -1.69%        -1.69%        -1.69%
Verify/P256-16            10.00     -10.00%       -10.00%       -10.00%
GenerateKey/P256-16       16.00        ~             ~             ~
geomean                   21.13      -4.00%        -4.00%        -4.00%

host: linux-arm64_c4as16
                      3227c96   12743b9   ccb659c   9a11e9167c3
                        sec/op       vs base       vs base       vs base
Sign/P256-16            29.29µ       +8.88%        +8.94%        +5.41%
Verify/P256-16          69.25µ       +3.52%        +3.48%        +2.21%
GenerateKey/P256-16     15.17µ         ~             ~             ~
geomean                 31.34µ       +4.05%        +3.97%        +2.51%

                        B/op         vs base       vs base       vs base
Sign/P256-16            5.922Ki      -0.53%        -0.53%        -0.53%
Verify/P256-16            576.0      -5.56%        -5.56%        -5.56%
GenerateKey/P256-16       984.0        ~             ~             ~
geomean                 1.474Ki      -2.06%        -2.06%        -2.06%

                        allocs/op    vs base       vs base       vs base
Sign/P256-16              59.00      -1.69%        -1.69%        -1.69%
Verify/P256-16            10.00     -10.00%       -10.00%       -10.00%
GenerateKey/P256-16       16.00        ~             ~             ~
geomean                   21.13      -4.00%        -4.00%        -4.00%

Change-Id: I69adc8175acf0082dca7c8a13d5f62046a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/749141
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Neal Patel <neal@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Neal Patel <nealpatel@google.com>
x * 0xffffffff00000000 = x * (2^64 - 2^32)
x * 0xffffffffffffffff = x * (2^64 - 1)

Comparing to parent commit:

goos: darwin
goarch: arm64
pkg: crypto/ecdsa
cpu: Apple M4 Max
                    │     OLD     │                NEW                │
                    │   sec/op    │   sec/op     vs base              │
Sign/P256-16          15.83µ ± 1%   15.18µ ± 1%  -4.06% (p=0.002 n=6)
Sign/P384-16          108.0µ ± 0%   107.6µ ± 1%  -0.36% (p=0.041 n=6)
Sign/P521-16          264.5µ ± 0%   262.9µ ± 0%  -0.61% (p=0.002 n=6)
Verify/P256-16        35.89µ ± 0%   35.23µ ± 0%  -1.84% (p=0.002 n=6)
Verify/P384-16        322.4µ ± 0%   321.6µ ± 0%  -0.28% (p=0.041 n=6)
Verify/P521-16        850.3µ ± 0%   847.4µ ± 0%  -0.35% (p=0.002 n=6)
GenerateKey/P256-16   7.241µ ± 0%   7.125µ ± 1%  -1.60% (p=0.002 n=6)
GenerateKey/P384-16   71.03µ ± 0%   70.94µ ± 0%  -0.13% (p=0.041 n=6)
GenerateKey/P521-16   180.6µ ± 0%   180.1µ ± 0%  -0.31% (p=0.002 n=6)
geomean               90.65µ        89.68µ       -1.07%

Change-Id: If8d659a76624dce1c53e23e6ed201189476e3f6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/780640
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
@pull pull Bot locked and limited conversation to collaborators May 21, 2026
@pull pull Bot added the ⤵️ pull label May 21, 2026
@pull pull Bot merged commit c8adcb6 into trailofbits:master May 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.