Skip to content

Commit a573983

Browse files
committed
all: deprecate broken and legacy packages
Fixes golang/go#30141 Change-Id: I76f8eae31cfd6d106440114685cc0d9abba374f8 Reviewed-on: https://go-review.googlesource.com/c/163537 Reviewed-by: Adam Langley <[email protected]>
1 parent a4c6cb3 commit a573983

File tree

10 files changed

+67
-12
lines changed

10 files changed

+67
-12
lines changed

Diff for: blowfish/cipher.go

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
// license that can be found in the LICENSE file.
44

55
// Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.
6+
//
7+
// Blowfish is a legacy cipher and its short block size makes it vulnerable to
8+
// birthday bound attacks (see https://sweet32.info). It should only be used
9+
// where compatibility with legacy systems, not security, is the goal.
10+
//
11+
// Deprecated: any new system should use AES (from crypto/aes, if necessary in
12+
// an AEAD mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from
13+
// golang.org/x/crypto/chacha20poly1305).
614
package blowfish // import "golang.org/x/crypto/blowfish"
715

816
// The code is a port of Bruce Schneier's C implementation.

Diff for: bn256/bn256.go

+11-7
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@
1515
// http://cryptojedi.org/papers/dclxvi-20100714.pdf. Its output is compatible
1616
// with the implementation described in that paper.
1717
//
18-
// (This package previously claimed to operate at a 128-bit security level.
18+
// This package previously claimed to operate at a 128-bit security level.
1919
// However, recent improvements in attacks mean that is no longer true. See
20-
// https://moderncrypto.org/mail-archive/curves/2016/000740.html.)
20+
// https://moderncrypto.org/mail-archive/curves/2016/000740.html.
21+
//
22+
// Deprecated: due to its weakened security, new systems should not rely on this
23+
// elliptic curve. This package is frozen, and not implemented in constant time.
24+
// There is a more complete implementation at github.com/cloudflare/bn256, but
25+
// note that it suffers from the same security issues of the underlying curve.
2126
package bn256 // import "golang.org/x/crypto/bn256"
2227

2328
import (
@@ -26,9 +31,6 @@ import (
2631
"math/big"
2732
)
2833

29-
// BUG(agl): this implementation is not constant time.
30-
// TODO(agl): keep GF(p²) elements in Mongomery form.
31-
3234
// G1 is an abstract cyclic group. The zero value is suitable for use as the
3335
// output of an operation, but cannot be used as an input.
3436
type G1 struct {
@@ -77,7 +79,8 @@ func (e *G1) ScalarMult(a *G1, k *big.Int) *G1 {
7779
}
7880

7981
// Add sets e to a+b and then returns e.
80-
// BUG(agl): this function is not complete: a==b fails.
82+
//
83+
// Warning: this function is not complete, it fails for a equal to b.
8184
func (e *G1) Add(a, b *G1) *G1 {
8285
if e.p == nil {
8386
e.p = newCurvePoint(nil)
@@ -198,7 +201,8 @@ func (e *G2) ScalarMult(a *G2, k *big.Int) *G2 {
198201
}
199202

200203
// Add sets e to a+b and then returns e.
201-
// BUG(agl): this function is not complete: a==b fails.
204+
//
205+
// Warning: this function is not complete, it fails for a equal to b.
202206
func (e *G2) Add(a, b *G2) *G2 {
203207
if e.p == nil {
204208
e.p = newTwistPoint(nil)

Diff for: cast5/cast5.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// Package cast5 implements CAST5, as defined in RFC 2144. CAST5 is a common
6-
// OpenPGP cipher.
5+
// Package cast5 implements CAST5, as defined in RFC 2144.
6+
//
7+
// CAST5 is a legacy cipher and its short block size makes it vulnerable to
8+
// birthday bound attacks (see https://sweet32.info). It should only be used
9+
// where compatibility with legacy systems, not security, is the goal.
10+
//
11+
// Deprecated: any new system should use AES (from crypto/aes, if necessary in
12+
// an AEAD mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from
13+
// golang.org/x/crypto/chacha20poly1305).
714
package cast5 // import "golang.org/x/crypto/cast5"
815

916
import "errors"

Diff for: md4/md4.go

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
// license that can be found in the LICENSE file.
44

55
// Package md4 implements the MD4 hash algorithm as defined in RFC 1320.
6+
//
7+
// Deprecated: MD4 is cryptographically broken and should should only be used
8+
// where compatibility with legacy systems, not security, is the goal. Instead,
9+
// use a secure hash like SHA-256 (from crypto/sha256).
610
package md4 // import "golang.org/x/crypto/md4"
711

812
import (

Diff for: otr/otr.go

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
// Package otr implements the Off The Record protocol as specified in
66
// http://www.cypherpunks.ca/otr/Protocol-v2-3.1.0.html
7+
//
8+
// The version of OTR implemented by this package has been deprecated
9+
// (https://bugs.otr.im/lib/libotr/issues/140). An implementation of OTRv3 is
10+
// available at https://github.com/coyim/otr3.
711
package otr // import "golang.org/x/crypto/otr"
812

913
import (

Diff for: ripemd160/ripemd160.go

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
// license that can be found in the LICENSE file.
44

55
// Package ripemd160 implements the RIPEMD-160 hash algorithm.
6+
//
7+
// Deprecated: RIPEMD-160 is a legacy hash and should not be used for new
8+
// applications. Also, this package does not and will not provide an optimized
9+
// implementation. Instead, use a modern hash like SHA-256 (from crypto/sha256).
610
package ripemd160 // import "golang.org/x/crypto/ripemd160"
711

812
// RIPEMD-160 is designed by Hans Dobbertin, Antoon Bosselaers, and Bart

Diff for: tea/cipher.go

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
// Package tea implements the TEA algorithm, as defined in Needham and
66
// Wheeler's 1994 technical report, “TEA, a Tiny Encryption Algorithm”. See
77
// http://www.cix.co.uk/~klockstone/tea.pdf for details.
8+
//
9+
// TEA is a legacy cipher and its short block size makes it vulnerable to
10+
// birthday bound attacks (see https://sweet32.info). It should only be used
11+
// where compatibility with legacy systems, not security, is the goal.
12+
//
13+
// Deprecated: any new system should use AES (from crypto/aes, if necessary in
14+
// an AEAD mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from
15+
// golang.org/x/crypto/chacha20poly1305).
816
package tea
917

1018
import (

Diff for: twofish/twofish.go

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
// license that can be found in the LICENSE file.
44

55
// Package twofish implements Bruce Schneier's Twofish encryption algorithm.
6+
//
7+
// Deprecated: Twofish is a legacy cipher and should not be used for new
8+
// applications. Also, this package does not and will not provide an optimized
9+
// implementation. Instead, use AES (from crypto/aes, if necessary in an AEAD
10+
// mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from
11+
// golang.org/x/crypto/chacha20poly1305).
612
package twofish // import "golang.org/x/crypto/twofish"
713

814
// Twofish is defined in https://www.schneier.com/paper-twofish-paper.pdf [TWOFISH]

Diff for: xtea/cipher.go

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
// Package xtea implements XTEA encryption, as defined in Needham and Wheeler's
66
// 1997 technical report, "Tea extensions."
7+
//
8+
// XTEA is a legacy cipher and its short block size makes it vulnerable to
9+
// birthday bound attacks (see https://sweet32.info). It should only be used
10+
// where compatibility with legacy systems, not security, is the goal.
11+
//
12+
// Deprecated: any new system should use AES (from crypto/aes, if necessary in
13+
// an AEAD mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from
14+
// golang.org/x/crypto/chacha20poly1305).
715
package xtea // import "golang.org/x/crypto/xtea"
816

917
// For details, see http://www.cix.co.uk/~klockstone/xtea.pdf

Diff for: xts/xts.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
// effectively create a unique key for each sector.
1616
//
1717
// XTS does not provide any authentication. An attacker can manipulate the
18-
// ciphertext and randomise a block (16 bytes) of the plaintext.
18+
// ciphertext and randomise a block (16 bytes) of the plaintext. This package
19+
// does not implement ciphertext-stealing so sectors must be a multiple of 16
20+
// bytes.
1921
//
20-
// (Note: this package does not implement ciphertext-stealing so sectors must
21-
// be a multiple of 16 bytes.)
22+
// Note that XTS is usually not appropriate for any use besides disk encryption.
23+
// Most users should use an AEAD mode like GCM (from crypto/cipher.NewGCM) instead.
2224
package xts // import "golang.org/x/crypto/xts"
2325

2426
import (

0 commit comments

Comments
 (0)