aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/cipher
diff options
context:
space:
mode:
authorcui fliter <imcusg@gmail.com>2023-10-12 18:08:04 +0800
committerGopher Robot <gobot@golang.org>2023-10-13 17:09:47 +0000
commita0da9c00aeb51261b9845a46fbc9878870884ab6 (patch)
tree1d18f8a34a9dea37cb1e04dc425208f3b1376445 /src/crypto/cipher
parent14c347f5ce924b5a0f05ec5737984cfeb294d9ac (diff)
downloadgo-a0da9c00aeb51261b9845a46fbc9878870884ab6.tar.xz
crypto: add available godoc link
Change-Id: Ifc669399dde7d6229c6ccdbe29611ed1f8698fb1 Reviewed-on: https://go-review.googlesource.com/c/go/+/534778 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: shuang cui <imcusg@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/crypto/cipher')
-rw-r--r--src/crypto/cipher/cfb.go8
-rw-r--r--src/crypto/cipher/ctr.go4
-rw-r--r--src/crypto/cipher/gcm.go8
-rw-r--r--src/crypto/cipher/io.go10
-rw-r--r--src/crypto/cipher/ofb.go2
5 files changed, 16 insertions, 16 deletions
diff --git a/src/crypto/cipher/cfb.go b/src/crypto/cipher/cfb.go
index aae3575da1..7e3f9695b7 100644
--- a/src/crypto/cipher/cfb.go
+++ b/src/crypto/cipher/cfb.go
@@ -50,15 +50,15 @@ func (x *cfb) XORKeyStream(dst, src []byte) {
}
}
-// NewCFBEncrypter returns a Stream which encrypts with cipher feedback mode,
-// using the given Block. The iv must be the same length as the Block's block
+// NewCFBEncrypter returns a [Stream] which encrypts with cipher feedback mode,
+// using the given [Block]. The iv must be the same length as the [Block]'s block
// size.
func NewCFBEncrypter(block Block, iv []byte) Stream {
return newCFB(block, iv, false)
}
-// NewCFBDecrypter returns a Stream which decrypts with cipher feedback mode,
-// using the given Block. The iv must be the same length as the Block's block
+// NewCFBDecrypter returns a [Stream] which decrypts with cipher feedback mode,
+// using the given [Block]. The iv must be the same length as the [Block]'s block
// size.
func NewCFBDecrypter(block Block, iv []byte) Stream {
return newCFB(block, iv, true)
diff --git a/src/crypto/cipher/ctr.go b/src/crypto/cipher/ctr.go
index 3ac0ff74d0..eac8e266cf 100644
--- a/src/crypto/cipher/ctr.go
+++ b/src/crypto/cipher/ctr.go
@@ -34,8 +34,8 @@ type ctrAble interface {
NewCTR(iv []byte) Stream
}
-// NewCTR returns a Stream which encrypts/decrypts using the given Block in
-// counter mode. The length of iv must be the same as the Block's block size.
+// NewCTR returns a [Stream] which encrypts/decrypts using the given [Block] in
+// counter mode. The length of iv must be the same as the [Block]'s block size.
func NewCTR(block Block, iv []byte) Stream {
if ctr, ok := block.(ctrAble); ok {
return ctr.NewCTR(iv)
diff --git a/src/crypto/cipher/gcm.go b/src/crypto/cipher/gcm.go
index 477d26a0e0..928771f05f 100644
--- a/src/crypto/cipher/gcm.go
+++ b/src/crypto/cipher/gcm.go
@@ -80,8 +80,8 @@ type gcm struct {
// with the standard nonce length.
//
// In general, the GHASH operation performed by this implementation of GCM is not constant-time.
-// An exception is when the underlying Block was created by aes.NewCipher
-// on systems with hardware support for AES. See the crypto/aes package documentation for details.
+// An exception is when the underlying [Block] was created by aes.NewCipher
+// on systems with hardware support for AES. See the [crypto/aes] package documentation for details.
func NewGCM(cipher Block) (AEAD, error) {
return newGCMWithNonceAndTagSize(cipher, gcmStandardNonceSize, gcmTagSize)
}
@@ -92,7 +92,7 @@ func NewGCM(cipher Block) (AEAD, error) {
//
// Only use this function if you require compatibility with an existing
// cryptosystem that uses non-standard nonce lengths. All other users should use
-// NewGCM, which is faster and more resistant to misuse.
+// [NewGCM], which is faster and more resistant to misuse.
func NewGCMWithNonceSize(cipher Block, size int) (AEAD, error) {
return newGCMWithNonceAndTagSize(cipher, size, gcmTagSize)
}
@@ -104,7 +104,7 @@ func NewGCMWithNonceSize(cipher Block, size int) (AEAD, error) {
//
// Only use this function if you require compatibility with an existing
// cryptosystem that uses non-standard tag lengths. All other users should use
-// NewGCM, which is more resistant to misuse.
+// [NewGCM], which is more resistant to misuse.
func NewGCMWithTagSize(cipher Block, tagSize int) (AEAD, error) {
return newGCMWithNonceAndTagSize(cipher, gcmStandardNonceSize, tagSize)
}
diff --git a/src/crypto/cipher/io.go b/src/crypto/cipher/io.go
index 0974ac748e..b70285b406 100644
--- a/src/crypto/cipher/io.go
+++ b/src/crypto/cipher/io.go
@@ -9,7 +9,7 @@ import "io"
// The Stream* objects are so simple that all their members are public. Users
// can create them themselves.
-// StreamReader wraps a Stream into an io.Reader. It calls XORKeyStream
+// StreamReader wraps a [Stream] into an [io.Reader]. It calls XORKeyStream
// to process each slice of data which passes through.
type StreamReader struct {
S Stream
@@ -22,10 +22,10 @@ func (r StreamReader) Read(dst []byte) (n int, err error) {
return
}
-// StreamWriter wraps a Stream into an io.Writer. It calls XORKeyStream
-// to process each slice of data which passes through. If any Write call
-// returns short then the StreamWriter is out of sync and must be discarded.
-// A StreamWriter has no internal buffering; Close does not need
+// StreamWriter wraps a [Stream] into an io.Writer. It calls XORKeyStream
+// to process each slice of data which passes through. If any [StreamWriter.Write]
+// call returns short then the StreamWriter is out of sync and must be discarded.
+// A StreamWriter has no internal buffering; [StreamWriter.Close] does not need
// to be called to flush write data.
type StreamWriter struct {
S Stream
diff --git a/src/crypto/cipher/ofb.go b/src/crypto/cipher/ofb.go
index 1195fdd45a..bdfc977d5e 100644
--- a/src/crypto/cipher/ofb.go
+++ b/src/crypto/cipher/ofb.go
@@ -18,7 +18,7 @@ type ofb struct {
outUsed int
}
-// NewOFB returns a Stream that encrypts or decrypts using the block cipher b
+// NewOFB returns a [Stream] that encrypts or decrypts using the block cipher b
// in output feedback mode. The initialization vector iv's length must be equal
// to b's block size.
func NewOFB(b Block, iv []byte) Stream {