Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose an SSLNamedGroup for mlkem768x25519 #2102

Merged
merged 4 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion neqo-crypto/min_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.103
3.105
1 change: 1 addition & 0 deletions neqo-crypto/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ remap_enum! {
TLS_GRP_EC_SECP521R1 = ssl_grp_ec_secp521r1,
TLS_GRP_EC_X25519 = ssl_grp_ec_curve25519,
TLS_GRP_KEM_XYBER768D00 = ssl_grp_kem_xyber768d00,
TLS_GRP_KEM_MLKEM768X25519 = ssl_grp_kem_mlkem768x25519,
}
}

Expand Down
7 changes: 0 additions & 7 deletions neqo-crypto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,6 @@ fn init_once(db: Option<PathBuf>) -> Res<NssLoaded> {
};

secstatus_to_res(unsafe { nss::NSS_SetDomesticPolicy() })?;
secstatus_to_res(unsafe {
p11::NSS_SetAlgorithmPolicy(
p11::SECOidTag::SEC_OID_XYBER768D00,
p11::NSS_USE_ALG_IN_SSL_KX,
0,
)
})?;

#[cfg(debug_assertions)]
enable_ssl_trace()?;
Expand Down
7 changes: 4 additions & 3 deletions neqo-transport/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use neqo_crypto::{
TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, TLS_CHACHA20_POLY1305_SHA256, TLS_CT_HANDSHAKE,
TLS_EPOCH_APPLICATION_DATA, TLS_EPOCH_HANDSHAKE, TLS_EPOCH_INITIAL, TLS_EPOCH_ZERO_RTT,
TLS_GRP_EC_SECP256R1, TLS_GRP_EC_SECP384R1, TLS_GRP_EC_SECP521R1, TLS_GRP_EC_X25519,
TLS_GRP_KEM_XYBER768D00, TLS_VERSION_1_3,
TLS_GRP_KEM_MLKEM768X25519, TLS_VERSION_1_3,
};

use crate::{
Expand Down Expand Up @@ -78,9 +78,10 @@ impl Crypto {
])?;
match &mut agent {
Agent::Server(c) => {
// Clients do not send xyber shares by default, but servers should accept them.
// Clients do not send mlkem768x25519 shares by default, but servers should accept
// them.
c.set_groups(&[
TLS_GRP_KEM_XYBER768D00,
TLS_GRP_KEM_MLKEM768X25519,
TLS_GRP_EC_X25519,
TLS_GRP_EC_SECP256R1,
TLS_GRP_EC_SECP384R1,
Expand Down
8 changes: 4 additions & 4 deletions neqo-transport/tests/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ fn overflow_crypto() {
}

#[test]
fn handshake_xyber() {
fn handshake_mlkem768x25519() {
let mut client = default_client();
let mut server = default_server();

client
.set_groups(&[neqo_crypto::TLS_GRP_KEM_XYBER768D00])
.set_groups(&[neqo_crypto::TLS_GRP_KEM_MLKEM768X25519])
.ok();
client.send_additional_key_shares(0).ok();

Expand All @@ -289,10 +289,10 @@ fn handshake_xyber() {
assert_eq!(*server.state(), State::Confirmed);
assert_eq!(
client.tls_info().unwrap().key_exchange(),
neqo_crypto::TLS_GRP_KEM_XYBER768D00
neqo_crypto::TLS_GRP_KEM_MLKEM768X25519
);
assert_eq!(
server.tls_info().unwrap().key_exchange(),
neqo_crypto::TLS_GRP_KEM_XYBER768D00
neqo_crypto::TLS_GRP_KEM_MLKEM768X25519
);
}
Loading