Always create dummy record (#376)

This commit is contained in:
daxpedda
2025-04-28 12:47:39 -07:00
committed by GitHub
parent 27c6d4658b
commit 560de5b718
4 changed files with 585 additions and 547 deletions
+7 -5
View File
@@ -17,7 +17,7 @@ use generic_array::typenum::{Sum, Unsigned, U2};
use generic_array::{ArrayLength, GenericArray};
use hkdf::{Hkdf, HkdfExtract};
use rand::{CryptoRng, RngCore};
use subtle::ConstantTimeEq;
use subtle::{Choice, ConstantTimeEq, CtOption};
use voprf::Group;
use zeroize::Zeroizing;
@@ -619,10 +619,12 @@ impl<CS: CipherSuite> ServerLogin<CS> {
ArrayLength<u8> + Add<<CS::KeGroup as KeGroup>::PkLen>,
MaskedResponseLen<CS>: ArrayLength<u8>,
{
let record = match password_file {
Some(x) => x,
None => ServerRegistration::dummy(rng, server_setup),
};
let record = CtOption::new(
ServerRegistration::dummy(rng, server_setup),
Choice::from(password_file.is_none() as u8),
)
.into_option()
.unwrap_or_else(|| password_file.unwrap());
let client_s_pk = record.0.client_s_pk.clone();
let context = context.unwrap_or(&[]);