mirror of
https://github.com/tlsnotary/tlsn.git
synced 2026-04-28 03:00:14 -04:00
relocate hs msgs
This commit is contained in:
@@ -2,60 +2,7 @@ use super::sha::finalize_sha256_digest;
|
||||
use super::utils::{seed_cf, seed_ke, seed_ms, seed_sf};
|
||||
use super::HandshakeMessage;
|
||||
use super::{errors::*, MasterCore};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterMs1 {
|
||||
/// H((pms xor ipad) || seed)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterMs2 {
|
||||
/// H((pms xor ipad) || a1)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterMs3 {
|
||||
/// H((pms xor ipad) || a2)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterKe1 {
|
||||
/// H((ms xor ipad) || seed)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterKe2 {
|
||||
/// H((ms xor ipad) || a1)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterCf1 {
|
||||
/// H((ms xor ipad) || seed)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterCf2 {
|
||||
/// H((ms xor ipad) || a1 || seed)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterSf1 {
|
||||
/// H((ms xor ipad) || seed)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterSf2 {
|
||||
/// H((ms xor ipad) || a1 || seed)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
use crate::msgs::handshake::*;
|
||||
|
||||
#[derive(PartialEq, Copy, Clone)]
|
||||
enum State {
|
||||
|
||||
@@ -4,38 +4,10 @@ mod sha;
|
||||
pub mod slave;
|
||||
mod utils;
|
||||
|
||||
pub use crate::msgs::handshake::HandshakeMessage;
|
||||
use errors::*;
|
||||
pub use master::HandshakeMaster;
|
||||
use master::{
|
||||
MasterCf1, MasterCf2, MasterKe1, MasterKe2, MasterMs1, MasterMs2, MasterMs3, MasterSf1,
|
||||
MasterSf2,
|
||||
};
|
||||
pub use slave::HandshakeSlave;
|
||||
use slave::{
|
||||
SlaveCf1, SlaveCf2, SlaveKe1, SlaveKe2, SlaveMs1, SlaveMs2, SlaveMs3, SlaveSf1, SlaveSf2,
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum HandshakeMessage {
|
||||
MasterMs1(MasterMs1),
|
||||
SlaveMs1(SlaveMs1),
|
||||
MasterMs2(MasterMs2),
|
||||
SlaveMs2(SlaveMs2),
|
||||
MasterMs3(MasterMs3),
|
||||
SlaveMs3(SlaveMs3),
|
||||
MasterKe1(MasterKe1),
|
||||
SlaveKe1(SlaveKe1),
|
||||
MasterKe2(MasterKe2),
|
||||
SlaveKe2(SlaveKe2),
|
||||
MasterCf1(MasterCf1),
|
||||
SlaveCf1(SlaveCf1),
|
||||
MasterCf2(MasterCf2),
|
||||
SlaveCf2(SlaveCf2),
|
||||
MasterSf1(MasterSf1),
|
||||
SlaveSf1(SlaveSf1),
|
||||
MasterSf2(MasterSf2),
|
||||
SlaveSf2(SlaveSf2),
|
||||
}
|
||||
|
||||
pub trait MasterCore {
|
||||
/// The first method that should be called after instantiation. Performs
|
||||
|
||||
@@ -1,58 +1,7 @@
|
||||
use super::sha::finalize_sha256_digest;
|
||||
use super::HandshakeMessage;
|
||||
use super::{errors::*, SlaveCore};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveMs1 {
|
||||
/// H((pms xor opad) || H((pms xor ipad) || seed))
|
||||
pub a1: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveMs2 {
|
||||
/// H((pms xor opad) || H((pms xor ipad) || a1))
|
||||
pub a2: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveMs3 {
|
||||
/// H((pms xor opad) || H((pms xor ipad) || a2 || seed))
|
||||
pub p2: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveKe1 {
|
||||
/// H((ms xor opad) || H((ms xor ipad) || seed))
|
||||
pub a1: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveKe2 {
|
||||
/// H((ms xor opad) || H((ms xor ipad) || a1))
|
||||
pub a2: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveCf1 {
|
||||
/// H((ms xor opad) || H((ms xor ipad) || seed))
|
||||
pub a1: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveCf2 {
|
||||
pub verify_data: [u8; 12],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveSf1 {
|
||||
/// H((ms xor opad) || H((ms xor ipad) || seed))
|
||||
pub a1: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveSf2 {
|
||||
pub verify_data: [u8; 12],
|
||||
}
|
||||
use crate::msgs::handshake::*;
|
||||
|
||||
#[derive(PartialEq, Copy, Clone)]
|
||||
enum State {
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
pub mod ghash;
|
||||
#[cfg(feature = "handshake")]
|
||||
pub mod handshake;
|
||||
pub mod msgs;
|
||||
|
||||
127
tls-2pc-core/src/msgs/handshake.rs
Normal file
127
tls-2pc-core/src/msgs/handshake.rs
Normal file
@@ -0,0 +1,127 @@
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum HandshakeMessage {
|
||||
MasterMs1(MasterMs1),
|
||||
SlaveMs1(SlaveMs1),
|
||||
MasterMs2(MasterMs2),
|
||||
SlaveMs2(SlaveMs2),
|
||||
MasterMs3(MasterMs3),
|
||||
SlaveMs3(SlaveMs3),
|
||||
MasterKe1(MasterKe1),
|
||||
SlaveKe1(SlaveKe1),
|
||||
MasterKe2(MasterKe2),
|
||||
SlaveKe2(SlaveKe2),
|
||||
MasterCf1(MasterCf1),
|
||||
SlaveCf1(SlaveCf1),
|
||||
MasterCf2(MasterCf2),
|
||||
SlaveCf2(SlaveCf2),
|
||||
MasterSf1(MasterSf1),
|
||||
SlaveSf1(SlaveSf1),
|
||||
MasterSf2(MasterSf2),
|
||||
SlaveSf2(SlaveSf2),
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterMs1 {
|
||||
/// H((pms xor ipad) || seed)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterMs2 {
|
||||
/// H((pms xor ipad) || a1)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterMs3 {
|
||||
/// H((pms xor ipad) || a2)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterKe1 {
|
||||
/// H((ms xor ipad) || seed)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterKe2 {
|
||||
/// H((ms xor ipad) || a1)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterCf1 {
|
||||
/// H((ms xor ipad) || seed)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterCf2 {
|
||||
/// H((ms xor ipad) || a1 || seed)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterSf1 {
|
||||
/// H((ms xor ipad) || seed)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct MasterSf2 {
|
||||
/// H((ms xor ipad) || a1 || seed)
|
||||
pub inner_hash: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveMs1 {
|
||||
/// H((pms xor opad) || H((pms xor ipad) || seed))
|
||||
pub a1: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveMs2 {
|
||||
/// H((pms xor opad) || H((pms xor ipad) || a1))
|
||||
pub a2: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveMs3 {
|
||||
/// H((pms xor opad) || H((pms xor ipad) || a2 || seed))
|
||||
pub p2: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveKe1 {
|
||||
/// H((ms xor opad) || H((ms xor ipad) || seed))
|
||||
pub a1: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveKe2 {
|
||||
/// H((ms xor opad) || H((ms xor ipad) || a1))
|
||||
pub a2: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveCf1 {
|
||||
/// H((ms xor opad) || H((ms xor ipad) || seed))
|
||||
pub a1: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveCf2 {
|
||||
pub verify_data: [u8; 12],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveSf1 {
|
||||
/// H((ms xor opad) || H((ms xor ipad) || seed))
|
||||
pub a1: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct SlaveSf2 {
|
||||
pub verify_data: [u8; 12],
|
||||
}
|
||||
2
tls-2pc-core/src/msgs/mod.rs
Normal file
2
tls-2pc-core/src/msgs/mod.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
#[cfg(feature = "handshake")]
|
||||
pub mod handshake;
|
||||
Reference in New Issue
Block a user