zig/lib/std/crypto
Ryan Liptak bbd13ab961 rescanMac: Avoid overallocating/overreading by millions of bytes
readAtLeast is greedy and will read the entire length of the buffer if it can. However, reading past the end of the cert in this case is useless, so reading the full length of the buffer just puts an increasingly large (due to the growth algorithm of ArrayList) collection of wasted bytes after each cert in cb.bytes.

In practical terms, this ends up saving potentially millions of bytes of wasted reads/allocations. In my testing, after reading the keychain files on my machine, cb.bytes ends up with these capacities:

- Before: cb.bytes.capacity = 32720747
- After: cb.bytes.capacity = 251937

That's a decrease of 99.2%

Additionally, swaps to readNoEof since it should be an error to hit EOF without reading the full cert size.
2025-02-20 22:16:05 +01:00
..
25519 Clarify that ed25519.generateDeterministic() can be used outside tests 2025-02-20 09:01:13 +01:00
aes x86_64: fix crashes compiling the compiler and tests 2025-01-16 20:47:30 -05:00
Certificate rescanMac: Avoid overallocating/overreading by millions of bytes 2025-02-20 22:16:05 +01:00
pcurves compiler: handle eval branch quota in memoized calls 2024-08-21 01:26:55 +01:00
tls x86_64: looped instructions 2025-01-16 20:42:08 -05:00
aegis.zig crypto.auth.Aegis128X*Mac: properly absorb tags in the first lane (#22922) 2025-02-17 17:56:09 +00:00
aes.zig std.crypto.aes: introduce AES block vectors (#22023) 2024-11-22 10:00:49 +01:00
aes_gcm.zig std.crypto: better names for everything in utils 2024-08-09 19:47:06 -07:00
aes_ocb.zig std.crypto: better names for everything in utils 2024-08-09 19:47:06 -07:00
argon2.zig argon2: bail out if m < 8p (#22232) 2024-12-14 19:26:55 +00:00
ascon.zig crypto.ascon: support up to 16 rounds, and update links (#21953) 2024-11-10 20:43:09 +00:00
bcrypt.zig crypto.pwhash.bcrypt: make silently_truncate_password a member of Params (#22792) 2025-02-19 22:37:51 +01:00
benchmark.zig crypto.pwhash.bcrypt: make silently_truncate_password a member of Params (#22792) 2025-02-19 22:37:51 +01:00
blake2.zig std: update eval branch quotas after bdbc485 2024-08-21 01:30:46 +01:00
blake3.zig
Certificate.zig std.crypto.tls: implement TLSv1.2 2024-11-07 20:25:26 -05:00
chacha20.zig x86_64: looped instructions 2025-01-16 20:42:08 -05:00
cmac.zig std: update std.builtin.Type fields to follow naming conventions 2024-08-28 08:39:59 +01:00
ecdsa.zig std.crypto: make the key pair API creation consistent (#21955) 2024-11-19 18:05:09 +01:00
errors.zig
ff.zig std: update std.builtin.Type fields to follow naming conventions 2024-08-28 08:39:59 +01:00
ghash_polyval.zig std.crypto: better names for everything in utils 2024-08-09 19:47:06 -07:00
hash_composition.zig
hkdf.zig closes #21824 (#21832) 2024-10-28 14:54:02 +00:00
hmac.zig
isap.zig std.crypto: better names for everything in utils 2024-08-09 19:47:06 -07:00
keccak_p.zig crypto.keccak.State: add checks to prevent insecure transitions (#22020) 2024-11-20 11:16:09 +01:00
md5.zig
ml_kem.zig std.crypto: make the key pair API creation consistent (#21955) 2024-11-19 18:05:09 +01:00
modes.zig
pbkdf2.zig
phc_encoding.zig crypto/phc-encoding: forbid parameters named 'v' (#22569) 2025-02-06 16:37:42 +01:00
poly1305.zig std: avoid field/decl name conflicts 2024-08-29 20:39:11 +01:00
salsa20.zig std.crypto: make the key pair API creation consistent (#21955) 2024-11-19 18:05:09 +01:00
scrypt.zig
sha1.zig
sha2.zig
sha3.zig closes #21824 (#21832) 2024-10-28 14:54:02 +00:00
siphash.zig
test.zig
timing_safe.zig std.crypto: add the ability to explicitly tag a value as secret (#19907) 2025-02-20 12:32:37 +01:00
tlcsprng.zig adjust runtime page size APIs 2025-02-06 14:23:23 -08:00
tls.zig std.crypto.tls: advertise all supported signature algorithms 2024-11-07 20:25:26 -05:00