File tree 7 files changed +28
-2
lines changed 7 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 4
4
5
5
// Package aes implements AES encryption (formerly Rijndael), as defined in
6
6
// U.S. Federal Information Processing Standards Publication 197.
7
+ //
8
+ // The AES operations in this package are not implemented using constant-time algorithms.
9
+ // An exception is when running on systems with enabled hardware support for AES
10
+ // that makes these operations constant-time. Examples include amd64 systems using AES-NI
11
+ // extensions and s390x systems using Message-Security-Assist extensions.
12
+ // On such systems, when the result of NewCipher is passed to cipher.NewGCM,
13
+ // the GHASH operation used by GCM is also constant-time.
7
14
package aes
8
15
9
16
// This file contains AES constants - 8720 bytes of initialized data.
Original file line number Diff line number Diff line change @@ -74,6 +74,10 @@ type gcm struct {
74
74
75
75
// NewGCM returns the given 128-bit, block cipher wrapped in Galois Counter Mode
76
76
// with the standard nonce length.
77
+ //
78
+ // In general, the GHASH operation performed by this implementation of GCM is not constant-time.
79
+ // An exception is when the underlying Block was created by aes.NewCipher
80
+ // on systems with hardware support for AES. See the crypto/aes package documentation for details.
77
81
func NewGCM (cipher Block ) (AEAD , error ) {
78
82
return NewGCMWithNonceSize (cipher , gcmStandardNonceSize )
79
83
}
Original file line number Diff line number Diff line change 3
3
// license that can be found in the LICENSE file.
4
4
5
5
// Package dsa implements the Digital Signature Algorithm, as defined in FIPS 186-3.
6
+ //
7
+ // The DSA operations in this package are not implemented using constant-time algorithms.
6
8
package dsa
7
9
8
10
import (
Original file line number Diff line number Diff line change @@ -367,18 +367,24 @@ func initP521() {
367
367
}
368
368
369
369
// P256 returns a Curve which implements P-256 (see FIPS 186-3, section D.2.3)
370
+ //
371
+ // The cryptographic operations are implemented using constant-time algorithms.
370
372
func P256 () Curve {
371
373
initonce .Do (initAll )
372
374
return p256
373
375
}
374
376
375
377
// P384 returns a Curve which implements P-384 (see FIPS 186-3, section D.2.4)
378
+ //
379
+ // The cryptographic operations do not use constant-time algorithms.
376
380
func P384 () Curve {
377
381
initonce .Do (initAll )
378
382
return p384
379
383
}
380
384
381
385
// P521 returns a Curve which implements P-521 (see FIPS 186-3, section D.2.5)
386
+ //
387
+ // The cryptographic operations do not use constant-time algorithms.
382
388
func P521 () Curve {
383
389
initonce .Do (initAll )
384
390
return p521
Original file line number Diff line number Diff line change @@ -35,7 +35,9 @@ func initP224() {
35
35
p224FromBig (& p224 .b , p224 .B )
36
36
}
37
37
38
- // P224 returns a Curve which implements P-224 (see FIPS 186-3, section D.2.2)
38
+ // P224 returns a Curve which implements P-224 (see FIPS 186-3, section D.2.2).
39
+ //
40
+ // The cryptographic operations are implemented using constant-time algorithms.
39
41
func P224 () Curve {
40
42
initonce .Do (initAll )
41
43
return p224
Original file line number Diff line number Diff line change 18
18
// with v1.5/OAEP and signing/verifying with v1.5/PSS. If one needs to abstract
19
19
// over the public-key primitive, the PrivateKey struct implements the
20
20
// Decrypter and Signer interfaces from the crypto package.
21
+ //
22
+ // The RSA operations in this package are not implemented using constant-time algorithms.
21
23
package rsa
22
24
23
25
import (
Original file line number Diff line number Diff line change @@ -404,8 +404,11 @@ func (x *Int) BitLen() int {
404
404
405
405
// Exp sets z = x**y mod |m| (i.e. the sign of m is ignored), and returns z.
406
406
// If y <= 0, the result is 1 mod |m|; if m == nil or m == 0, z = x**y.
407
- // See Knuth, volume 2, section 4.6.3.
407
+ //
408
+ // Modular exponentation of inputs of a particular size is not a
409
+ // cryptographically constant-time operation.
408
410
func (z * Int ) Exp (x , y , m * Int ) * Int {
411
+ // See Knuth, volume 2, section 4.6.3.
409
412
var yWords nat
410
413
if ! y .neg {
411
414
yWords = y .abs
You can’t perform that action at this time.
0 commit comments