Skip to content

Commit

Permalink
module refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
dr committed Jun 28, 2024
1 parent 7b526b4 commit ba0d2ad
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion benches/benchmark_aes.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use capycrypt::aes::aes_encryptable::AesEncryptable;
use capycrypt::aes::encryptable::AesEncryptable;
use capycrypt::aes::aes_functions::{apply_pcks7_padding, remove_pcks7_padding};
use capycrypt::sha3::aux_functions::byte_utils::get_random_bytes;
use capycrypt::Message;
Expand Down
8 changes: 4 additions & 4 deletions benches/benchmark_e448_224.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use capycrypt::ecc::ecc_encryptable::KeyEncryptable;
use capycrypt::ecc::ecc_keypair::KeyPair;
use capycrypt::ecc::ecc_signable::Signable;
use capycrypt::ecc::encryptable::KeyEncryptable;
use capycrypt::ecc::keypair::KeyPair;
use capycrypt::ecc::signable::Signable;
use capycrypt::sha3::aux_functions::byte_utils::get_random_bytes;
use capycrypt::sha3::sponge_encryptable::SpongeEncryptable;
use capycrypt::sha3::encryptable::SpongeEncryptable;
use capycrypt::SecParam::D224;
use capycrypt::{Message, SecParam};
use criterion::{criterion_group, criterion_main, Criterion};
Expand Down
8 changes: 4 additions & 4 deletions benches/benchmark_e448_512.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use capycrypt::ecc::ecc_encryptable::KeyEncryptable;
use capycrypt::ecc::ecc_keypair::KeyPair;
use capycrypt::ecc::ecc_signable::Signable;
use capycrypt::ecc::encryptable::KeyEncryptable;
use capycrypt::ecc::keypair::KeyPair;
use capycrypt::ecc::signable::Signable;
use capycrypt::sha3::aux_functions::byte_utils::get_random_bytes;
use capycrypt::sha3::sponge_encryptable::SpongeEncryptable;
use capycrypt::sha3::encryptable::SpongeEncryptable;
use capycrypt::SecParam::D512;
use capycrypt::{Message, SecParam};
use criterion::{criterion_group, criterion_main, Criterion};
Expand Down
2 changes: 1 addition & 1 deletion benches/benchmark_sha3.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use capycrypt::sha3::sha3_hashable::Hashable;
use capycrypt::sha3::hashable::Hashable;
use capycrypt::{Message, SecParam};

use capycrypt::sha3::aux_functions::byte_utils::get_random_bytes;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/ecc/ecc_signable.rs → src/ecc/signable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
use serde::{Deserialize, Serialize};
use tiny_ed448_goldilocks::curve::{extended_edwards::ExtendedPoint, field::scalar::Scalar};

use super::ecc_keypair::KeyPair;
use super::keypair::KeyPair;

pub trait Signable {
fn sign(&mut self, key: &KeyPair, d: &SecParam) -> Result<(), OperationError>;
Expand Down
2 changes: 1 addition & 1 deletion src/kem/kem_encryptable.rs → src/kem/encryptable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use capy_kem::{
};
use rand::{thread_rng, RngCore};

use super::kem_keypair::{KEMPrivateKey, KEMPublicKey};
use super::keypair::{KEMPrivateKey, KEMPublicKey};

pub trait KEMEncryptable {
fn kem_encrypt(&mut self, key: &KEMPublicKey, d: &SecParam) -> Result<(), OperationError>;
Expand Down
File renamed without changes.
18 changes: 9 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::just_underscores_and_digits)]
use ecc::ecc_signable::Signature;
use ecc::signable::Signature;
use serde::{Deserialize, Serialize};
use std::fs::File;
use std::io::Read;
Expand Down Expand Up @@ -36,28 +36,28 @@ pub mod sha3 {
pub mod constants;
/// Submodule that implements the Keccak-f[1600] permutation
pub mod keccakf;
pub mod sha3_hashable;
pub mod hashable;
pub mod shake_functions;
/// Submodule that implements the sponge construction
pub mod sponge;
pub mod sponge_encryptable;
pub mod encryptable;
}

pub mod aes {
pub mod aes_constants;
pub mod aes_encryptable;
pub mod aes_functions;
pub mod encryptable;
}

pub mod ecc {
pub mod ecc_encryptable;
pub mod ecc_keypair;
pub mod ecc_signable;
pub mod encryptable;
pub mod keypair;
pub mod signable;
}

pub mod kem {
pub mod kem_encryptable;
pub mod kem_keypair;
pub mod encryptable;
pub mod keypair;
}

#[derive(Clone, Serialize, Deserialize, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use capycrypt::{ecc::ecc_keypair::KeyPair, sha3::sha3_hashable::Hashable, Message, SecParam};
use capycrypt::{ecc::keypair::KeyPair, sha3::hashable::Hashable, Message, SecParam};
use structopt::StructOpt;

#[derive(Debug, StructOpt)]
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/sha3/shake_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub fn kmac_xof(
/// TESTS
#[cfg(test)]
mod shake_tests {
use crate::{sha3::sha3_hashable::Hashable, Message, SecParam};
use crate::{sha3::hashable::Hashable, Message, SecParam};

#[test]
fn test_shake_224() {
Expand Down
2 changes: 1 addition & 1 deletion tests/aes_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[cfg(test)]
mod aes_modes_tests {
use capycrypt::aes::aes_encryptable::AesEncryptable;
use capycrypt::aes::encryptable::AesEncryptable;
use capycrypt::sha3::aux_functions::byte_utils::get_random_bytes;
use capycrypt::Message;

Expand Down
12 changes: 6 additions & 6 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ pub mod ops_tests {
use tempfile::tempdir;

use capycrypt::{
ecc::{ecc_encryptable::KeyEncryptable, ecc_keypair::KeyPair, ecc_signable::Signable},
kem::{kem_encryptable::KEMEncryptable, kem_keypair::kem_keygen},
ecc::{encryptable::KeyEncryptable, keypair::KeyPair, signable::Signable},
kem::{encryptable::KEMEncryptable, keypair::kem_keygen},
sha3::{
aux_functions::byte_utils::get_random_bytes, sponge_encryptable::SpongeEncryptable,
aux_functions::byte_utils::get_random_bytes, encryptable::SpongeEncryptable,
},
Message, SecParam,
};
Expand Down Expand Up @@ -198,10 +198,10 @@ pub mod ops_tests {

#[cfg(test)]
mod decryption_test {
use capycrypt::ecc::ecc_encryptable::KeyEncryptable;
use capycrypt::ecc::ecc_keypair::KeyPair;
use capycrypt::ecc::encryptable::KeyEncryptable;
use capycrypt::ecc::keypair::KeyPair;
use capycrypt::sha3::aux_functions::byte_utils::get_random_bytes;
use capycrypt::sha3::sponge_encryptable::SpongeEncryptable;
use capycrypt::sha3::encryptable::SpongeEncryptable;
use capycrypt::Message;
use capycrypt::SecParam::D512;

Expand Down

0 comments on commit ba0d2ad

Please sign in to comment.