]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/rsa: clarify comment on maximum message length.
authorNigel Tao <nigeltao@golang.org>
Thu, 22 Sep 2016 00:58:43 +0000 (10:58 +1000)
committerNigel Tao <nigeltao@golang.org>
Thu, 22 Sep 2016 03:06:25 +0000 (03:06 +0000)
See https://groups.google.com/d/topic/golang-nuts/stbum5gZbAc/discussion

Change-Id: I2e78e8d0dadd78c8b0389514cad3c45d061b663b
Reviewed-on: https://go-review.googlesource.com/29496
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/crypto/rsa/rsa.go

index 94862597dc719ffa4e7d34de245be3fd901c0b56..f809a9b9bc888e186fe9176124a16f5d9f479393 100644 (file)
@@ -362,8 +362,8 @@ func encrypt(c *big.Int, pub *PublicKey, m *big.Int) *big.Int {
 // values could be used to ensure that a ciphertext for one purpose cannot be
 // used for another by an attacker. If not required it can be empty.
 //
-// The message must be no longer than the length of the public modulus less
-// twice the hash length plus 2.
+// The message must be no longer than the length of the public modulus minus
+// twice the hash length, minus a further 2.
 func EncryptOAEP(hash hash.Hash, random io.Reader, pub *PublicKey, msg []byte, label []byte) ([]byte, error) {
        if err := checkPub(pub); err != nil {
                return nil, err