Skip to content

Commit

Permalink
improvement: maintenance+cleanup+fix (#252)
Browse files Browse the repository at this point in the history
* ci: use latest Go 1.21 build

Use `1.21.x` instead of `1.21.0` to automatically select the latest.

* fix: remove unused fipsonly package

Remove an unused package that was unintendedly introduced as a conditional dependency of upstream

* update: use boring package not global var

Align with the upstream to use `boring` as a name for a package. No functional changes.

* new: name aliasing

Create u_alias.go to hold any alias names created by version upgrades or other necessary changes (e.g., upstream breaking change) to prevent further breaking the API.
  • Loading branch information
gaukas committed Oct 10, 2023
1 parent 428ca2c commit e89d82c
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "windows-latest", "macos-latest" ]
go: [ "1.20.x", "1.21.0" ]
go: [ "1.20.x", "1.21.x" ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions cipher_suites.go
Expand Up @@ -19,6 +19,7 @@ import (
"hash"
"runtime"

"github.com/refraction-networking/utls/internal/boring"
"golang.org/x/sys/cpu"

"golang.org/x/crypto/chacha20poly1305"
Expand Down
29 changes: 0 additions & 29 deletions fipsonly/fipsonly.go

This file was deleted.

18 changes: 0 additions & 18 deletions fipsonly/fipsonly_test.go

This file was deleted.

16 changes: 16 additions & 0 deletions internal/boring/notboring.go
@@ -0,0 +1,16 @@
package boring

import (
"crypto/cipher"
"errors"
)

const Enabled bool = false

func NewGCMTLS(_ cipher.Block) (cipher.AEAD, error) {
return nil, errors.New("boring not implemented")
}

func Unreachable() {
// do nothing
}
22 changes: 0 additions & 22 deletions notboring.go
Expand Up @@ -3,11 +3,6 @@
// license that can be found in the LICENSE file.
package tls

import (
"crypto/cipher"
"errors"
)

func needFIPS() bool { return false }

func supportedSignatureAlgorithms() []SignatureScheme {
Expand All @@ -20,20 +15,3 @@ func fipsCurvePreferences(c *Config) []CurveID { panic("fipsCurvePreferences") }
func fipsCipherSuites(c *Config) []uint16 { panic("fipsCipherSuites") }

var fipsSupportedSignatureAlgorithms []SignatureScheme

// [uTLS]
// Boring struct is only to be used to record static env variables
// in boring package. We do not implement BoringSSL compatibliity here.
type Boring struct {
Enabled bool
}

func (*Boring) NewGCMTLS(_ cipher.Block) (cipher.AEAD, error) {
return nil, errors.New("boring not implemented")
}

func (*Boring) Unreachable() {
// do nothing
}

var boring Boring
12 changes: 12 additions & 0 deletions u_alias.go
@@ -0,0 +1,12 @@
package tls

// This file contains all the alias functions, symbols, names, etc. that
// was once used in the old version of the library. This is to ensure
// backwards compatibility with the old version of the library.

// TLS Extensions

// UtlsExtendedMasterSecretExtension is an alias for ExtendedMasterSecretExtension.
//
// Deprecated: Use ExtendedMasterSecretExtension instead.
type UtlsExtendedMasterSecretExtension = ExtendedMasterSecretExtension

0 comments on commit e89d82c

Please sign in to comment.