protocol: Throw SessionNotFound for an expired unacknowledged session

For the most part this should happen transparently without any
explicit adoption, like the previous change, but for Java code the
NoSessionException is now properly declared on SessionCipher.encrypt.
(This was always technically possible, but clients were expected to
have previously checked for session validity before using
SessionCipher; now that there's an expiration involved, that's not
strictly possible.)
This commit is contained in:
Jordan Rose
2023-08-21 17:41:08 -07:00
parent a04c4f27a6
commit 024c618f20
21 changed files with 351 additions and 24 deletions

View File

@@ -13,6 +13,7 @@ use rand::rngs::OsRng;
use rand::{CryptoRng, Rng};
use std::ops::RangeFrom;
use std::time::SystemTime;
// Deliberately not reusing the constants from `protocol`.
pub(crate) const PRE_KYBER_MESSAGE_VERSION: u32 = 3;
@@ -37,6 +38,7 @@ pub async fn encrypt(
remote_address,
&mut store.session_store,
&mut store.identity_store,
SystemTime::now(),
)
.await
}