Skip to content

Commit a6a393f

Browse files
FiloSottilegopherbot
authored andcommitted
all: bump go.mod version and drop compatibility shims
Also, remove the legacy import annotations. Fixes golang/go#68147 Change-Id: Ibfcc9322f27224c0ba92ea42cd56912a7d8783fd Reviewed-on: https://go-review.googlesource.com/c/crypto/+/594256 Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Filippo Valsorda <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]>
1 parent 1c74500 commit a6a393f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+110
-2532
lines changed

acme/http.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"io"
1616
"math/big"
1717
"net/http"
18+
"runtime/debug"
1819
"strconv"
1920
"strings"
2021
"time"
@@ -271,9 +272,27 @@ func (c *Client) httpClient() *http.Client {
271272
}
272273

273274
// packageVersion is the version of the module that contains this package, for
274-
// sending as part of the User-Agent header. It's set in version_go112.go.
275+
// sending as part of the User-Agent header.
275276
var packageVersion string
276277

278+
func init() {
279+
// Set packageVersion if the binary was built in modules mode and x/crypto
280+
// was not replaced with a different module.
281+
info, ok := debug.ReadBuildInfo()
282+
if !ok {
283+
return
284+
}
285+
for _, m := range info.Deps {
286+
if m.Path != "golang.org/x/crypto" {
287+
continue
288+
}
289+
if m.Replace == nil {
290+
packageVersion = m.Version
291+
}
292+
break
293+
}
294+
}
295+
277296
// userAgent returns the User-Agent header value. It includes the package name,
278297
// the module version (if available), and the c.UserAgent value (if set).
279298
func (c *Client) userAgent() string {

acme/version_go112.go

Lines changed: 0 additions & 27 deletions
This file was deleted.

bcrypt/bcrypt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing
66
// algorithm. See http://www.usenix.org/event/usenix99/provos/provos.pdf
7-
package bcrypt // import "golang.org/x/crypto/bcrypt"
7+
package bcrypt
88

99
// The code is a port of Provos and Mazières's C implementation.
1010
import (

blake2s/blake2s.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
//
1717
// BLAKE2X is a construction to compute hash values larger than 32 bytes. It
1818
// can produce hash values between 0 and 65535 bytes.
19-
package blake2s // import "golang.org/x/crypto/blake2s"
19+
package blake2s
2020

2121
import (
22+
"crypto"
2223
"encoding/binary"
2324
"errors"
2425
"hash"
@@ -55,6 +56,13 @@ func Sum256(data []byte) [Size]byte {
5556
// and BinaryUnmarshaler for state (de)serialization as documented by hash.Hash.
5657
func New256(key []byte) (hash.Hash, error) { return newDigest(Size, key) }
5758

59+
func init() {
60+
crypto.RegisterHash(crypto.BLAKE2s_256, func() hash.Hash {
61+
h, _ := New256(nil)
62+
return h
63+
})
64+
}
65+
5866
// New128 returns a new hash.Hash computing the BLAKE2s-128 checksum given a
5967
// non-empty key. Note that a 128-bit digest is too small to be secure as a
6068
// cryptographic hash and should only be used as a MAC, thus the key argument

blake2s/register.go

Lines changed: 0 additions & 21 deletions
This file was deleted.

blowfish/cipher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Deprecated: any new system should use AES (from crypto/aes, if necessary in
1212
// an AEAD mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from
1313
// golang.org/x/crypto/chacha20poly1305).
14-
package blowfish // import "golang.org/x/crypto/blowfish"
14+
package blowfish
1515

1616
// The code is a port of Bruce Schneier's C implementation.
1717
// See https://www.schneier.com/blowfish.html.

bn256/bn256.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// elliptic curve. This package is frozen, and not implemented in constant time.
2424
// There is a more complete implementation at github.com/cloudflare/bn256, but
2525
// note that it suffers from the same security issues of the underlying curve.
26-
package bn256 // import "golang.org/x/crypto/bn256"
26+
package bn256
2727

2828
import (
2929
"crypto/rand"

cast5/cast5.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Deprecated: any new system should use AES (from crypto/aes, if necessary in
1212
// an AEAD mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from
1313
// golang.org/x/crypto/chacha20poly1305).
14-
package cast5 // import "golang.org/x/crypto/cast5"
14+
package cast5
1515

1616
import (
1717
"errors"

chacha20poly1305/chacha20poly1305.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Package chacha20poly1305 implements the ChaCha20-Poly1305 AEAD and its
66
// extended nonce variant XChaCha20-Poly1305, as specified in RFC 8439 and
77
// draft-irtf-cfrg-xchacha-01.
8-
package chacha20poly1305 // import "golang.org/x/crypto/chacha20poly1305"
8+
package chacha20poly1305
99

1010
import (
1111
"crypto/cipher"

cryptobyte/asn1/asn1.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// Package asn1 contains supporting types for parsing and building ASN.1
66
// messages with the cryptobyte package.
7-
package asn1 // import "golang.org/x/crypto/cryptobyte/asn1"
7+
package asn1
88

99
// Tag represents an ASN.1 identifier octet, consisting of a tag number
1010
// (indicating a type) and class (such as context-specific or constructed).

0 commit comments

Comments
 (0)