authorgravatar for luizberti@users.noreply.github.comLuiz Berti <luizberti@users.noreply.github.com> 2023-07-17 18:16:41-03:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-07-17 21:16:41+00:00
loga86f589a9f03622aa13eab4895c505c7f131c075
tree5f441bcea8ae255ad35b1ec9aa49d26f76f1b4bc
parentbf827d0b555df47ad2a2ea2062e2c855255c74d1
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Small documentation fixes on `std.crypto` (#16427)

* Small documentation fix of ChaCha variants Previous documentation was seemingly copy-pasted and left behind some errors where the number of rounds was not properly updated. * Suggest `std.crypto.utils.secureZero` on `@memset` docs * Revert previous change

2 files changed, 12 insertions(+), 10 deletions(-)

doc/langref.html.in+2
......@@ -8772,6 +8772,8 @@ test "integer cast panic" {
87728772 <p>{#syntax#}dest{#endsyntax#} must be a mutable slice or a mutable pointer to an array.
87738773 It may have any alignment, and it may have any element type.</p>
87748774 <p>{#syntax#}elem{#endsyntax#} is coerced to the element type of {#syntax#}dest{#endsyntax#}.</p>
8775 <p>For securely zeroing out sensitive contents from memory, you should use
8776 {#syntax#}std.crypto.utils.secureZero{#endsyntax#}</p>
87758777 {#header_close#}
87768778
87778779 {#header_open|@min#}
lib/std/crypto/chacha20.zig+10-10
......@@ -15,12 +15,12 @@ pub const ChaCha20IETF = ChaChaIETF(20);
1515
1616/// IETF-variant of the ChaCha20 stream cipher, reduced to 12 rounds.
1717/// Reduced-rounds versions are faster than the full-round version, but have a lower security margin.
18/// However, ChaCha is still believed to have a comfortable security even with only with 8 rounds.
18/// However, ChaCha is still believed to have a comfortable security even with only 8 rounds.
1919pub const ChaCha12IETF = ChaChaIETF(12);
2020
2121/// IETF-variant of the ChaCha20 stream cipher, reduced to 8 rounds.
2222/// Reduced-rounds versions are faster than the full-round version, but have a lower security margin.
23/// However, ChaCha is still believed to have a comfortable security even with only with 8 rounds.
23/// However, ChaCha is still believed to have a comfortable security even with only 8 rounds.
2424pub const ChaCha8IETF = ChaChaIETF(8);
2525
2626/// Original ChaCha20 stream cipher.
......@@ -28,12 +28,12 @@ pub const ChaCha20With64BitNonce = ChaChaWith64BitNonce(20);
2828
2929/// Original ChaCha20 stream cipher, reduced to 12 rounds.
3030/// Reduced-rounds versions are faster than the full-round version, but have a lower security margin.
31/// However, ChaCha is still believed to have a comfortable security even with only with 8 rounds.
31/// However, ChaCha is still believed to have a comfortable security even with only 8 rounds.
3232pub const ChaCha12With64BitNonce = ChaChaWith64BitNonce(12);
3333
3434/// Original ChaCha20 stream cipher, reduced to 8 rounds.
3535/// Reduced-rounds versions are faster than the full-round version, but have a lower security margin.
36/// However, ChaCha is still believed to have a comfortable security even with only with 8 rounds.
36/// However, ChaCha is still believed to have a comfortable security even with only 8 rounds.
3737pub const ChaCha8With64BitNonce = ChaChaWith64BitNonce(8);
3838
3939/// XChaCha20 (nonce-extended version of the IETF ChaCha20 variant) stream cipher
......@@ -41,12 +41,12 @@ pub const XChaCha20IETF = XChaChaIETF(20);
4141
4242/// XChaCha20 (nonce-extended version of the IETF ChaCha20 variant) stream cipher, reduced to 12 rounds
4343/// Reduced-rounds versions are faster than the full-round version, but have a lower security margin.
44/// However, ChaCha is still believed to have a comfortable security even with only with 8 rounds.
44/// However, ChaCha is still believed to have a comfortable security even with only 8 rounds.
4545pub const XChaCha12IETF = XChaChaIETF(12);
4646
4747/// XChaCha20 (nonce-extended version of the IETF ChaCha20 variant) stream cipher, reduced to 8 rounds
4848/// Reduced-rounds versions are faster than the full-round version, but have a lower security margin.
49/// However, ChaCha is still believed to have a comfortable security even with only with 8 rounds.
49/// However, ChaCha is still believed to have a comfortable security even with only 8 rounds.
5050pub const XChaCha8IETF = XChaChaIETF(8);
5151
5252/// ChaCha20-Poly1305 authenticated cipher, as designed for TLS
......@@ -54,12 +54,12 @@ pub const ChaCha20Poly1305 = ChaChaPoly1305(20);
5454
5555/// ChaCha20-Poly1305 authenticated cipher, reduced to 12 rounds
5656/// Reduced-rounds versions are faster than the full-round version, but have a lower security margin.
57/// However, ChaCha is still believed to have a comfortable security even with only with 8 rounds.
57/// However, ChaCha is still believed to have a comfortable security even with only 8 rounds.
5858pub const ChaCha12Poly1305 = ChaChaPoly1305(12);
5959
6060/// ChaCha20-Poly1305 authenticated cipher, reduced to 8 rounds
6161/// Reduced-rounds versions are faster than the full-round version, but have a lower security margin.
62/// However, ChaCha is still believed to have a comfortable security even with only with 8 rounds.
62/// However, ChaCha is still believed to have a comfortable security even with only 8 rounds.
6363pub const ChaCha8Poly1305 = ChaChaPoly1305(8);
6464
6565/// XChaCha20-Poly1305 authenticated cipher
......@@ -67,12 +67,12 @@ pub const XChaCha20Poly1305 = XChaChaPoly1305(20);
6767
6868/// XChaCha20-Poly1305 authenticated cipher
6969/// Reduced-rounds versions are faster than the full-round version, but have a lower security margin.
70/// However, ChaCha is still believed to have a comfortable security even with only with 8 rounds.
70/// However, ChaCha is still believed to have a comfortable security even with only 8 rounds.
7171pub const XChaCha12Poly1305 = XChaChaPoly1305(12);
7272
7373/// XChaCha20-Poly1305 authenticated cipher
7474/// Reduced-rounds versions are faster than the full-round version, but have a lower security margin.
75/// However, ChaCha is still believed to have a comfortable security even with only with 8 rounds.
75/// However, ChaCha is still believed to have a comfortable security even with only 8 rounds.
7676pub const XChaCha8Poly1305 = XChaChaPoly1305(8);
7777
7878// Vectorized implementation of the core function