From 7825250d3fd53afde42f09171979a95dc6802e37 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Thu, 18 Jul 2024 11:20:54 -0600 Subject: [PATCH] ci: use Go 1.23rc2 for unit and integration tests (#4571) * ci: use Go 1.23rc1 for unit and integration tests * handshake: avoid using linkname to access crypto/tls.cipherSuiteTLS13ByID * ci: use use Go 1.23rc2 --- .github/workflows/integration.yml | 2 +- .github/workflows/unit.yml | 2 +- internal/handshake/hkdf_test.go | 16 +++++++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 56dcf90f2..ae5215319 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -6,7 +6,7 @@ jobs: fail-fast: false matrix: os: [ "ubuntu" ] - go: [ "1.21.x", "1.22.x" ] + go: [ "1.21.x", "1.22.x", "1.23.0-rc.2" ] include: - os: "windows" go: "1.21.x" diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 370460e90..2a45d5e7e 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -7,7 +7,7 @@ jobs: fail-fast: false matrix: os: [ "ubuntu", "windows", "macos" ] - go: [ "1.21.x", "1.22.x" ] + go: [ "1.21.x", "1.22.x", "1.23.0-rc.2" ] runs-on: ${{ fromJSON(vars[format('UNIT_RUNNER_{0}', matrix.os)] || format('"{0}-latest"', matrix.os)) }} name: Unit tests (${{ matrix.os}}, Go ${{ matrix.go }}) timeout-minutes: 30 diff --git a/internal/handshake/hkdf_test.go b/internal/handshake/hkdf_test.go index 1cc161299..f32e016e3 100644 --- a/internal/handshake/hkdf_test.go +++ b/internal/handshake/hkdf_test.go @@ -5,7 +5,7 @@ import ( "crypto/cipher" "crypto/tls" "testing" - _ "unsafe" + "unsafe" "golang.org/x/exp/rand" @@ -20,8 +20,18 @@ type cipherSuiteTLS13 struct { Hash crypto.Hash } -//go:linkname cipherSuiteTLS13ByID crypto/tls.cipherSuiteTLS13ByID -func cipherSuiteTLS13ByID(id uint16) *cipherSuiteTLS13 +//go:linkname cipherSuitesTLS13 crypto/tls.cipherSuitesTLS13 +var cipherSuitesTLS13 []unsafe.Pointer + +func cipherSuiteTLS13ByID(id uint16) *cipherSuiteTLS13 { + for _, v := range cipherSuitesTLS13 { + cs := (*cipherSuiteTLS13)(v) + if cs.ID == id { + return cs + } + } + return nil +} //go:linkname expandLabel crypto/tls.(*cipherSuiteTLS13).expandLabel func expandLabel(cs *cipherSuiteTLS13, secret []byte, label string, context []byte, length int) []byte