Skip to content

Commit

Permalink
Update dependencies (#117)
Browse files Browse the repository at this point in the history
Summary:
## Types of changes

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [x] Docs change / refactoring / dependency upgrade

## Motivation and Context / Related issue

Update dependencies and remove some unused ones.

cc: prasadbuddhavarapu shubho The file `protocol/src/suid_create/mod.rs` in line 163 is using `BASEPOINT_ORDER` which [curve25519_dalek](https://docs.rs/curve25519-dalek/4.1.1/curve25519_dalek/index.html#) after version 4 does not consider in the public API. Check [here](https://docs.rs/curve25519-dalek/4.1.1/curve25519_dalek/constants/constant.BASEPOINT_ORDER.html). I haven't changed that as it's part of the SUID protocol. It works fine but it throws a warning.

## Checklist

- [x] The documentation is up-to-date with the changes I made.
- [x] I have read the **CONTRIBUTING** document and completed the CLA (see **CONTRIBUTING**).
- [x] All tests passed, and additional code has been covered with new tests.

Pull Request resolved: #117

Reviewed By: zertosh, shubho

Differential Revision: D51293836

Pulled By: prasadbuddhavarapu

fbshipit-source-id: edb67f028f103850f4d1e6595296c9afa705840a
  • Loading branch information
jimouris authored and facebook-github-bot committed Nov 22, 2023
1 parent f1cda2b commit 932915c
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 73 deletions.
24 changes: 11 additions & 13 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,24 @@ path = "datagen/datagen.rs"


[dependencies]
log = "0.4"
env_logger = "0.7.1"
rayon = "1.8.0"
clap = "2.33.0"
csv = "1.1.1"
rand = { version = "0.8", features = ["small_rng"] }
indicatif = "0.13.0"
hex = "0.3.0"
serde = {version = "1.0.104", features = ["derive"] }
num = "0.2.1"
wasm-timer = "0.2.5"
aws-config = "0.56.1"
aws-credential-types = "0.56.1"
aws-sdk-s3 = "0.34.0"
aws-smithy-http = "0.56.0"
clap = "2.33.0"
cloud-storage = "0.10"
csv = "1.1.1"
env_logger = "0.7.1"
hex = "0.3.0"
indicatif = "0.13.0"
lazy_static = "1.4.0"
log = "0.4"
rand = { version = "0.8", features = ["small_rng"] }
rayon = "1.8.0"
regex = "1.5.4"
serde = { version = "1.0.104", features = ["derive"] }
serde_json = "1.0"
tempfile = "3.2.0"
thiserror = "1.0.25"
tokio = { version = "1", features = ["full"] }
cloud-storage = "0.10"
tokio-util = { version = "0.6.9", features = ["codec"] }
serde_json = "1.0"
21 changes: 7 additions & 14 deletions crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,17 @@ version = "0.1.0"
authors = ["Facebook Inc"]
edition = "2021"

[features]
avx2 = ["curve25519-dalek/simd_backend"]

[dependencies]
log = "0.4"
env_logger = "0.7.1"
sha2 = "0.9.0"
hex = "0.4.0"
rand = "0.8"
rand_core = "0.5.1"
curve25519-dalek = "3.2"
Cupcake = { git = "https://github.com/facebookresearch/Cupcake"}
rayon = "1.8.0"
serde = {version = "1.0.104", features = ["derive"] }
bincode = "1.2.1"
curve25519-dalek = { version = "4.1.1", features = ["digest", "rand_core"]}
num-bigint = { version = "0.4", features = ["rand"] }
num-traits = "0.2"
num-integer = "0.1"
num-traits = "0.2"
rand = "0.8"
rand_core = "0.6"
rayon = "1.8.0"
serde = {version = "1.0.104", features = ["derive"] }
sha2 = "0.10.6"

[dev-dependencies]
criterion = "0.2"
Expand Down
4 changes: 4 additions & 0 deletions crypto/src/eccipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ impl ECCipher for ECRistrettoSequential {
.iter()
.map(|b| {
CompressedRistretto::from_slice(&b.buffer)
.expect("Failed to construct compressed point")
.decompress()
.unwrap()
})
Expand All @@ -131,6 +132,7 @@ impl ECCipher for ECRistrettoSequential {
.iter()
.map(|b| {
let p = CompressedRistretto::from_slice(&b.buffer)
.expect("Failed to construct compressed point")
.decompress()
.unwrap();
p * pow
Expand Down Expand Up @@ -234,6 +236,7 @@ impl ECCipher for ECRistrettoParallel {
.into_par_iter()
.map(|item| {
CompressedRistretto::from_slice(&item.buffer)
.expect("Failed to construct compressed point")
.decompress()
.unwrap()
})
Expand Down Expand Up @@ -267,6 +270,7 @@ impl ECCipher for ECRistrettoParallel {
.into_par_iter()
.map(|item| {
let p = CompressedRistretto::from_slice(&item.buffer)
.expect("Failed to construct compressed point")
.decompress()
.unwrap();
p * pow
Expand Down
31 changes: 13 additions & 18 deletions protocol-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,38 +89,33 @@ path = "src/rpc/dspmc/client.rs"
name = "rpc"
path = "src/lib.rs"

[features]
avx2 = ["crypto/avx2"]

[dependencies]
common = {path = "../common", version = "0.1.0"}
crypto = {path = "../crypto", version = "0.1.0"}
protocol = {path = "../protocol", version = "0.1.0"}

log = "0.4"
env_logger = "0.7.1"
tonic = { version = "0.7.2", features = ["tls", "tls-roots", "prost"]}
tokio = { version = "1.18.2", features = ["rt-multi-thread", "time", "fs", "macros", "net"] }
tokio-stream = { version = "0.1.8", features = ["net"] }
tower = { version = "0.4.12" }
prost = "0.10"
futures = { version = "0.3", features = ["thread-pool", "alloc"]}
http = "0.2"
url = "2.1.0"
async-stream = "0.2"
rayon = "1.8.0"
bytes = "0.4"
clap = "2.33.4"
csv = "1.1.1"
indicatif = "0.13.0"
ctrlc = "3.2.3"
retry = "0.5.1"
bincode = "1.2.1"
env_logger = "0.7.1"
futures = { version = "0.3", features = ["thread-pool", "alloc"]}
http = "0.2"
itertools = "0.9.0"
tempfile = "3.2.0"
log = "0.4"
num-bigint = { version = "0.4", features = ["rand"] }
num-traits = "0.2"
prost = "0.10"
rayon = "1.8.0"
rcgen = "0.10.0"
retry = "0.5.1"
tempfile = "3.2.0"
tokio = { version = "1.18.2", features = ["rt-multi-thread", "time", "fs", "macros", "net"] }
tokio-stream = { version = "0.1.8", features = ["net"] }
tonic = { version = "0.7.2", features = ["tls", "tls-roots", "prost"]}
tower = { version = "0.4.12" }
url = "2.1.0"

[build-dependencies]
tonic-build = { version = "0.7.2" }
21 changes: 10 additions & 11 deletions protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@ edition = "2021"
[dependencies]
common = {path = "../common", version = "0.1.0"}
crypto = {path = "../crypto", version = "0.1.0"}
serde_json = "1.0"

log = "0.4"
env_logger = "0.7.1"
base64 = "0.13"
csv = "1.1.1"
itertools = "0.9.0"
rand = "0.8"
rand_core = "0.5.1"
fernet = "0.2.1"
hex = "0.4.2"
rayon = "1.8.0"
itertools = "0.9.0"
log = "0.4"
mockall = "0.10.2"
num-bigint = { version = "0.4", features = ["rand"] }
num-traits = "0.2"
zeroize = "1.5.5"
rand = "0.8"
rand_core = "0.6"
rayon = "1.8.0"
serde_json = "1.0"
tempfile = "3.2.0"
mockall = "0.10.2"
fernet = "0.2.1"
base64 = "0.13"
zeroize = "1.5.5"
2 changes: 1 addition & 1 deletion protocol/src/dpmc/company.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl CompanyDpmc {
let x = gen_scalar();
CompanyDpmc {
keypair_sk: x,
keypair_pk: &x * &RISTRETTO_BASEPOINT_TABLE,
keypair_pk: &x * RISTRETTO_BASEPOINT_TABLE,
private_beta: gen_scalar(),
ec_cipher: ECRistrettoParallel::default(),
plaintext: Arc::new(RwLock::default()),
Expand Down
6 changes: 3 additions & 3 deletions protocol/src/dpmc/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl HelperDpmc {
let x = gen_scalar();
HelperDpmc {
keypair_sk: x,
keypair_pk: &x * &RISTRETTO_BASEPOINT_TABLE,
keypair_pk: &x * RISTRETTO_BASEPOINT_TABLE,
company_public_key: Arc::new(RwLock::default()),
ec_cipher: ECRistrettoParallel::default(),
self_permutation: Arc::new(RwLock::default()),
Expand Down Expand Up @@ -168,7 +168,7 @@ impl HelperDpmcProtocol for HelperDpmc {
let alpha_t = {
let ctxt_str: String = String::from_utf8(enc_alpha_t.clone()).unwrap();

Scalar::from_bits(
Scalar::from_bytes_mod_order(
Fernet::new(&aes_key)
.unwrap()
.decrypt(&ctxt_str)
Expand Down Expand Up @@ -519,7 +519,7 @@ impl HelperDpmcProtocol for HelperDpmc {
.collect::<Vec<_>>();
let y = z_i
.iter()
.map(|a| a * &RISTRETTO_BASEPOINT_TABLE)
.map(|a| a * RISTRETTO_BASEPOINT_TABLE)
.collect::<Vec<_>>();
(x, y)
};
Expand Down
6 changes: 3 additions & 3 deletions protocol/src/dpmc/partner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl PartnerDpmc {
let x = gen_scalar();
PartnerDpmc {
keypair_sk: x,
keypair_pk: &x * &RISTRETTO_BASEPOINT_TABLE,
keypair_pk: &x * RISTRETTO_BASEPOINT_TABLE,
partner_scalar: gen_scalar(),
company_public_key: Arc::new(RwLock::default()),
helper_public_key: Arc::new(RwLock::default()),
Expand Down Expand Up @@ -185,7 +185,7 @@ impl PartnerDpmcProtocol for PartnerDpmc {

let p_scalar_times_g = self
.ec_cipher
.to_bytes(&[&self.partner_scalar * &RISTRETTO_BASEPOINT_TABLE]);
.to_bytes(&[&self.partner_scalar * RISTRETTO_BASEPOINT_TABLE]);
d_flat.extend(p_scalar_times_g);

Ok(d_flat)
Expand Down Expand Up @@ -261,7 +261,7 @@ impl PartnerDpmcProtocol for PartnerDpmc {
let g_zi = {
let t = z_i
.iter()
.map(|x| x * &RISTRETTO_BASEPOINT_TABLE)
.map(|x| x * RISTRETTO_BASEPOINT_TABLE)
.collect::<Vec<_>>();
self.ec_cipher.to_bytes(&t)
};
Expand Down
4 changes: 2 additions & 2 deletions protocol/src/dspmc/company.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ impl CompanyDspmc {
CompanyDspmc {
keypair_sk: (x1, x2),
keypair_pk: (
&x1 * &RISTRETTO_BASEPOINT_TABLE,
&x2 * &RISTRETTO_BASEPOINT_TABLE,
&x1 * RISTRETTO_BASEPOINT_TABLE,
&x2 * RISTRETTO_BASEPOINT_TABLE,
),
helper_public_key: Arc::new(RwLock::default()),
ec_cipher: ECRistrettoParallel::default(),
Expand Down
4 changes: 2 additions & 2 deletions protocol/src/dspmc/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl HelperDspmc {
let x = gen_scalar();
HelperDspmc {
keypair_sk: x,
keypair_pk: &x * &RISTRETTO_BASEPOINT_TABLE,
keypair_pk: &x * RISTRETTO_BASEPOINT_TABLE,
ec_cipher: ECRistrettoParallel::default(),
company_public_key: Arc::new(RwLock::default()),
xor_shares_v2: Arc::new(RwLock::default()),
Expand Down Expand Up @@ -641,7 +641,7 @@ impl HelperDspmcProtocol for HelperDspmc {
.collect::<Vec<_>>();
let y = z_i
.iter()
.map(|a| a * &RISTRETTO_BASEPOINT_TABLE)
.map(|a| a * RISTRETTO_BASEPOINT_TABLE)
.collect::<Vec<_>>();
(x, y)
};
Expand Down
2 changes: 1 addition & 1 deletion protocol/src/dspmc/partner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl PartnerDspmcProtocol for PartnerDspmc {
// PRG seed = scalar * PK_helper
let (seed, ct3) = {
let x = gen_scalar();
let ct3 = self.ec_cipher.to_bytes(&[&x * &RISTRETTO_BASEPOINT_TABLE]);
let ct3 = self.ec_cipher.to_bytes(&[&x * RISTRETTO_BASEPOINT_TABLE]);
let seed: [u8; 32] = {
let t = self.ec_cipher.to_bytes(&[x * (*helper_pk)]);
t[0].buffer.as_slice().try_into().expect("incorrect length")
Expand Down
2 changes: 1 addition & 1 deletion protocol/src/dspmc/shuffler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ impl ShufflerDspmcProtocol for ShufflerDspmc {
let g_zi = {
let t = z_i
.iter()
.map(|x| x * &RISTRETTO_BASEPOINT_TABLE)
.map(|x| x * RISTRETTO_BASEPOINT_TABLE)
.collect::<Vec<_>>();
self.ec_cipher.to_bytes(&t)
};
Expand Down
2 changes: 1 addition & 1 deletion protocol/src/private_id_multi_key/company.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ mod tests {
0xde, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10,
];
Scalar::from_bits(l_plus_two_bytes)
Scalar::from_bytes_mod_order(l_plus_two_bytes)
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion protocol/src/private_id_multi_key/partner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ mod tests {
0xde, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10,
];
Scalar::from_bits(l_plus_two_bytes)
Scalar::from_bytes_mod_order(l_plus_two_bytes)
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions protocol/src/suid_create/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fn serialize_helper<T>(data: Vec<Vec<T>>) -> (Vec<T>, TPayload, TPayload) {

fn gen_elgamal_keypair() -> (Scalar, TPoint) {
let private_key = gen_scalar();
let public_key = &private_key * &RISTRETTO_BASEPOINT_TABLE;
let public_key = &private_key * RISTRETTO_BASEPOINT_TABLE;

(private_key, public_key)
}
Expand Down Expand Up @@ -173,7 +173,7 @@ fn elgamal_encrypt(data: Vec<TPoint>, public_key: &TPoint) -> (Vec<TPoint>, Vec<

let c1 = r
.iter()
.map(|x| x * &RISTRETTO_BASEPOINT_TABLE)
.map(|x| x * RISTRETTO_BASEPOINT_TABLE)
.collect::<Vec<_>>();

let c2 = data
Expand Down

0 comments on commit 932915c

Please sign in to comment.