Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jmwample committed Dec 7, 2023
1 parent 56846e7 commit 978150f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 40 deletions.
53 changes: 26 additions & 27 deletions src/o5/mod.rs
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
#[cfg(test)]
mod tests {
use super::*;
use pqc_kyber::*;
use x25519_dalek::{EphemeralSecret, PublicKey};

#[derive(Debug)]
enum Error {
PQCError(pqc_kyber::KyberError),
Other(Box<dyn std::error::Error>),
}
type Result<T> = std::result::Result<T, Error>;

impl From<pqc_kyber::KyberError> for Error {
fn from(e: pqc_kyber::KyberError) -> Self {
return Error::PQCError(e);
#[derive(Debug)]
enum Error {
PQCError(pqc_kyber::KyberError),
Other(Box<dyn std::error::Error>),
}
}

// impl From<&dyn std::error::Error> for Error {
// fn from(e: &dyn std::error::Error) -> Self {
// Error::Other(Box::new(e))
// }
// }

struct Kyber1024XKeypair {}

impl Kyber1024XKeypair {
fn new() -> Result<Self> {
todo!()
impl From<pqc_kyber::KyberError> for Error {
fn from(e: pqc_kyber::KyberError) -> Self {
return Error::PQCError(e);
}
}
}

type Result<T> = std::result::Result<T, Error>;
// impl From<&dyn std::error::Error> for Error {
// fn from(e: &dyn std::error::Error) -> Self {
// Error::Other(Box::new(e))
// }
// }

#[cfg(test)]
mod tests {
use super::*;
use pqc_kyber::*;
use x25519_dalek::{EphemeralSecret, PublicKey};
struct Kyber1024XKeypair {}

impl Kyber1024XKeypair {
fn new() -> Result<Self> {
todo!()
}
}

#[test]
fn it_works() -> Result<()> {
Expand Down
11 changes: 4 additions & 7 deletions src/obfs4/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ pub fn build(
data: Option<impl AsRef<[u8]>>,
pad_len: usize,
) -> impl Packet {
return PrngSeedMessage {len_seed: [0_u8; drbg::SEED_LENGTH]};
return PrngSeedMessage {
len_seed: [0_u8; drbg::SEED_LENGTH],
};
}

pub trait Packet {
Expand Down Expand Up @@ -87,8 +89,7 @@ impl ClientHandshakeMessage {
return drbg::Seed::new();
}


pub fn get_mark(&self) -> Result<[u8;MARK_LENGTH]> {
pub fn get_mark(&self) -> Result<[u8; MARK_LENGTH]> {
todo!()
}

Expand Down Expand Up @@ -177,7 +178,6 @@ impl ServerHandshakeMessage {
// TODO: Actual derive from messsage
return drbg::Seed::new();
}

}

impl Packet for ServerHandshakeMessage {
Expand Down Expand Up @@ -292,9 +292,6 @@ pub fn find_mac_mark(
max_pos: usize,
from_tait: bool,
) -> Option<usize> {



None
}

Expand Down
2 changes: 1 addition & 1 deletion src/obfs4/proto/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::{
common::{elligator2::Representative, ntor},
obfs4::{
framing::{Obfs4Codec, KEY_LENGTH, KEY_MATERIAL_LENGTH, FrameError},
framing::{FrameError, Obfs4Codec, KEY_LENGTH, KEY_MATERIAL_LENGTH},
packet::{self, Packet, ServerHandshakeMessage},
},
stream::Stream,
Expand Down
6 changes: 1 addition & 5 deletions src/obfs4/proto/server.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#![allow(unused)]

use crate::{
common::{
drbg, ntor,
replay_filter::ReplayFilter,
elligator2::Representative,
},
common::{drbg, elligator2::Representative, ntor, replay_filter::ReplayFilter},
obfs4::{
framing::{FrameError, Obfs4Codec, KEY_MATERIAL_LENGTH},
packet::ClientHandshakeMessage,
Expand Down

0 comments on commit 978150f

Please sign in to comment.