Update On Tue Apr 15 20:36:35 CEST 2025

This commit is contained in:
github-action[bot]
2025-04-15 20:36:36 +02:00
parent 987930c9c8
commit 9ee24e815a
84 changed files with 2504 additions and 1688 deletions

View File

@@ -394,6 +394,10 @@ pub enum ServerConfigError {
/// Key length mismatch
#[error("invalid key length for {0}, expecting {1} bytes, but found {2} bytes")]
InvalidKeyLength(CipherKind, usize, usize),
/// User Key (ipsk) length mismatch
#[error("invalid user key length for {0}, expecting {1} bytes, but found {2} bytes")]
InvalidUserKeyLength(CipherKind, usize, usize),
}
/// Configuration for a server
@@ -538,6 +542,22 @@ where
for ipsk in split_iter {
match USER_KEY_BASE64_ENGINE.decode(ipsk) {
Ok(v) => {
// Double check identity key's length
match method {
CipherKind::AEAD2022_BLAKE3_AES_128_GCM => {
// AES-128
if v.len() != 16 {
return Err(ServerConfigError::InvalidUserKeyLength(method, 16, v.len()));
}
}
CipherKind::AEAD2022_BLAKE3_AES_256_GCM => {
// AES-256
if v.len() != 32 {
return Err(ServerConfigError::InvalidUserKeyLength(method, 32, v.len()));
}
}
_ => unreachable!("{} doesn't support EIH", method),
}
identity_keys.push(Bytes::from(v));
}
Err(err) => {