From de03acbfaae1b263c7ed286785579f8b814b33a4 Mon Sep 17 00:00:00 2001 From: mami Date: Wed, 14 Dec 2022 23:13:39 -0500 Subject: [PATCH] moved a struct --- zssp/src/zssp.rs | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/zssp/src/zssp.rs b/zssp/src/zssp.rs index 89b4e0271..9840f954f 100644 --- a/zssp/src/zssp.rs +++ b/zssp/src/zssp.rs @@ -120,6 +120,20 @@ struct SessionMutableState { last_remote_offer: i64, // Time of most recent ephemeral offer (ms) } +/// A shared symmetric session key. +struct SessionKey { + secret_fingerprint: [u8; 16], // First 128 bits of a SHA384 computed from the secret + establish_time: i64, // Time session key was established + establish_counter: u64, // Counter value at which session was established + lifetime: KeyLifetime, // Key expiration time and counter + ratchet_key: Secret<64>, // Ratchet key for deriving the next session key + receive_key: Secret, // Receive side AES-GCM key + send_key: Secret, // Send side AES-GCM key + receive_cipher_pool: Mutex>>, // Pool of initialized sending ciphers + send_cipher_pool: Mutex>>, // Pool of initialized receiving ciphers + ratchet_count: u64, // Number of new keys negotiated in this session + jedi: bool, // True if Kyber1024 was used (both sides enabled) +} /// Alice's KEY_OFFER, remembered so Noise agreement process can resume on KEY_COUNTER_OFFER. struct EphemeralOffer { @@ -1455,21 +1469,6 @@ impl KeyLifetime { } } -/// A shared symmetric session key. -struct SessionKey { - secret_fingerprint: [u8; 16], // First 128 bits of a SHA384 computed from the secret - establish_time: i64, // Time session key was established - establish_counter: u64, // Counter value at which session was established - lifetime: KeyLifetime, // Key expiration time and counter - ratchet_key: Secret<64>, // Ratchet key for deriving the next session key - receive_key: Secret, // Receive side AES-GCM key - send_key: Secret, // Send side AES-GCM key - receive_cipher_pool: Mutex>>, // Pool of initialized sending ciphers - send_cipher_pool: Mutex>>, // Pool of initialized receiving ciphers - ratchet_count: u64, // Number of new keys negotiated in this session - jedi: bool, // True if Kyber1024 was used (both sides enabled) -} - impl SessionKey { /// Create a new symmetric shared session key and set its key expiration times, etc. fn new(key: Secret<64>, role: Role, current_time: i64, current_counter: CounterValue, ratchet_count: u64, jedi: bool) -> Self {