Skip to content

Commit f5caec0

Browse files
rscmaisem
authored andcommitted
all: gofmt
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: I076031b6613691eefbb0f21739366e3fd2011ec9 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/399356 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
1 parent e7e1e6d commit f5caec0

File tree

22 files changed

+82
-70
lines changed

22 files changed

+82
-70
lines changed

Diff for: acme/acme.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,11 @@ const (
7777
// The only required field is Key. An example of creating a client with a new key
7878
// is as follows:
7979
//
80-
// key, err := rsa.GenerateKey(rand.Reader, 2048)
81-
// if err != nil {
82-
// log.Fatal(err)
83-
// }
84-
// client := &Client{Key: key}
85-
//
80+
// key, err := rsa.GenerateKey(rand.Reader, 2048)
81+
// if err != nil {
82+
// log.Fatal(err)
83+
// }
84+
// client := &Client{Key: key}
8685
type Client struct {
8786
// Key is the account key used to register with a CA and sign requests.
8887
// Key.Public() must return a *rsa.PublicKey or *ecdsa.PublicKey.

Diff for: acme/autocert/listener.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
//
2121
// It enables one-line HTTPS servers:
2222
//
23-
// log.Fatal(http.Serve(autocert.NewListener("example.com"), handler))
23+
// log.Fatal(http.Serve(autocert.NewListener("example.com"), handler))
2424
//
2525
// NewListener is a convenience function for a common configuration.
2626
// More complex or custom configurations can use the autocert.Manager

Diff for: acme/internal/acmeprobe/prober.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
//
1212
// A usage example:
1313
//
14-
// go run prober.go \
15-
// -d https://acme-staging-v02.api.letsencrypt.org/directory \
16-
// -f order \
17-
// -t http-01 \
18-
// -a :8080 \
19-
// -domain some.example.org
14+
// go run prober.go \
15+
// -d https://acme-staging-v02.api.letsencrypt.org/directory \
16+
// -f order \
17+
// -t http-01 \
18+
// -a :8080 \
19+
// -domain some.example.org
2020
//
2121
// The above assumes a TCP tunnel from some.example.org:80 to 0.0.0.0:8080
2222
// in order for the test to be able to fulfill http-01 challenge.

Diff for: argon2/argon2.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
// If you aren't sure which function you need, use Argon2id (IDKey) and
1212
// the parameter recommendations for your scenario.
1313
//
14-
//
15-
// Argon2i
14+
// # Argon2i
1615
//
1716
// Argon2i (implemented by Key) is the side-channel resistant version of Argon2.
1817
// It uses data-independent memory access, which is preferred for password
@@ -21,8 +20,7 @@
2120
// parameters (taken from [2]) for non-interactive operations are time=3 and to
2221
// use the maximum available memory.
2322
//
24-
//
25-
// Argon2id
23+
// # Argon2id
2624
//
2725
// Argon2id (implemented by IDKey) is a hybrid version of Argon2 combining
2826
// Argon2i and Argon2d. It uses data-independent memory access for the first
@@ -59,7 +57,7 @@ const (
5957
// For example, you can get a derived key for e.g. AES-256 (which needs a
6058
// 32-byte key) by doing:
6159
//
62-
// key := argon2.Key([]byte("some password"), salt, 3, 32*1024, 4, 32)
60+
// key := argon2.Key([]byte("some password"), salt, 3, 32*1024, 4, 32)
6361
//
6462
// The draft RFC recommends[2] time=3, and memory=32*1024 is a sensible number.
6563
// If using that amount of memory (32 MB) is not possible in some contexts then
@@ -83,7 +81,7 @@ func Key(password, salt []byte, time, memory uint32, threads uint8, keyLen uint3
8381
// For example, you can get a derived key for e.g. AES-256 (which needs a
8482
// 32-byte key) by doing:
8583
//
86-
// key := argon2.IDKey([]byte("some password"), salt, 1, 64*1024, 4, 32)
84+
// key := argon2.IDKey([]byte("some password"), salt, 1, 64*1024, 4, 32)
8785
//
8886
// The draft RFC recommends[2] time=1, and memory=64*1024 is a sensible number.
8987
// If using that amount of memory (64 MB) is not possible in some contexts then

Diff for: chacha20/chacha_s390x.go

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const bufSize = 256
1515

1616
// xorKeyStreamVX is an assembly implementation of XORKeyStream. It must only
1717
// be called when the vector facility is available. Implementation in asm_s390x.s.
18+
//
1819
//go:noescape
1920
func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32)
2021

Diff for: cryptobyte/builder.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ func (b *Builder) AddBytes(v []byte) {
106106
// supplied to them. The child builder passed to the continuation can be used
107107
// to build the content of the length-prefixed sequence. For example:
108108
//
109-
// parent := cryptobyte.NewBuilder()
110-
// parent.AddUint8LengthPrefixed(func (child *Builder) {
111-
// child.AddUint8(42)
112-
// child.AddUint8LengthPrefixed(func (grandchild *Builder) {
113-
// grandchild.AddUint8(5)
114-
// })
115-
// })
109+
// parent := cryptobyte.NewBuilder()
110+
// parent.AddUint8LengthPrefixed(func (child *Builder) {
111+
// child.AddUint8(42)
112+
// child.AddUint8LengthPrefixed(func (grandchild *Builder) {
113+
// grandchild.AddUint8(5)
114+
// })
115+
// })
116116
//
117117
// It is an error to write more bytes to the child than allowed by the reserved
118118
// length prefix. After the continuation returns, the child must be considered

Diff for: curve25519/internal/field/fe_alias_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ func checkAliasingTwoArgs(f func(v, x, y *Element) *Element) func(v, x, y Elemen
7777
// TestAliasing checks that receivers and arguments can alias each other without
7878
// leading to incorrect results. That is, it ensures that it's safe to write
7979
//
80-
// v.Invert(v)
80+
// v.Invert(v)
8181
//
8282
// or
8383
//
84-
// v.Add(v, v)
84+
// v.Add(v, v)
8585
//
8686
// without any of the inputs getting clobbered by the output being written.
8787
func TestAliasing(t *testing.T) {

Diff for: curve25519/internal/field/fe_amd64.go

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: internal/poly1305/sum_generic.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func shiftRightBy2(a uint128) uint128 {
136136
// updateGeneric absorbs msg into the state.h accumulator. For each chunk m of
137137
// 128 bits of message, it computes
138138
//
139-
// h₊ = (h + m) * r mod 2¹³⁰ - 5
139+
// h₊ = (h + m) * r mod 2¹³⁰ - 5
140140
//
141141
// If the msg length is not a multiple of TagSize, it assumes the last
142142
// incomplete chunk is the final one.
@@ -278,8 +278,7 @@ const (
278278

279279
// finalize completes the modular reduction of h and computes
280280
//
281-
// out = h + s mod 2¹²⁸
282-
//
281+
// out = h + s mod 2¹²⁸
283282
func finalize(out *[TagSize]byte, h *[3]uint64, s *[2]uint64) {
284283
h0, h1, h2 := h[0], h[1], h[2]
285284

Diff for: internal/poly1305/sum_s390x.go

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
// updateVX is an assembly implementation of Poly1305 that uses vector
1515
// instructions. It must only be called if the vector facility (vx) is
1616
// available.
17+
//
1718
//go:noescape
1819
func updateVX(state *macState, msg []byte)
1920

Diff for: openpgp/armor/armor.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ import (
2323
// A Block represents an OpenPGP armored structure.
2424
//
2525
// The encoded form is:
26-
// -----BEGIN Type-----
27-
// Headers
2826
//
29-
// base64-encoded Bytes
30-
// '=' base64 encoded checksum
31-
// -----END Type-----
27+
// -----BEGIN Type-----
28+
// Headers
29+
//
30+
// base64-encoded Bytes
31+
// '=' base64 encoded checksum
32+
// -----END Type-----
33+
//
3234
// where Headers is a possibly empty sequence of Key: Value lines.
3335
//
3436
// Since the armored data can be very large, this package presents a streaming

Diff for: openpgp/armor/encode.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ func (l *lineBreaker) Close() (err error) {
9696
// trailer.
9797
//
9898
// It's built into a stack of io.Writers:
99-
// encoding -> base64 encoder -> lineBreaker -> out
99+
//
100+
// encoding -> base64 encoder -> lineBreaker -> out
100101
type encoding struct {
101102
out io.Writer
102103
breaker *lineBreaker

Diff for: openpgp/elgamal/elgamal.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ func Encrypt(random io.Reader, pub *PublicKey, msg []byte) (c1, c2 *big.Int, err
7777
// returns the plaintext of the message. An error can result only if the
7878
// ciphertext is invalid. Users should keep in mind that this is a padding
7979
// oracle and thus, if exposed to an adaptive chosen ciphertext attack, can
80-
// be used to break the cryptosystem. See ``Chosen Ciphertext Attacks
81-
// Against Protocols Based on the RSA Encryption Standard PKCS #1'', Daniel
80+
// be used to break the cryptosystem. See Chosen Ciphertext Attacks
81+
// Against Protocols Based on the RSA Encryption Standard PKCS #1, Daniel
8282
// Bleichenbacher, Advances in Cryptology (Crypto '98),
8383
func Decrypt(priv *PrivateKey, c1, c2 *big.Int) (msg []byte, err error) {
8484
s := new(big.Int).Exp(c1, priv.X, priv.P)

Diff for: openpgp/packet/signature_v3_test.go

+15-10
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,23 @@ func v3KeyReader(t *testing.T) io.Reader {
6666

6767
// keySigV3Armor is some V3 public key I found in an SKS dump.
6868
// Old: Public Key Packet(tag 6)(141 bytes)
69-
// Ver 4 - new
70-
// Public key creation time - Fri Sep 16 17:13:54 CDT 1994
71-
// Pub alg - unknown(pub 0)
72-
// Unknown public key(pub 0)
69+
//
70+
// Ver 4 - new
71+
// Public key creation time - Fri Sep 16 17:13:54 CDT 1994
72+
// Pub alg - unknown(pub 0)
73+
// Unknown public key(pub 0)
74+
//
7375
// Old: User ID Packet(tag 13)(39 bytes)
74-
// User ID - Armin M. Warda <warda@nephilim.ruhr.de>
76+
//
77+
// User ID - Armin M. Warda <warda@nephilim.ruhr.de>
78+
//
7579
// Old: Signature Packet(tag 2)(149 bytes)
76-
// Ver 4 - new
77-
// Sig type - unknown(05)
78-
// Pub alg - ElGamal Encrypt-Only(pub 16)
79-
// Hash alg - unknown(hash 46)
80-
// Hashed Sub: unknown(sub 81, critical)(1988 bytes)
80+
//
81+
// Ver 4 - new
82+
// Sig type - unknown(05)
83+
// Pub alg - ElGamal Encrypt-Only(pub 16)
84+
// Hash alg - unknown(hash 46)
85+
// Hashed Sub: unknown(sub 81, critical)(1988 bytes)
8186
const keySigV3Armor = `-----BEGIN PGP PUBLIC KEY BLOCK-----
8287
Version: SKS 1.0.10
8388

Diff for: pbkdf2/pbkdf2.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
// can get a derived key for e.g. AES-256 (which needs a 32-byte key) by
3333
// doing:
3434
//
35-
// dk := pbkdf2.Key([]byte("some password"), salt, 4096, 32, sha1.New)
35+
// dk := pbkdf2.Key([]byte("some password"), salt, 4096, 32, sha1.New)
3636
//
3737
// Remember to get a good random salt. At least 8 bytes is recommended by the
3838
// RFC.

Diff for: scrypt/scrypt.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func smix(b []byte, r, N int, v, xy []uint32) {
186186
// For example, you can get a derived key for e.g. AES-256 (which needs a
187187
// 32-byte key) by doing:
188188
//
189-
// dk, err := scrypt.Key([]byte("some password"), salt, 32768, 8, 1, 32)
189+
// dk, err := scrypt.Key([]byte("some password"), salt, 32768, 8, 1, 32)
190190
//
191191
// The recommended parameters for interactive logins as of 2017 are N=32768, r=8
192192
// and p=1. The parameters N, r, and p should be increased as memory latency and

Diff for: sha3/doc.go

+4-8
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
// Both types of hash function use the "sponge" construction and the Keccak
99
// permutation. For a detailed specification see http://keccak.noekeon.org/
1010
//
11-
//
12-
// Guidance
11+
// # Guidance
1312
//
1413
// If you aren't sure what function you need, use SHAKE256 with at least 64
1514
// bytes of output. The SHAKE instances are faster than the SHA3 instances;
@@ -19,8 +18,7 @@
1918
// secret key to the input, hash with SHAKE256 and read at least 32 bytes of
2019
// output.
2120
//
22-
//
23-
// Security strengths
21+
// # Security strengths
2422
//
2523
// The SHA3-x (x equals 224, 256, 384, or 512) functions have a security
2624
// strength against preimage attacks of x bits. Since they only produce "x"
@@ -31,8 +29,7 @@
3129
// is used. Requesting more than 64 or 32 bytes of output, respectively, does
3230
// not increase the collision-resistance of the SHAKE functions.
3331
//
34-
//
35-
// The sponge construction
32+
// # The sponge construction
3633
//
3734
// A sponge builds a pseudo-random function from a public pseudo-random
3835
// permutation, by applying the permutation to a state of "rate + capacity"
@@ -50,8 +47,7 @@
5047
// Since the KeccakF-1600 permutation is 1600 bits (200 bytes) wide, this means
5148
// that the security strength of a sponge instance is equal to (1600 - bitrate) / 2.
5249
//
53-
//
54-
// Recommendations
50+
// # Recommendations
5551
//
5652
// The SHAKE functions are recommended for most new uses. They can produce
5753
// output of arbitrary length. SHAKE256, with an output length of at least

Diff for: sha3/sha3_s390x.go

+2
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ const (
3434

3535
// kimd is a wrapper for the 'compute intermediate message digest' instruction.
3636
// src must be a multiple of the rate for the given function code.
37+
//
3738
//go:noescape
3839
func kimd(function code, chain *[200]byte, src []byte)
3940

4041
// klmd is a wrapper for the 'compute last message digest' instruction.
4142
// src padding is handled by the instruction.
43+
//
4244
//go:noescape
4345
func klmd(function code, chain *[200]byte, dst, src []byte)
4446

Diff for: ssh/agent/client.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
// ssh-agent process using the sample server.
99
//
1010
// References:
11-
// [PROTOCOL.agent]: https://tools.ietf.org/html/draft-miller-ssh-agent-00
11+
//
12+
// [PROTOCOL.agent]: https://tools.ietf.org/html/draft-miller-ssh-agent-00
1213
package agent // import "golang.org/x/crypto/ssh/agent"
1314

1415
import (

Diff for: ssh/certs_test.go

+10-7
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,17 @@ func TestParseCert(t *testing.T) {
4949
// % ssh-keygen -s ca -I testcert -O source-address=192.168.1.0/24 -O force-command=/bin/sleep user.pub
5050
// user.pub key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDACh1rt2DXfV3hk6fszSQcQ/rueMId0kVD9U7nl8cfEnFxqOCrNT92g4laQIGl2mn8lsGZfTLg8ksHq3gkvgO3oo/0wHy4v32JeBOHTsN5AL4gfHNEhWeWb50ev47hnTsRIt9P4dxogeUo/hTu7j9+s9lLpEQXCvq6xocXQt0j8MV9qZBBXFLXVT3cWIkSqOdwt/5ZBg+1GSrc7WfCXVWgTk4a20uPMuJPxU4RQwZW6X3+O8Pqo8C3cW0OzZRFP6gUYUKUsTI5WntlS+LAxgw1mZNsozFGdbiOPRnEryE3SRldh9vjDR3tin1fGpA5P7+CEB/bqaXtG3V+F2OkqaMN
5151
// Critical Options:
52-
// force-command /bin/sleep
53-
// source-address 192.168.1.0/24
52+
//
53+
// force-command /bin/sleep
54+
// source-address 192.168.1.0/24
55+
//
5456
// Extensions:
55-
// permit-X11-forwarding
56-
// permit-agent-forwarding
57-
// permit-port-forwarding
58-
// permit-pty
59-
// permit-user-rc
57+
//
58+
// permit-X11-forwarding
59+
// permit-agent-forwarding
60+
// permit-port-forwarding
61+
// permit-pty
62+
// permit-user-rc
6063
const exampleSSHCertWithOptions = `ssh-rsa-cert-v01@openssh.com AAAAHHNzaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgDyysCJY0XrO1n03EeRRoITnTPdjENFmWDs9X58PP3VUAAAADAQABAAABAQDACh1rt2DXfV3hk6fszSQcQ/rueMId0kVD9U7nl8cfEnFxqOCrNT92g4laQIGl2mn8lsGZfTLg8ksHq3gkvgO3oo/0wHy4v32JeBOHTsN5AL4gfHNEhWeWb50ev47hnTsRIt9P4dxogeUo/hTu7j9+s9lLpEQXCvq6xocXQt0j8MV9qZBBXFLXVT3cWIkSqOdwt/5ZBg+1GSrc7WfCXVWgTk4a20uPMuJPxU4RQwZW6X3+O8Pqo8C3cW0OzZRFP6gUYUKUsTI5WntlS+LAxgw1mZNsozFGdbiOPRnEryE3SRldh9vjDR3tin1fGpA5P7+CEB/bqaXtG3V+F2OkqaMNAAAAAAAAAAAAAAABAAAACHRlc3RjZXJ0AAAAAAAAAAAAAAAA//////////8AAABLAAAADWZvcmNlLWNvbW1hbmQAAAAOAAAACi9iaW4vc2xlZXAAAAAOc291cmNlLWFkZHJlc3MAAAASAAAADjE5Mi4xNjguMS4wLzI0AAAAggAAABVwZXJtaXQtWDExLWZvcndhcmRpbmcAAAAAAAAAF3Blcm1pdC1hZ2VudC1mb3J3YXJkaW5nAAAAAAAAABZwZXJtaXQtcG9ydC1mb3J3YXJkaW5nAAAAAAAAAApwZXJtaXQtcHR5AAAAAAAAAA5wZXJtaXQtdXNlci1yYwAAAAAAAAAAAAABFwAAAAdzc2gtcnNhAAAAAwEAAQAAAQEAwU+c5ui5A8+J/CFpjW8wCa52bEODA808WWQDCSuTG/eMXNf59v9Y8Pk0F1E9dGCosSNyVcB/hacUrc6He+i97+HJCyKavBsE6GDxrjRyxYqAlfcOXi/IVmaUGiO8OQ39d4GHrjToInKvExSUeleQyH4Y4/e27T/pILAqPFL3fyrvMLT5qU9QyIt6zIpa7GBP5+urouNavMprV3zsfIqNBbWypinOQAw823a5wN+zwXnhZrgQiHZ/USG09Y6k98y1dTVz8YHlQVR4D3lpTAsKDKJ5hCH9WU4fdf+lU8OyNGaJ/vz0XNqxcToe1l4numLTnaoSuH89pHryjqurB7lJKwAAAQ8AAAAHc3NoLXJzYQAAAQCaHvUIoPL1zWUHIXLvu96/HU1s/i4CAW2IIEuGgxCUCiFj6vyTyYtgxQxcmbfZf6eaITlS6XJZa7Qq4iaFZh75C1DXTX8labXhRSD4E2t//AIP9MC1rtQC5xo6FmbQ+BoKcDskr+mNACcbRSxs3IL3bwCfWDnIw2WbVox9ZdcthJKk4UoCW4ix4QwdHw7zlddlz++fGEEVhmTbll1SUkycGApPFBsAYRTMupUJcYPIeReBI/m8XfkoMk99bV8ZJQTAd7OekHY2/48Ff53jLmyDjP7kNw1F8OaPtkFs6dGJXta4krmaekPy87j+35In5hFj7yoOqvSbmYUkeX70/GGQ`
6164

6265
func TestParseCertWithOptions(t *testing.T) {

Diff for: ssh/cipher.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ const chacha20Poly1305ID = "chacha20-poly1305@openssh.com"
640640
// chacha20Poly1305Cipher implements the chacha20-poly1305@openssh.com
641641
// AEAD, which is described here:
642642
//
643-
// https://tools.ietf.org/html/draft-josefsson-ssh-chacha20-poly1305-openssh-00
643+
// https://tools.ietf.org/html/draft-josefsson-ssh-chacha20-poly1305-openssh-00
644644
//
645645
// the methods here also implement padding, which RFC4253 Section 6
646646
// also requires of stream ciphers.

Diff for: ssh/doc.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ the multiplexed nature of SSH is exposed to users that wish to support
1212
others.
1313
1414
References:
15-
[PROTOCOL.certkeys]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?rev=HEAD
16-
[SSH-PARAMETERS]: http://www.iana.org/assignments/ssh-parameters/ssh-parameters.xml#ssh-parameters-1
15+
16+
[PROTOCOL.certkeys]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?rev=HEAD
17+
[SSH-PARAMETERS]: http://www.iana.org/assignments/ssh-parameters/ssh-parameters.xml#ssh-parameters-1
1718
1819
This package does not fall under the stability promise of the Go language itself,
1920
so its API may be changed when pressing needs arise.

0 commit comments

Comments
 (0)