| ... | @@ -158,7 +158,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In | ... | @@ -158,7 +158,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In |
| 158 | // Only possible to happen if the private key is all zeroes. | 158 | // Only possible to happen if the private key is all zeroes. |
| 159 | error.IdentityElement => return error.InsufficientEntropy, | 159 | error.IdentityElement => return error.InsufficientEntropy, |
| 160 | }; | 160 | }; |
| 161 | const kyber768_kp = crypto.kem.kyber_d00.Kyber768.KeyPair.create(null) catch {}; | 161 | const ml_kem768_kp = crypto.kem.ml_kem.MLKem768.KeyPair.create(null) catch {}; |
| 162 | | 162 | |
| 163 | const extensions_payload = | 163 | const extensions_payload = |
| 164 | tls.extension(.supported_versions, [_]u8{ | 164 | tls.extension(.supported_versions, [_]u8{ |
| ... | @@ -172,7 +172,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In | ... | @@ -172,7 +172,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In |
| 172 | .rsa_pss_rsae_sha512, | 172 | .rsa_pss_rsae_sha512, |
| 173 | .ed25519, | 173 | .ed25519, |
| 174 | })) ++ tls.extension(.supported_groups, enum_array(tls.NamedGroup, &.{ | 174 | })) ++ tls.extension(.supported_groups, enum_array(tls.NamedGroup, &.{ |
| 175 | .x25519_kyber768d00, | 175 | .x25519_ml_kem768, |
| 176 | .secp256r1, | 176 | .secp256r1, |
| 177 | .x25519, | 177 | .x25519, |
| 178 | })) ++ tls.extension( | 178 | })) ++ tls.extension( |
| ... | @@ -181,8 +181,8 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In | ... | @@ -181,8 +181,8 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In |
| 181 | array(1, x25519_kp.public_key) ++ | 181 | array(1, x25519_kp.public_key) ++ |
| 182 | int2(@intFromEnum(tls.NamedGroup.secp256r1)) ++ | 182 | int2(@intFromEnum(tls.NamedGroup.secp256r1)) ++ |
| 183 | array(1, secp256r1_kp.public_key.toUncompressedSec1()) ++ | 183 | array(1, secp256r1_kp.public_key.toUncompressedSec1()) ++ |
| 184 | int2(@intFromEnum(tls.NamedGroup.x25519_kyber768d00)) ++ | 184 | int2(@intFromEnum(tls.NamedGroup.x25519_ml_kem768)) ++ |
| 185 | array(1, x25519_kp.public_key ++ kyber768_kp.public_key.toBytes())), | 185 | array(1, x25519_kp.public_key ++ ml_kem768_kp.public_key.toBytes())), |
| 186 | ) ++ | 186 | ) ++ |
| 187 | int2(@intFromEnum(tls.ExtensionType.server_name)) ++ | 187 | int2(@intFromEnum(tls.ExtensionType.server_name)) ++ |
| 188 | int2(host_len + 5) ++ // byte length of this extension payload | 188 | int2(host_len + 5) ++ // byte length of this extension payload |
| ... | @@ -298,9 +298,9 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In | ... | @@ -298,9 +298,9 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In |
| 298 | const key_size = extd.decode(u16); | 298 | const key_size = extd.decode(u16); |
| 299 | try extd.ensure(key_size); | 299 | try extd.ensure(key_size); |
| 300 | switch (named_group) { | 300 | switch (named_group) { |
| 301 | .x25519_kyber768d00 => { | 301 | .x25519_ml_kem768 => { |
| 302 | const xksl = crypto.dh.X25519.public_length; | 302 | const xksl = crypto.dh.X25519.public_length; |
| 303 | const hksl = xksl + crypto.kem.kyber_d00.Kyber768.ciphertext_length; | 303 | const hksl = xksl + crypto.kem.ml_kem.MLKem768.ciphertext_length; |
| 304 | if (key_size != hksl) | 304 | if (key_size != hksl) |
| 305 | return error.TlsIllegalParameter; | 305 | return error.TlsIllegalParameter; |
| 306 | const server_ks = extd.array(hksl); | 306 | const server_ks = extd.array(hksl); |
| ... | @@ -308,7 +308,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In | ... | @@ -308,7 +308,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In |
| 308 | shared_key = &((crypto.dh.X25519.scalarmult( | 308 | shared_key = &((crypto.dh.X25519.scalarmult( |
| 309 | x25519_kp.secret_key, | 309 | x25519_kp.secret_key, |
| 310 | server_ks[0..xksl].*, | 310 | server_ks[0..xksl].*, |
| 311 | ) catch return error.TlsDecryptFailure) ++ (kyber768_kp.secret_key.decaps( | 311 | ) catch return error.TlsDecryptFailure) ++ (ml_kem768_kp.secret_key.decaps( |
| 312 | server_ks[xksl..hksl], | 312 | server_ks[xksl..hksl], |
| 313 | ) catch return error.TlsDecryptFailure)); | 313 | ) catch return error.TlsDecryptFailure)); |
| 314 | }, | 314 | }, |