Ver código fonte

move p-OT and DOPRF to oram crate

Lennart Braun 2 anos atrás
pai
commit
cdd7f7abc5
8 arquivos alterados com 29 adições e 23 exclusões
  1. 17 0
      oram/Cargo.toml
  2. 2 2
      oram/benches/doprf.rs
  3. 1 1
      oram/benches/p_ot.rs
  4. 2 2
      oram/src/doprf.rs
  5. 2 0
      oram/src/lib.rs
  6. 4 4
      oram/src/p_ot.rs
  7. 1 12
      utils/Cargo.toml
  8. 0 2
      utils/src/lib.rs

+ 17 - 0
oram/Cargo.toml

@@ -6,4 +6,21 @@ edition = "2021"
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [dependencies]
+utils = { path = "../utils" }
 ff = "0.13.0"
+itertools = "0.10.5"
+num-bigint = "0.4.3"
+num-traits = "0.2.15"
+rand = "0.8.5"
+rand_chacha = "0.3.1"
+
+[dev-dependencies]
+criterion = "0.4.0"
+
+[[bench]]
+name = "doprf"
+harness = false
+
+[[bench]]
+name = "p_ot"
+harness = false

+ 2 - 2
utils/benches/doprf.rs → oram/benches/doprf.rs

@@ -1,8 +1,8 @@
 use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
 use ff::Field;
+use oram::doprf::LegendrePrf;
+use oram::doprf::{DOPrfParty1, DOPrfParty2, DOPrfParty3};
 use rand::thread_rng;
-use utils::doprf::LegendrePrf;
-use utils::doprf::{DOPrfParty1, DOPrfParty2, DOPrfParty3};
 use utils::field::Fp;
 
 pub fn bench_legendre_prf(c: &mut Criterion) {

+ 1 - 1
utils/benches/p_ot.rs → oram/benches/p_ot.rs

@@ -1,7 +1,7 @@
 use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
+use oram::p_ot::{POTIndexParty, POTKeyParty, POTReceiverParty};
 use rand::{thread_rng, Rng};
 use utils::field::Fp;
-use utils::p_ot::{POTIndexParty, POTKeyParty, POTReceiverParty};
 use utils::permutation::FisherYatesPermutation;
 
 const LOG_DOMAIN_SIZES: [u32; 4] = [8, 12, 16, 20];

+ 2 - 2
utils/src/doprf.rs → oram/src/doprf.rs

@@ -1,4 +1,4 @@
-use crate::field::{FromLimbs, FromPrf, LegendreSymbol, Modulus128};
+use utils::field::{FromLimbs, FromPrf, LegendreSymbol, Modulus128};
 use core::marker::PhantomData;
 use itertools::izip;
 use num_bigint::BigUint;
@@ -493,7 +493,7 @@ where
 #[cfg(test)]
 mod tests {
     use super::*;
-    use crate::field::Fp;
+    use utils::field::Fp;
     use ff::Field;
 
     #[test]

+ 2 - 0
oram/src/lib.rs

@@ -1,3 +1,5 @@
 mod common;
+pub mod doprf;
 pub mod oram;
+pub mod p_ot;
 mod stash;

+ 4 - 4
utils/src/p_ot.rs → oram/src/p_ot.rs

@@ -1,7 +1,7 @@
-use crate::field::FromPrf;
-use crate::permutation::Permutation;
 use core::marker::PhantomData;
 use ff::Field;
+use utils::field::FromPrf;
+use utils::permutation::Permutation;
 
 pub struct POTKeyParty<F: FromPrf, Perm> {
     /// log of the database size
@@ -150,8 +150,8 @@ impl<F: Field + FromPrf> POTReceiverParty<F> {
 #[cfg(test)]
 mod tests {
     use super::*;
-    use crate::field::Fp;
-    use crate::permutation::FisherYatesPermutation;
+    use utils::field::Fp;
+    use utils::permutation::FisherYatesPermutation;
 
     fn test_pot<F, Perm>(log_domain_size: u32)
     where

+ 1 - 12
utils/Cargo.toml

@@ -6,27 +6,16 @@ edition = "2021"
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [dependencies]
-aes = "0.8.1"
+aes = "0.8.2"
 blake3 = "1.3.3"
 ff = { version = "0.13.0", features = ["derive"] }
-itertools = "0.10.5"
 num = "0.4.0"
-num-bigint = "0.4.3"
-num-traits = "0.2.15"
 rand = "0.8.5"
 rand_chacha = "0.3.1"
 
 [dev-dependencies]
 criterion = "0.4.0"
 
-[[bench]]
-name = "doprf"
-harness = false
-
 [[bench]]
 name = "permutation"
 harness = false
-
-[[bench]]
-name = "p_ot"
-harness = false

+ 0 - 2
utils/src/lib.rs

@@ -1,7 +1,5 @@
 pub mod bit_decompose;
-pub mod doprf;
 pub mod field;
 pub mod fixed_key_aes;
-pub mod p_ot;
 pub mod permutation;
 pub mod pseudorandom_conversion;