Skip to content

Commit da1f5d3

Browse files
committed
[release-branch.go1.12] crypto/rc4: remove false guarantees from Reset docs and deprecate it
Nothing in Go can truly guarantee a key will be gone from memory (see #21865), so remove that claim. That makes Reset useless, because unlike most Reset methods it doesn't restore the original value state, so deprecate it. Change-Id: I6bb0f7f94c7e6dd4c5ac19761bc8e5df1f9ec618 Reviewed-on: https://go-review.googlesource.com/c/162297 Reviewed-by: Brad Fitzpatrick <[email protected]> (cherry picked from commit b35daca) Reviewed-on: https://go-review.googlesource.com/c/163438
1 parent 35e6a10 commit da1f5d3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/crypto/rc4/rc4.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ func NewCipher(key []byte) (*Cipher, error) {
4545
return &c, nil
4646
}
4747

48-
// Reset zeros the key data so that it will no longer appear in the
49-
// process's memory.
48+
// Reset zeros the key data and makes the Cipher unusable.
49+
//
50+
// Deprecated: Reset can't guarantee that the key will be entirely removed from
51+
// the process's memory.
5052
func (c *Cipher) Reset() {
5153
for i := range c.s {
5254
c.s[i] = 0

0 commit comments

Comments
 (0)