diff --git a/Cargo.lock b/Cargo.lock index 3935b7c..9cd9581 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1055,6 +1055,7 @@ dependencies = [ "hyper", "julianday", "lox-library", + "lox-zkp", "lox_utils", "prometheus", "prometheus-client", @@ -1067,7 +1068,6 @@ dependencies = [ "sled", "time", "tokio", - "zkp", ] [[package]] @@ -1082,6 +1082,7 @@ dependencies = [ "ed25519-dalek", "hex_fmt", "lazy_static", + "lox-zkp", "prometheus", "rand 0.8.5", "serde", @@ -1091,7 +1092,6 @@ dependencies = [ "subtle", "thiserror", "time", - "zkp", ] [[package]] @@ -1105,12 +1105,25 @@ dependencies = [ "julianday", "lazy_static", "lox-library", + "lox-zkp", "lox_utils", "rand 0.7.3", "serde_json", "time", "wasm-bindgen", - "zkp", +] + +[[package]] +name = "lox-zkp" +version = "0.8.0" +source = "git+https://gitlab.torproject.org/onyinyang/lox-zkp#10a8379081f079fc09669640f29c255897b3b454" +dependencies = [ + "curve25519-dalek", + "merlin", + "rand 0.8.5", + "serde", + "serde_derive", + "thiserror", ] [[package]] @@ -2529,16 +2542,3 @@ dependencies = [ "quote", "syn", ] - -[[package]] -name = "zkp" -version = "0.8.0" -source = "git+https://gitlab.torproject.org/onyinyang/lox-zkp#7dc7562ecdac3a6c7c7ecc31cace192174d34778" -dependencies = [ - "curve25519-dalek", - "merlin", - "rand 0.8.5", - "serde", - "serde_derive", - "thiserror", -] diff --git a/crates/lox-distributor/Cargo.toml b/crates/lox-distributor/Cargo.toml index c671ccc..0d34843 100644 --- a/crates/lox-distributor/Cargo.toml +++ b/crates/lox-distributor/Cargo.toml @@ -26,7 +26,7 @@ rand = "0.8.5" reqwest = { version = "0.11", features = ["json", "stream"]} serde = { version = "1.0", features = ["derive", "rc"] } serde_with = "3.4.0" -zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = "0.8.0" } +lox-zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = "0.8.0" } lox-library = { path = "../lox-library", version = "0.1.0"} lox_utils = { path = "../lox-utils", version = "0.1.0"} rdsys_backend = { path = "../rdsys-backend-api", version = "0.2"} diff --git a/crates/lox-distributor/src/lox_context.rs b/crates/lox-distributor/src/lox_context.rs index 5ab7b95..1ddf245 100644 --- a/crates/lox-distributor/src/lox_context.rs +++ b/crates/lox-distributor/src/lox_context.rs @@ -16,7 +16,7 @@ use std::{ collections::HashMap, sync::{Arc, Mutex}, }; -use zkp::ProofError; +use lox_zkp::ProofError; use crate::metrics::Metrics; use crate::resource_parser::{parse_into_bridgelines, sort_for_parsing}; diff --git a/crates/lox-library/Cargo.toml b/crates/lox-library/Cargo.toml index 17d8def..9797dcb 100644 --- a/crates/lox-library/Cargo.toml +++ b/crates/lox-library/Cargo.toml @@ -31,7 +31,7 @@ time = "0.3.30" prometheus = "0.13.3" subtle = "2.5" thiserror = "1.0.50" -zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = "0.8.0" } +lox-zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = "0.8.0" } [features] fast = [] diff --git a/crates/lox-library/src/lib.rs b/crates/lox-library/src/lib.rs index 5c6256f..0cf3a5f 100644 --- a/crates/lox-library/src/lib.rs +++ b/crates/lox-library/src/lib.rs @@ -15,7 +15,7 @@ The notation follows that of the paper "Hyphae: Social Secret Sharing" #![allow(non_snake_case)] #[macro_use] -extern crate zkp; +extern crate lox_zkp; pub mod bridge_table; pub mod cred; diff --git a/crates/lox-library/src/proto/blockage_migration.rs b/crates/lox-library/src/proto/blockage_migration.rs index c367dcf..e2b5f58 100644 --- a/crates/lox-library/src/proto/blockage_migration.rs +++ b/crates/lox-library/src/proto/blockage_migration.rs @@ -37,9 +37,9 @@ use curve25519_dalek::ristretto::RistrettoPoint; use curve25519_dalek::scalar::Scalar; use curve25519_dalek::traits::IsIdentity; -use zkp::CompactProof; -use zkp::ProofError; -use zkp::Transcript; +use lox_zkp::CompactProof; +use lox_zkp::ProofError; +use lox_zkp::Transcript; use serde::{Deserialize, Serialize}; @@ -76,7 +76,7 @@ pub struct Request { EncBucket: (RistrettoPoint, RistrettoPoint), EncBlockages: (RistrettoPoint, RistrettoPoint), - // The combined ZKP + // The combined lox_zkp piUser: CompactProof, } @@ -107,7 +107,7 @@ pub struct Response { TBucket: RistrettoPoint, TBlockages: RistrettoPoint, - // The ZKP + // The lox_zkp piBlindIssue: CompactProof, } @@ -224,7 +224,7 @@ pub fn request( // Form a Pedersen commitment to the MAC Q // We flip the sign of zQ from that of the Hyphae paper so that - // the ZKP has a "+" instead of a "-", as that's what the zkp + // the lox_zkp has a "+" instead of a "-", as that's what the zkp // macro supports. let negzQ_lox = Scalar::random(&mut rng); let CQ_lox = Q_lox - &negzQ_lox * Atable; @@ -251,7 +251,7 @@ pub fn request( // Form a Pedersen commitment to the MAC Q // We flip the sign of zQ from that of the Hyphae paper so that - // the ZKP has a "+" instead of a "-", as that's what the zkp + // the lox_zkp has a "+" instead of a "-", as that's what the zkp // macro supports. let negzQ_mig = Scalar::random(&mut rng); let CQ_mig = Q_mig - &negzQ_mig * Atable; @@ -416,7 +416,7 @@ impl BridgeAuth { + self.migration_priv.x[3] * req.CToBucket - req.CQ_mig; - // Verify the ZKP + // Verify the zkp let mut transcript = Transcript::new(b"blockage migration request"); requestproof::verify_compact( &req.piUser, diff --git a/crates/lox-library/src/proto/check_blockage.rs b/crates/lox-library/src/proto/check_blockage.rs index 323ad01..a2cc009 100644 --- a/crates/lox-library/src/proto/check_blockage.rs +++ b/crates/lox-library/src/proto/check_blockage.rs @@ -33,9 +33,9 @@ use curve25519_dalek::ristretto::RistrettoPoint; use curve25519_dalek::scalar::Scalar; use curve25519_dalek::traits::IsIdentity; -use zkp::CompactProof; -use zkp::ProofError; -use zkp::Transcript; +use lox_zkp::CompactProof; +use lox_zkp::ProofError; +use lox_zkp::Transcript; use serde::{Deserialize, Serialize}; use serde_with::serde_as; @@ -69,7 +69,7 @@ pub struct Request { D: RistrettoPoint, EncBucket: (RistrettoPoint, RistrettoPoint), - // The combined ZKP + // The combined lox_zkp piUser: CompactProof, } @@ -158,7 +158,7 @@ pub fn request( // Form a Pedersen commitment to the MAC Q // We flip the sign of zQ from that of the Hyphae paper so that - // the ZKP has a "+" instead of a "-", as that's what the zkp + // the lox_zkp has a "+" instead of a "-", as that's what the lox_zkp // macro supports. let negzQ = Scalar::random(&mut rng); let CQ = Q - &negzQ * Atable; @@ -268,7 +268,7 @@ impl BridgeAuth { + self.lox_priv.x[6] * req.CBlockages - req.CQ; - // Verify the ZKP + // Verify the zkp let mut transcript = Transcript::new(b"check blockage request"); requestproof::verify_compact( &req.piUser, diff --git a/crates/lox-library/src/proto/issue_invite.rs b/crates/lox-library/src/proto/issue_invite.rs index a512270..4efd1c9 100644 --- a/crates/lox-library/src/proto/issue_invite.rs +++ b/crates/lox-library/src/proto/issue_invite.rs @@ -50,9 +50,9 @@ use curve25519_dalek::ristretto::RistrettoPoint; use curve25519_dalek::scalar::Scalar; use curve25519_dalek::traits::IsIdentity; -use zkp::CompactProof; -use zkp::ProofError; -use zkp::Transcript; +use lox_zkp::CompactProof; +use lox_zkp::ProofError; +use lox_zkp::Transcript; use serde::{Deserialize, Serialize}; diff --git a/crates/lox-library/src/proto/level_up.rs b/crates/lox-library/src/proto/level_up.rs index 2480b81..c267825 100644 --- a/crates/lox-library/src/proto/level_up.rs +++ b/crates/lox-library/src/proto/level_up.rs @@ -43,9 +43,9 @@ use curve25519_dalek::ristretto::RistrettoPoint; use curve25519_dalek::scalar::Scalar; use curve25519_dalek::traits::IsIdentity; -use zkp::CompactProof; -use zkp::ProofError; -use zkp::Transcript; +use lox_zkp::CompactProof; +use lox_zkp::ProofError; +use lox_zkp::Transcript; use serde::{Deserialize, Serialize}; diff --git a/crates/lox-library/src/proto/migration.rs b/crates/lox-library/src/proto/migration.rs index ce7bc5f..df6a402 100644 --- a/crates/lox-library/src/proto/migration.rs +++ b/crates/lox-library/src/proto/migration.rs @@ -35,9 +35,9 @@ use curve25519_dalek::ristretto::RistrettoPoint; use curve25519_dalek::scalar::Scalar; use curve25519_dalek::traits::IsIdentity; -use zkp::CompactProof; -use zkp::ProofError; -use zkp::Transcript; +use lox_zkp::CompactProof; +use lox_zkp::ProofError; +use lox_zkp::Transcript; use serde::{Deserialize, Serialize}; diff --git a/crates/lox-library/src/proto/open_invite.rs b/crates/lox-library/src/proto/open_invite.rs index b95fc4a..cf4cf7c 100644 --- a/crates/lox-library/src/proto/open_invite.rs +++ b/crates/lox-library/src/proto/open_invite.rs @@ -18,9 +18,9 @@ use curve25519_dalek::ristretto::RistrettoPoint; use curve25519_dalek::scalar::Scalar; use curve25519_dalek::traits::IsIdentity; -use zkp::CompactProof; -use zkp::ProofError; -use zkp::Transcript; +use lox_zkp::CompactProof; +use lox_zkp::ProofError; +use lox_zkp::Transcript; use serde::{Deserialize, Serialize}; use serde_with::serde_as; diff --git a/crates/lox-library/src/proto/redeem_invite.rs b/crates/lox-library/src/proto/redeem_invite.rs index 9f288d6..230fe7c 100644 --- a/crates/lox-library/src/proto/redeem_invite.rs +++ b/crates/lox-library/src/proto/redeem_invite.rs @@ -26,9 +26,9 @@ use curve25519_dalek::ristretto::RistrettoPoint; use curve25519_dalek::scalar::Scalar; use curve25519_dalek::traits::IsIdentity; -use zkp::CompactProof; -use zkp::ProofError; -use zkp::Transcript; +use lox_zkp::CompactProof; +use lox_zkp::ProofError; +use lox_zkp::Transcript; use serde::{Deserialize, Serialize}; diff --git a/crates/lox-library/src/proto/trust_promotion.rs b/crates/lox-library/src/proto/trust_promotion.rs index 18b921a..2e2266f 100644 --- a/crates/lox-library/src/proto/trust_promotion.rs +++ b/crates/lox-library/src/proto/trust_promotion.rs @@ -32,9 +32,9 @@ use curve25519_dalek::ristretto::RistrettoPoint; use curve25519_dalek::scalar::Scalar; use curve25519_dalek::traits::IsIdentity; -use zkp::CompactProof; -use zkp::ProofError; -use zkp::Transcript; +use lox_zkp::CompactProof; +use lox_zkp::ProofError; +use lox_zkp::Transcript; use serde::{Deserialize, Serialize}; use serde_with::serde_as; diff --git a/crates/lox-utils/README.md b/crates/lox-utils/README.md new file mode 100644 index 0000000..e35dfab --- /dev/null +++ b/crates/lox-utils/README.md @@ -0,0 +1,3 @@ +# Lox Utils + +This crate contains a number of helper structs and functions that are used by multiple lox crates. \ No newline at end of file diff --git a/crates/lox-wasm/Cargo.toml b/crates/lox-wasm/Cargo.toml index 82fe4a5..53e919e 100644 --- a/crates/lox-wasm/Cargo.toml +++ b/crates/lox-wasm/Cargo.toml @@ -27,7 +27,7 @@ serde_json = "1.0.108" console_error_panic_hook = "0.1.7" js-sys = "0.3.65" rand = { version = "0.7", features = ["wasm-bindgen"] } -zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = "0.8.0" } +lox-zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = "0.8.0" } [dependencies.chrono] version = "0.4.31" diff --git a/crates/rdsys-backend-api/Cargo.toml b/crates/rdsys-backend-api/Cargo.toml index 46df638..378f5ef 100644 --- a/crates/rdsys-backend-api/Cargo.toml +++ b/crates/rdsys-backend-api/Cargo.toml @@ -4,6 +4,7 @@ authors = ["Cecylia Bocovich , Lindsey Tulloch