Package: golang-github-lucas-clemente-quic-go
Followup-For: Bug #1016779
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu kinetic ubuntu-patch
Control: tags -1 patch

Dear Maintainer,

As noted in this bug, golang-github-lucas-clemente-quic-go FTBFS with
Go 1.19. This patch cherry picks the minimum change from upstream to
resolve this issue. Note that it won't build until there is a new
version of golang-github-marten-seemann-qtls-go1-19 packaged in Debian.
I have filed https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1017034
towards this end.

In Ubuntu, the attached patch was applied to achieve the following:


  * Update from upstream to build qtls with Go 1.19.


Thanks for considering the patch.


-- System Information:
Debian Release: bookworm/sid
  APT prefers kinetic
  APT policy: (500, 'kinetic')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.15.0-27-generic (SMP w/32 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru golang-github-lucas-clemente-quic-go-0.26.0/debian/control 
golang-github-lucas-clemente-quic-go-0.26.0/debian/control
--- golang-github-lucas-clemente-quic-go-0.26.0/debian/control  2022-04-01 
15:00:32.000000000 -0500
+++ golang-github-lucas-clemente-quic-go-0.26.0/debian/control  2022-08-11 
13:18:49.000000000 -0500
@@ -15,7 +15,7 @@
  golang-github-francoispqt-gojay-dev,
  golang-github-golang-mock-dev,
  golang-github-marten-seemann-qpack-dev,
- golang-github-marten-seemann-qtls-go1-18-dev,
+ golang-github-marten-seemann-qtls-go1-19-dev,
  golang-github-onsi-ginkgo-dev (>= 1.14.2),
  golang-go.opencensus-dev,
  golang-golang-x-crypto-dev,
@@ -38,7 +38,7 @@
  golang-github-cheekybits-genny-dev,
  golang-github-francoispqt-gojay-dev,
  golang-github-marten-seemann-qpack-dev,
- golang-github-marten-seemann-qtls-go1-18-dev,
+ golang-github-marten-seemann-qtls-go1-19-dev,
  golang-go.opencensus-dev,
  golang-golang-x-crypto-dev,
  golang-golang-x-net-dev,
diff -Nru 
golang-github-lucas-clemente-quic-go-0.26.0/debian/patches/0005-qtls-go-119.patch
 
golang-github-lucas-clemente-quic-go-0.26.0/debian/patches/0005-qtls-go-119.patch
--- 
golang-github-lucas-clemente-quic-go-0.26.0/debian/patches/0005-qtls-go-119.patch
   1969-12-31 18:00:00.000000000 -0600
+++ 
golang-github-lucas-clemente-quic-go-0.26.0/debian/patches/0005-qtls-go-119.patch
   2022-08-11 13:18:49.000000000 -0500
@@ -0,0 +1,152 @@
+Description: Update to build with qtls-go1-19
+ This package has a dependency that is packaged separately per
+ Go version: golang-github-marten-seemann-qtls-go1-x. This patch
+ is the minimal change from upstream to allow this package to be
+ built against Go 1.19. This patch should be dropped when a new
+ upstream version of this repository is packaged.
+Origin: upstream, 
https://github.com/lucas-clemente/quic-go/commit/ea9de26ed5499336234b8a7dfc56e9516898a3db
+Last-Update: 2022-08-12
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: golang-github-lucas-clemente-quic-go-0.26.0/internal/qtls/go119.go
+===================================================================
+--- golang-github-lucas-clemente-quic-go-0.26.0.orig/internal/qtls/go119.go
++++ golang-github-lucas-clemente-quic-go-0.26.0/internal/qtls/go119.go
+@@ -1,6 +1,99 @@
+ //go:build go1.19
+-// +build go1.19
+ 
+ package qtls
+ 
+-var _ int = "quic-go doesn't build on Go 1.19 yet."
++import (
++      "crypto"
++      "crypto/cipher"
++      "crypto/tls"
++      "net"
++      "unsafe"
++
++      "github.com/marten-seemann/qtls-go1-19"
++)
++
++type (
++      // Alert is a TLS alert
++      Alert = qtls.Alert
++      // A Certificate is qtls.Certificate.
++      Certificate = qtls.Certificate
++      // CertificateRequestInfo contains information about a certificate 
request.
++      CertificateRequestInfo = qtls.CertificateRequestInfo
++      // A CipherSuiteTLS13 is a cipher suite for TLS 1.3
++      CipherSuiteTLS13 = qtls.CipherSuiteTLS13
++      // ClientHelloInfo contains information about a ClientHello.
++      ClientHelloInfo = qtls.ClientHelloInfo
++      // ClientSessionCache is a cache used for session resumption.
++      ClientSessionCache = qtls.ClientSessionCache
++      // ClientSessionState is a state needed for session resumption.
++      ClientSessionState = qtls.ClientSessionState
++      // A Config is a qtls.Config.
++      Config = qtls.Config
++      // A Conn is a qtls.Conn.
++      Conn = qtls.Conn
++      // ConnectionState contains information about the state of the 
connection.
++      ConnectionState = qtls.ConnectionStateWith0RTT
++      // EncryptionLevel is the encryption level of a message.
++      EncryptionLevel = qtls.EncryptionLevel
++      // Extension is a TLS extension
++      Extension = qtls.Extension
++      // ExtraConfig is the qtls.ExtraConfig
++      ExtraConfig = qtls.ExtraConfig
++      // RecordLayer is a qtls RecordLayer.
++      RecordLayer = qtls.RecordLayer
++)
++
++const (
++      // EncryptionHandshake is the Handshake encryption level
++      EncryptionHandshake = qtls.EncryptionHandshake
++      // Encryption0RTT is the 0-RTT encryption level
++      Encryption0RTT = qtls.Encryption0RTT
++      // EncryptionApplication is the application data encryption level
++      EncryptionApplication = qtls.EncryptionApplication
++)
++
++// AEADAESGCMTLS13 creates a new AES-GCM AEAD for TLS 1.3
++func AEADAESGCMTLS13(key, fixedNonce []byte) cipher.AEAD {
++      return qtls.AEADAESGCMTLS13(key, fixedNonce)
++}
++
++// Client returns a new TLS client side connection.
++func Client(conn net.Conn, config *Config, extraConfig *ExtraConfig) *Conn {
++      return qtls.Client(conn, config, extraConfig)
++}
++
++// Server returns a new TLS server side connection.
++func Server(conn net.Conn, config *Config, extraConfig *ExtraConfig) *Conn {
++      return qtls.Server(conn, config, extraConfig)
++}
++
++func GetConnectionState(conn *Conn) ConnectionState {
++      return conn.ConnectionStateWith0RTT()
++}
++
++// ToTLSConnectionState extracts the tls.ConnectionState
++func ToTLSConnectionState(cs ConnectionState) tls.ConnectionState {
++      return cs.ConnectionState
++}
++
++type cipherSuiteTLS13 struct {
++      ID     uint16
++      KeyLen int
++      AEAD   func(key, fixedNonce []byte) cipher.AEAD
++      Hash   crypto.Hash
++}
++
++//go:linkname cipherSuiteTLS13ByID 
github.com/marten-seemann/qtls-go1-19.cipherSuiteTLS13ByID
++func cipherSuiteTLS13ByID(id uint16) *cipherSuiteTLS13
++
++// CipherSuiteTLS13ByID gets a TLS 1.3 cipher suite.
++func CipherSuiteTLS13ByID(id uint16) *CipherSuiteTLS13 {
++      val := cipherSuiteTLS13ByID(id)
++      cs := (*cipherSuiteTLS13)(unsafe.Pointer(val))
++      return &qtls.CipherSuiteTLS13{
++              ID:     cs.ID,
++              KeyLen: cs.KeyLen,
++              AEAD:   cs.AEAD,
++              Hash:   cs.Hash,
++      }
++}
+Index: golang-github-lucas-clemente-quic-go-0.26.0/go.mod
+===================================================================
+--- golang-github-lucas-clemente-quic-go-0.26.0.orig/go.mod
++++ golang-github-lucas-clemente-quic-go-0.26.0/go.mod
+@@ -10,6 +10,7 @@
+       github.com/marten-seemann/qtls-go1-16 v0.1.5
+       github.com/marten-seemann/qtls-go1-17 v0.1.1
+       github.com/marten-seemann/qtls-go1-18 v0.1.1
++      github.com/marten-seemann/qtls-go1-19 v0.1.0
+       github.com/onsi/ginkgo v1.16.4
+       github.com/onsi/gomega v1.13.0
+       golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
+Index: golang-github-lucas-clemente-quic-go-0.26.0/go.sum
+===================================================================
+--- golang-github-lucas-clemente-quic-go-0.26.0.orig/go.sum
++++ golang-github-lucas-clemente-quic-go-0.26.0/go.sum
+@@ -86,6 +86,8 @@
+ github.com/marten-seemann/qtls-go1-17 v0.1.1/go.mod 
h1:C2ekUKcDdz9SDWxec1N/MvcXBpaX9l3Nx67XaR84L5s=
+ github.com/marten-seemann/qtls-go1-18 v0.1.1 
h1:qp7p7XXUFL7fpBvSS1sWD+uSqPvzNQK43DH+/qEkj0Y=
+ github.com/marten-seemann/qtls-go1-18 v0.1.1/go.mod 
h1:mJttiymBAByA49mhlNZZGrH5u1uXYZJ+RW28Py7f4m4=
++github.com/marten-seemann/qtls-go1-19 v0.1.0 
h1:rLFKD/9mp/uq1SYGYuVZhm83wkmU95pK5df3GufyYYU=
++github.com/marten-seemann/qtls-go1-19 v0.1.0/go.mod 
h1:5HTDWtVudo/WFsHKRNuOhWlbdjrfs5JHrYb0wIJqGpI=
+ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod 
h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
+ github.com/microcosm-cc/bluemonday v1.0.1/go.mod 
h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4=
+ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod 
h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+Index: golang-github-lucas-clemente-quic-go-0.26.0/internal/qtls/go118.go
+===================================================================
+--- golang-github-lucas-clemente-quic-go-0.26.0.orig/internal/qtls/go118.go
++++ golang-github-lucas-clemente-quic-go-0.26.0/internal/qtls/go118.go
+@@ -1,5 +1,4 @@
+-//go:build go1.18
+-// +build go1.18
++//go:build go1.18 && !go1.19
+ 
+ package qtls
+ 
diff -Nru golang-github-lucas-clemente-quic-go-0.26.0/debian/patches/series 
golang-github-lucas-clemente-quic-go-0.26.0/debian/patches/series
--- golang-github-lucas-clemente-quic-go-0.26.0/debian/patches/series   
2022-03-25 13:38:00.000000000 -0500
+++ golang-github-lucas-clemente-quic-go-0.26.0/debian/patches/series   
2022-08-11 13:18:49.000000000 -0500
@@ -1,2 +1,3 @@
 0001-Skip-test-takes-bit-long-time.patch
 0004-increase-test-timeout.patch
+0005-qtls-go-119.patch

Reply via email to