Timeout adjustments, random serial number

This commit is contained in:
Pascal Engélibert 2026-08-26 14:24:33 +02:00
commit 18f7989e28
2 changed files with 13 additions and 5 deletions

View file

@ -202,8 +202,16 @@ impl LyingCertificateRegistry {
)
.unwrap();
cert_builder.set_not_before(cert.not_before()).unwrap();
let mut serial = openssl::bn::BigNum::new().unwrap();
serial
.rand(160, openssl::bn::MsbOption::MAYBE_ZERO, false)
.unwrap();
cert_builder
.set_serial_number(cert.serial_number())
.set_serial_number(
openssl::asn1::Asn1Integer::from_bn(&serial.as_ref())
.unwrap()
.as_ref(),
)
.unwrap();
cert_builder.set_subject_name(cert.subject_name()).unwrap();
cert_builder.set_version(cert.version()).unwrap();

View file

@ -221,7 +221,7 @@ pub async fn play(
//let mut previous = Vec::new();
loop {
let req = match tokio::time::timeout(
tokio::time::Duration::from_secs(5),
tokio::time::Duration::from_secs(10),
stream.next(),
)
.await
@ -274,7 +274,7 @@ pub async fn play(
break;
}
}
stream.get_mut().shutdown().await.unwrap();
stream.get_mut().shutdown().await.ok();
};
tokio::spawn(async move {
fut.await;
@ -297,7 +297,7 @@ pub async fn play(
//let mut previous = Vec::new();
loop {
let Ok(req) =
tokio::time::timeout(tokio::time::Duration::from_secs(5), stream.next())
tokio::time::timeout(tokio::time::Duration::from_secs(10), stream.next())
.await
else {
if break_next {
@ -346,7 +346,7 @@ pub async fn play(
}
}
//println!("Server shutdown");
stream.get_mut().shutdown().await.unwrap();
stream.get_mut().shutdown().await.ok();
};
// Using a variable for the future allows it to be detected by tokio-console
tokio::spawn(async move {