Skip to content

Commit 0997000

Browse files
cuishuanggopherbot
authored andcommitted
all: fix some comments
Change-Id: I0395c5db6edd7d90f9ec1dadbe881a77c906c732 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/713120 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Daniel McCarney <daniel@binaryparadox.net> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Sean Liao <sean@liao.dev> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Michael Knyszek <mknyszek@google.com>
1 parent 017a1aa commit 0997000

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

acme/pebble_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ func prepareBinaries(t *testing.T, pebbleDir string) string {
757757

758758
// We don't want to build in the module cache dir, which might not be
759759
// writable or to pollute the user's clone with binaries if pebbleLocalDir
760-
//is used.
760+
// is used.
761761
binDir := t.TempDir()
762762

763763
build := func(cmd string) {

argon2/argon2.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Argon2 was selected as the winner of the Password Hashing Competition and can
77
// be used to derive cryptographic keys from passwords.
88
//
9-
// For a detailed specification of Argon2 see [1].
9+
// For a detailed specification of Argon2 see [argon2-specs.pdf].
1010
//
1111
// If you aren't sure which function you need, use Argon2id (IDKey) and
1212
// the parameter recommendations for your scenario.
@@ -17,7 +17,7 @@
1717
// It uses data-independent memory access, which is preferred for password
1818
// hashing and password-based key derivation. Argon2i requires more passes over
1919
// memory than Argon2id to protect from trade-off attacks. The recommended
20-
// parameters (taken from [2]) for non-interactive operations are time=3 and to
20+
// parameters (taken from [RFC 9106 Section 7.3]) for non-interactive operations are time=3 and to
2121
// use the maximum available memory.
2222
//
2323
// # Argon2id
@@ -27,11 +27,11 @@
2727
// half of the first iteration over the memory and data-dependent memory access
2828
// for the rest. Argon2id is side-channel resistant and provides better brute-
2929
// force cost savings due to time-memory tradeoffs than Argon2i. The recommended
30-
// parameters for non-interactive operations (taken from [2]) are time=1 and to
30+
// parameters for non-interactive operations (taken from [RFC 9106 Section 7.3]) are time=1 and to
3131
// use the maximum available memory.
3232
//
33-
// [1] https://github.com/P-H-C/phc-winner-argon2/blob/master/argon2-specs.pdf
34-
// [2] https://tools.ietf.org/html/draft-irtf-cfrg-argon2-03#section-9.3
33+
// [argon2-specs.pdf]: https://github.com/P-H-C/phc-winner-argon2/blob/master/argon2-specs.pdf
34+
// [RFC 9106 Section 7.3]: https://www.rfc-editor.org/rfc/rfc9106.html#section-7.3
3535
package argon2
3636

3737
import (
@@ -59,7 +59,7 @@ const (
5959
//
6060
// key := argon2.Key([]byte("some password"), salt, 3, 32*1024, 4, 32)
6161
//
62-
// The draft RFC recommends[2] time=3, and memory=32*1024 is a sensible number.
62+
// [RFC 9106 Section 7.3] recommends time=3, and memory=32*1024 as a sensible number.
6363
// If using that amount of memory (32 MB) is not possible in some contexts then
6464
// the time parameter can be increased to compensate.
6565
//
@@ -69,6 +69,8 @@ const (
6969
// adjusted to the number of available CPUs. The cost parameters should be
7070
// increased as memory latency and CPU parallelism increases. Remember to get a
7171
// good random salt.
72+
//
73+
// [RFC 9106 Section 7.3]: https://www.rfc-editor.org/rfc/rfc9106.html#section-7.3
7274
func Key(password, salt []byte, time, memory uint32, threads uint8, keyLen uint32) []byte {
7375
return deriveKey(argon2i, password, salt, nil, nil, time, memory, threads, keyLen)
7476
}
@@ -83,7 +85,7 @@ func Key(password, salt []byte, time, memory uint32, threads uint8, keyLen uint3
8385
//
8486
// key := argon2.IDKey([]byte("some password"), salt, 1, 64*1024, 4, 32)
8587
//
86-
// The draft RFC recommends[2] time=1, and memory=64*1024 is a sensible number.
88+
// [RFC 9106 Section 7.3] recommends time=1, and memory=64*1024 as a sensible number.
8789
// If using that amount of memory (64 MB) is not possible in some contexts then
8890
// the time parameter can be increased to compensate.
8991
//
@@ -93,6 +95,8 @@ func Key(password, salt []byte, time, memory uint32, threads uint8, keyLen uint3
9395
// adjusted to the numbers of available CPUs. The cost parameters should be
9496
// increased as memory latency and CPU parallelism increases. Remember to get a
9597
// good random salt.
98+
//
99+
// [RFC 9106 Section 7.3]: https://www.rfc-editor.org/rfc/rfc9106.html#section-7.3
96100
func IDKey(password, salt []byte, time, memory uint32, threads uint8, keyLen uint32) []byte {
97101
return deriveKey(argon2id, password, salt, nil, nil, time, memory, threads, keyLen)
98102
}

chacha20poly1305/_asm/chacha20poly1305_amd64_asm.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ func hashADDone() {
641641
// ----------------------------------------------------------------------------
642642
// ----------------------------------------------------------------------------
643643

644-
// Implements the following function fignature:
644+
// Implements the following function signature:
645645
//
646646
// func chacha20Poly1305Open(dst []byte, key []uint32, src []byte, ad []byte) bool
647647
func chacha20Poly1305Open() {
@@ -2967,7 +2967,7 @@ func openAVX2Tail512HashEnd() {
29672967
// ----------------------------------------------------------------------------
29682968
// ----------------------------------------------------------------------------
29692969

2970-
// Implements the following function fignature:
2970+
// Implements the following function signature:
29712971
//
29722972
// func chacha20Poly1305Seal(dst []byte, key []uint32, src, ad []byte)
29732973
func chacha20Poly1305Seal() {

chacha20poly1305/chacha20poly1305_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func TestRandom(t *testing.T) {
153153
t.Run("X", func(t *testing.T) { f(t, NonceSizeX) })
154154
}
155155

156-
func benchamarkChaCha20Poly1305Seal(b *testing.B, buf []byte, nonceSize int) {
156+
func benchmarkChaCha20Poly1305Seal(b *testing.B, buf []byte, nonceSize int) {
157157
b.ReportAllocs()
158158
b.SetBytes(int64(len(buf)))
159159

@@ -176,7 +176,7 @@ func benchamarkChaCha20Poly1305Seal(b *testing.B, buf []byte, nonceSize int) {
176176
}
177177
}
178178

179-
func benchamarkChaCha20Poly1305Open(b *testing.B, buf []byte, nonceSize int) {
179+
func benchmarkChaCha20Poly1305Open(b *testing.B, buf []byte, nonceSize int) {
180180
b.ReportAllocs()
181181
b.SetBytes(int64(len(buf)))
182182

@@ -204,17 +204,17 @@ func benchamarkChaCha20Poly1305Open(b *testing.B, buf []byte, nonceSize int) {
204204
func BenchmarkChacha20Poly1305(b *testing.B) {
205205
for _, length := range []int{64, 1350, 8 * 1024} {
206206
b.Run("Open-"+strconv.Itoa(length), func(b *testing.B) {
207-
benchamarkChaCha20Poly1305Open(b, make([]byte, length), NonceSize)
207+
benchmarkChaCha20Poly1305Open(b, make([]byte, length), NonceSize)
208208
})
209209
b.Run("Seal-"+strconv.Itoa(length), func(b *testing.B) {
210-
benchamarkChaCha20Poly1305Seal(b, make([]byte, length), NonceSize)
210+
benchmarkChaCha20Poly1305Seal(b, make([]byte, length), NonceSize)
211211
})
212212

213213
b.Run("Open-"+strconv.Itoa(length)+"-X", func(b *testing.B) {
214-
benchamarkChaCha20Poly1305Open(b, make([]byte, length), NonceSizeX)
214+
benchmarkChaCha20Poly1305Open(b, make([]byte, length), NonceSizeX)
215215
})
216216
b.Run("Seal-"+strconv.Itoa(length)+"-X", func(b *testing.B) {
217-
benchamarkChaCha20Poly1305Seal(b, make([]byte, length), NonceSizeX)
217+
benchmarkChaCha20Poly1305Seal(b, make([]byte, length), NonceSizeX)
218218
})
219219
}
220220
}

0 commit comments

Comments
 (0)