/// Complete the handshake, resulting in duplex STROBE transcripts
Complete the handshake, resulting in duplex STROBE transcripts
Complete the handshake resulting in duplex STROBE transcripts
pub fn complete(mut self, handshake: Handshake) -> Result<Duplex, ()> {
        if handshake.originator_id == self.handshake.originator_id {
            // Deny attempt to replay our own concurrent sessions
            return Err(());
        }
        if !self.ignore_application_instance_id
            && (handshake.application_instance_id == self.handshake.application_instance_id)
        {
            // Deny attempt to replay our own concurrent sessions
            return Err(());
        }
        // apply the incoming handshake
        self.tx_transcript.recv_clr(&handshake.to_bytes(), false);
        // catch the rx transcript up
        self.rx_transcript.recv_clr(&handshake.to_bytes(), false);
        self.rx_transcript
            .send_clr(&self.handshake.to_bytes(), false);
        // NOTE since the transcripts are bound to both handshakes, a MITM attempt at
        // a key malleability attack will fail (as it would change the blinded_password)
        // Y ^ x = (g ^ y) ^ x
        let shared_secret = handshake.consume().decompress().ok_or(())? * self.blind;
        self.tx_transcript
            .key(shared_secret.compress().as_bytes(), false);
        self.rx_transcript
            .key(shared_secret.compress().as_bytes(), false);
        Ok(Duplex {
            tx: self.tx_transcript,
            rx: self.rx_transcript,
        })
    }
pub fn complete ( mut self , handshake : Handshake ) -> Result < Duplex , ( ) > { if handshake . originator_id == self . handshake . originator_id { // Deny attempt to replay our own concurrent sessions return Err ( ( ) ) ; } if ! self . ignore_application_instance_id && ( handshake . application_instance_id == self . handshake . application_instance_id ) { // Deny attempt to replay our own concurrent sessions return Err ( ( ) ) ; } // apply the incoming handshake self . tx_transcript . recv_clr ( & handshake . to_bytes ( ) , false ) ; // catch the rx transcript up self . rx_transcript . recv_clr ( & handshake . to_bytes ( ) , false ) ; self . rx_transcript . send_clr ( & self . handshake . to_bytes ( ) , false ) ; // NOTE since the transcripts are bound to both handshakes, a MITM attempt at // a key malleability attack will fail (as it would change the blinded_password) // Y ^ x = (g ^ y) ^ x let shared_secret = handshake . consume ( ) . decompress ( ) . ok_or ( ( ) ) ? * self . blind ; self . tx_transcript . key ( shared_secret . compress ( ) . as_bytes ( ) , false ) ; self . rx_transcript . key ( shared_secret . compress ( ) . as_bytes ( ) , false ) ; Ok ( Duplex { tx : self . tx_transcript , rx : self . rx_transcript , } ) }
Complete the handshake, resulting in duplex STROBE transcripts
Complete the handshake resulting in duplex STROBE transcripts
mut self
handshake
Handshake