zig/lib/std/crypto
Frank Denis 9c3e09cbee
Fix TLS 1.2 client key exchange to use negotiated named group (#25007)
The TLS 1.2 implementation was incorrectly hardcoded to always send the
secp256r1 public key in the client key exchange message, regardless of
which elliptic curve the server actually negotiated.

This caused TLS handshake failures with servers that preferred other curves
like X25519.

This fix:

- Tracks the negotiated named group from the server key exchange message
- Dynamically selects the correct public key (X25519, secp256r1, or
  secp384r1) based on what the server negotiated
- Properly constructs the client key exchange message with the
  appropriate key size for each curve type

Fixes TLS 1.2 connections to servers like ziglang.freetls.fastly.net
that prefer X25519 over secp256r1.
2025-08-27 20:53:42 +02:00
..
25519 std.crypto: remove inline from most functions 2025-07-13 18:26:13 +02:00
aes std.crypto: remove inline from most functions 2025-07-13 18:26:13 +02:00
Certificate std.crypto.Certificate.Bundle: haiku support 2025-06-05 13:45:52 +01:00
codecs zig fmt: apply new cast builtin order 2025-08-03 14:59:56 +02:00
pcurves std.crypto: remove inline from most functions 2025-07-13 18:26:13 +02:00
tls Fix TLS 1.2 client key exchange to use negotiated named group (#25007) 2025-08-27 20:53:42 +02:00
aegis.zig std.crypto.aegis: Absorb ad instead of encrypting it. 2025-08-13 09:00:57 +02:00
aes.zig std.Target: Introduce Cpu convenience functions for feature tests. 2025-06-05 06:12:00 +02:00
aes_gcm.zig Add documentation to std.crypto.aes_gcm.AesGcm.encrypt (#24427) 2025-07-13 07:33:08 +00:00
aes_ocb.zig Fix #24999: copy left-overs before we XOR into c. (#25001) 2025-08-25 18:50:36 +02:00
argon2.zig std.ArrayList: make unmanaged the default 2025-08-11 15:52:49 -07:00
ascon.zig std.crypto: remove inline from most functions 2025-07-13 18:26:13 +02: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 std.fmt: breaking API changes 2025-07-07 22:43:51 -07:00
blake2.zig std.io: deprecated Reader/Writer; introduce new API 2025-07-07 22:43:51 -07:00
blake3.zig std.crypto: remove inline from most functions 2025-07-13 18:26:13 +02:00
Certificate.zig Validate wildcard TLS certificates correctly (#24829) 2025-08-14 13:57:00 +00:00
chacha20.zig std.crypto: remove inline from most functions 2025-07-13 18:26:13 +02:00
cmac.zig std: update std.builtin.Type fields to follow naming conventions 2024-08-28 08:39:59 +01:00
codecs.zig fixed codecs.zig (#23706) 2025-04-29 22:07:30 +00:00
ecdsa.zig crypto: fix typo in ecdsa comment 2025-08-05 07:51:39 +01:00
errors.zig crypto.edwards25519: add the ability to check for group membership (#20175) 2024-06-04 10:11:05 +02:00
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: remove inline from most functions 2025-07-13 18:26:13 +02:00
hash_composition.zig x86_64: implement enough to pass unicode tests 2023-10-23 22:42:18 -04:00
hkdf.zig closes #21824 (#21832) 2024-10-28 14:54:02 +00:00
hmac.zig Remove redundant test name prefixes now that test names are fully qualified 2024-02-26 15:18:31 -08:00
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 std.tar: update to new I/O API 2025-07-22 09:41:44 -07:00
ml_kem.zig std: fmt.format to io.Writer.print 2025-07-09 15:31:02 -07:00
modes.zig update codebase to use @memset and @memcpy 2023-04-28 13:24:43 -07:00
pbkdf2.zig lib: correct unnecessary uses of 'var' 2023-11-19 09:55:07 +00:00
phc_encoding.zig std.Io: delete CountingWriter 2025-08-07 22:26:42 -07:00
poly1305.zig std.crypto: remove inline from most functions 2025-07-13 18:26:13 +02:00
salsa20.zig std.crypto: remove inline from most functions 2025-07-13 18:26:13 +02:00
scrypt.zig std.Io: delete CountingWriter 2025-08-07 22:26:42 -07:00
Sha1.zig std.crypto: fix Sha1 namespace 2025-07-14 00:14:21 -07:00
sha2.zig zig fmt 2025-07-16 10:27:39 -07:00
sha3.zig std.io: deprecated Reader/Writer; introduce new API 2025-07-07 22:43:51 -07:00
siphash.zig std.io: deprecated Reader/Writer; introduce new API 2025-07-07 22:43:51 -07:00
test.zig update std lib and compiler sources to new for loop syntax 2023-02-18 19:17:21 -07:00
timing_safe.zig zig fmt: apply new cast builtin order 2025-08-03 14:59:56 +02:00
tlcsprng.zig std.crypto.tlcsprng: Fix hardcoded use of defaultRandomSeed() 2025-02-22 22:39:40 -05:00
tls.zig std.crypto.tls: rework for new std.Io API 2025-08-07 10:04:29 -07:00