Skip to content

Commit af2952a

Browse files
FiloSottilegopherbot
authored andcommitted
math/big: add warning about using Int for cryptography
Change-Id: I31bec5d2b4a79a085942c7d380678379d99cf07b Reviewed-on: https://go-review.googlesource.com/c/go/+/455135 Auto-Submit: Filippo Valsorda <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]> Run-TryBot: Filippo Valsorda <[email protected]> Reviewed-by: Bryan Mills <[email protected]>
1 parent bf5ad8e commit af2952a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/math/big/int.go

+8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ import (
2222
// an existing (or newly allocated) Int must be set to
2323
// a new value using the Int.Set method; shallow copies
2424
// of Ints are not supported and may lead to errors.
25+
//
26+
// Note that methods may leak the Int's value through timing side-channels.
27+
// Because of this and because of the scope and complexity of the
28+
// implementation, Int is not well-suited to implement cryptographic operations.
29+
// The standard library avoids exposing non-trivial Int methods to
30+
// attacker-controlled inputs and the determination of whether a bug in math/big
31+
// is considered a security vulnerability might depend on the impact on the
32+
// standard library.
2533
type Int struct {
2634
neg bool // sign
2735
abs nat // absolute value of the integer

0 commit comments

Comments
 (0)