Skip to content

Commit 4c23fa2

Browse files
committed
Relax bounds on KV range proofs, simplify CLS range proof
Signed-off-by: lovesh <lovesh.bond@gmail.com>
1 parent 1702486 commit 4c23fa2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1385
-1166
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ blake2 = { version = "0.10", default-features = false }
4848
ark-bls12-381 = { version = "^0.4.0", default-features = false, features = [ "curve" ] }
4949
ark-secp256r1 = { version = "^0.4.0", default-features = false }
5050
itertools = "0.12.1"
51+
sha3 = { version = "0.10.6", default-features = false }
5152

5253
[profile.release]
5354
lto = true

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ For WASM, build as `cargo build --no-default-features --features=wasmer-js --tar
5555
The above maybe slower as it runs the tests in debug mode and some tests work on large inputs.
5656
For running tests faster, run `cargo test --release`
5757

58+
Some tess might cause a stack overflow error. To fix that, increase the stack size to about 8MB as
59+
60+
`RUST_MIN_STACK=8388608 cargo test` or `RUST_MIN_STACK=8388608 cargo test --release`
5861

5962
## Benchmarking
6063

bbs_plus/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ ark-std.workspace = true
1919
digest.workspace = true
2020
rayon = {workspace = true, optional = true}
2121
itertools.workspace = true
22-
sha3 = { version = "0.10.6", default-features = false }
2322
serde.workspace = true
2423
serde_with.workspace = true
2524
zeroize.workspace = true
@@ -33,7 +32,6 @@ blake2.workspace = true
3332
ark-bls12-381.workspace = true
3433
serde_json = "1.0"
3534
rmp-serde = "1.0"
36-
ark-poly.workspace = true
3735
test_utils = { path = "../test_utils" }
3836

3937
[features]

bbs_plus/src/threshold/threshold_bbs.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ pub struct Phase1Output<F: PrimeField> {
3636
}
3737

3838
/// A share of the BBS signature created by one signer. A client will aggregate many such shares to
39-
/// create the final signature.
39+
/// create the final signature. Note that this is done by the signer where it uses outputs of
40+
/// phase 1 and 2 and these outputs should not be sent to the user. Only this share needs to be sent.
4041
#[derive(Clone, Debug, PartialEq, CanonicalSerialize, CanonicalDeserialize)]
4142
pub struct BBSSignatureShare<E: Pairing> {
4243
pub id: ParticipantId,

bbs_plus/src/threshold/threshold_bbs_plus.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ pub struct Phase1Output<F: PrimeField> {
3636
}
3737

3838
/// A share of the BBS+ signature created by one signer. A client will aggregate many such shares to
39-
/// create the final signature.
39+
/// create the final signature. Note that this is done by the signer where it uses outputs of
40+
/// phase 1 and 2 and these outputs should not be sent to the user. Only this share needs to be sent.
4041
#[derive(Clone, Debug, PartialEq, CanonicalSerialize, CanonicalDeserialize)]
4142
pub struct BBSPlusSignatureShare<E: Pairing> {
4243
pub id: ParticipantId,

compressed_sigma/src/utils.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
#![allow(unused)]
2+
3+
use crate::transforms::{Homomorphism, LinearForm};
14
use ark_ec::{AffineRepr, CurveGroup};
25
use ark_ff::PrimeField;
36
use ark_std::{vec, vec::Vec};
47
use dock_crypto_utils::msm::multiply_field_elems_with_same_group_elem;
58

6-
use crate::transforms::{Homomorphism, LinearForm};
7-
89
/// Pad given homomorphisms such that all have the same size after padding
910
pub fn pad_homomorphisms_to_have_same_size<
1011
G: AffineRepr,

kvac/src/bbs_sharp/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# BBS# (called BBS sharp)
2+
13
BBS# as described [here](https://github.com/user-attachments/files/15905230/BBS_Sharp_Short_TR.pdf)
24

35
This assumes that the messages/attributes have already been prepared before signing, i.e. attributes are hashed

kvac/src/bbs_sharp/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! # BBS# (called BBS sharp)
2+
//!
13
//! BBS# as described [here](https://github.com/user-attachments/files/15905230/BBS_Sharp_Short_TR.pdf)
24
//!
35
//! This assumes that the messages/attributes have already been prepared before signing, i.e. attributes are hashed

kvac/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//! are not shared with the issuer. This lets us build for a use-case where issuer wants to allow anytime its issued credential is used
1313
//! (eg. to get paid by the verifier) while still not harming the user's privacy as it doesn't learn any revealed attributes. The first
1414
//! verifier, i.e. the issuer can also provide a proof of validity or invalidity to the second verifier.
15+
//!
16+
//! Implements BBS# (called BBS sharp) [here](./src/bbs_sharp)
1517
1618
pub mod bbdt_2016;
1719
pub mod bbs_sharp;

legogroth16/Cargo.toml

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ark-r1cs-std = { workspace = true, optional = true }
2323
tracing = { version = "0.1", default-features = false, features = [ "attributes" ], optional = true }
2424
derivative = { version = "2.0", features = ["use_core"], optional = true }
2525
rayon = { workspace = true, optional = true }
26-
wasmer = { version = "5.0.0", optional = true, default-features = false }
26+
wasmer = { version = "5.0.2", optional = true, default-features = false }
2727
fnv = { version = "1.0.3", default-features = false, optional = true }
2828
num-bigint = { version = "0.4", default-features = false, optional = true }
2929
log = "0.4"
@@ -32,9 +32,8 @@ ark-snark = { version = "^0.4.0", default-features = false, optional = true }
3232
dock_crypto_utils = { version = "0.20.0", default-features = false, path = "../utils" }
3333

3434
[dev-dependencies]
35-
csv = { version = "1" }
3635
ark-bn254 = { version = "^0.4.0", default-features = false, features = ["curve"] }
37-
ark-bls12-381 = { version = "^0.4.0", default-features = false, features = ["curve"] }
36+
ark-bls12-381.workspace = true
3837
ark-bls12-377 = { version = "^0.4.0", default-features = false, features = ["curve"] }
3938
ark-cp6-782 = { version = "^0.4.0", default-features = false }
4039
ark-mnt4-298 = { version = "^0.4.0", default-features = false, features = ["r1cs", "curve"] }

oblivious_transfer/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ serde_with.workspace = true
1919
zeroize.workspace = true
2020
cipher = { version = "0.4.4", default-features = false, features = ["alloc"] }
2121
rayon = {workspace = true, optional = true}
22-
sha3 = { version = "0.10.6", default-features = false }
22+
sha3.workspace = true
2323
aes = { version = "0.8.2", default-features = false }
2424
itertools.workspace = true
2525
byteorder = { version = "1.4", default-features = false }
@@ -38,5 +38,5 @@ cc = "1.0.77"
3838

3939
[features]
4040
default = [ "parallel"]
41-
std = [ "ark-ff/std", "ark-ec/std", "ark-std/std", "ark-serialize/std", "serde/std"]
42-
parallel = [ "std", "ark-ff/parallel", "ark-ec/parallel", "ark-std/parallel", "rayon"]
41+
std = [ "ark-ff/std", "ark-ec/std", "ark-std/std", "ark-serialize/std", "serde/std", "dock_crypto_utils/std", "schnorr_pok/std"]
42+
parallel = [ "std", "ark-ff/parallel", "ark-ec/parallel", "ark-std/parallel", "rayon", "dock_crypto_utils/parallel", "schnorr_pok/parallel"]

proof_system/Cargo.toml

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ ark-r1cs-std.workspace = true
2525
ark-relations.workspace = true
2626
zeroize.workspace = true
2727
itertools.workspace = true
28-
aead = {version = "0.5.2", default-features = false, features = [ "alloc" ]}
2928
chacha20poly1305 = {version = "0.10.1", default-features = false}
29+
sha3.workspace = true
3030
bbs_plus = { version = "0.22.0", default-features = false, path = "../bbs_plus" }
3131
schnorr_pok = { version = "0.20.0", default-features = false, path = "../schnorr_pok" }
3232
vb_accumulator = { version = "0.26.0", default-features = false, path = "../vb_accumulator" }
@@ -40,7 +40,6 @@ smc_range_proof = { version = "0.6.0", default-features = false, path = "../smc_
4040
short_group_sig = { version = "0.4.0", default-features = false, path = "../short_group_sig" }
4141
kvac = { version = "0.5.0", default-features = false, path = "../kvac" }
4242
verifiable_encryption = { version = "0.1.0", default-features = false, path = "../verifiable_encryption" }
43-
sha3 = { version = "0.10.6", default-features = false }
4443

4544
[dev-dependencies]
4645
ark-bls12-381.workspace = true
@@ -51,7 +50,7 @@ test_utils = { default-features = false, path = "../test_utils" }
5150

5251
[features]
5352
default = ["parallel"]
54-
std = ["ark-ff/std", "ark-ec/std", "ark-std/std", "ark-serialize/std", "schnorr_pok/std", "dock_crypto_utils/std", "serde/std", "saver/std", "ark-groth16/std", "legogroth16/std", "ark-r1cs-std/std", "ark-relations/std", "merlin/std", "coconut-crypto/std", "bulletproofs_plus_plus/std", "smc_range_proof/std", "short_group_sig/std", "kvac/std", "verifiable_encryption/std"]
53+
std = ["ark-ff/std", "ark-ec/std", "ark-std/std", "ark-serialize/std", "schnorr_pok/std", "dock_crypto_utils/std", "serde/std", "saver/std", "ark-groth16/std", "legogroth16/std", "ark-r1cs-std/std", "ark-relations/std", "merlin/std", "bbs_plus/std", "vb_accumulator/std", "coconut-crypto/std", "bulletproofs_plus_plus/std", "smc_range_proof/std", "short_group_sig/std", "kvac/std", "verifiable_encryption/std"]
5554
print-trace = ["ark-std/print-trace", "schnorr_pok/print-trace", "bbs_plus/print-trace", "vb_accumulator/print-trace", "dock_crypto_utils/print-trace"]
5655
parallel = ["std", "ark-ff/parallel", "ark-ec/parallel", "ark-std/parallel", "rayon", "schnorr_pok/parallel", "bbs_plus/parallel", "vb_accumulator/parallel", "saver/parallel", "ark-groth16/parallel", "legogroth16/parallel", "ark-r1cs-std/parallel", "dock_crypto_utils/parallel", "coconut-crypto/parallel", "bulletproofs_plus_plus/parallel", "smc_range_proof/parallel", "short_group_sig/parallel", "kvac/parallel", "verifiable_encryption/parallel"]
5756
wasmer-js = ["legogroth16/wasmer-js"]

proof_system/src/proof_spec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use saver::prelude::{
3535
use serde::{Deserialize, Serialize};
3636
use smc_range_proof::prelude::MemberCommitmentKey;
3737

38-
use crate::prelude::bound_check_smc::{
38+
use crate::statement::bound_check_smc::{
3939
SmcParamsAndCommitmentKey, SmcParamsWithPairingAndCommitmentKey,
4040
};
4141
use vb_accumulator::{

proof_system/src/setup_params.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
88
use crate::{
99
prelude::bound_check_smc::SmcParamsAndCommitmentKey,
10-
statement::bound_check_smc_with_kv::SmcParamsAndCommitmentKeyAndSecretKey,
10+
statement::bound_check_smc_with_kv::{
11+
SmcParamsKVAndCommitmentKey, SmcParamsKVAndCommitmentKeyAndSecretKey,
12+
},
1113
};
1214
use ark_ec::{pairing::Pairing, AffineRepr};
1315
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
@@ -66,7 +68,7 @@ pub enum SetupParams<E: Pairing> {
6668
BppSetupParams(#[serde_as(as = "ArkObjectBytes")] BppSetupParams<E::G1Affine>),
6769
SmcParamsAndCommKey(#[serde_as(as = "ArkObjectBytes")] SmcParamsAndCommitmentKey<E>),
6870
SmcParamsAndCommKeyAndSk(
69-
#[serde_as(as = "ArkObjectBytes")] SmcParamsAndCommitmentKeyAndSecretKey<E>,
71+
#[serde_as(as = "ArkObjectBytes")] SmcParamsKVAndCommitmentKeyAndSecretKey<E::G1Affine>,
7072
),
7173
CommitmentKey(#[serde_as(as = "ArkObjectBytes")] PedersenCommitmentKey<E::G1Affine>),
7274
BBSigProvingKey(ProvingKey<E::G1Affine>),
@@ -75,6 +77,9 @@ pub enum SetupParams<E: Pairing> {
7577
BBDT16MACParams(MACParams<E::G1Affine>),
7678
PedersenCommitmentKeyG2(#[serde_as(as = "Vec<ArkObjectBytes>")] Vec<E::G2Affine>),
7779
CommitmentKeyG2(#[serde_as(as = "ArkObjectBytes")] PedersenCommitmentKey<E::G2Affine>),
80+
SmcParamsKVAndCommKey(
81+
#[serde_as(as = "ArkObjectBytes")] SmcParamsKVAndCommitmentKey<E::G1Affine>,
82+
),
7883
ElgamalEncryption(ElgamalEncryptionParams<E::G1Affine>),
7984
}
8085

@@ -112,6 +117,7 @@ macro_rules! delegate {
112117
BBDT16MACParams,
113118
PedersenCommitmentKeyG2,
114119
CommitmentKeyG2,
120+
SmcParamsKVAndCommKey,
115121
ElgamalEncryption
116122
: $($tt)+
117123
}
@@ -152,6 +158,7 @@ macro_rules! delegate_reverse {
152158
BBDT16MACParams,
153159
PedersenCommitmentKeyG2,
154160
CommitmentKeyG2,
161+
SmcParamsKVAndCommKey,
155162
ElgamalEncryption
156163
: $($tt)+
157164
}

proof_system/src/statement/bound_check_smc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use smc_range_proof::prelude::{
1212
use crate::setup_params::SetupParams;
1313
use dock_crypto_utils::serde_utils::ArkObjectBytes;
1414

15-
/// For ease of use, keeping setup params together but they could be generated independently
15+
/// For ease of use, keeping setup params together, but they could be generated independently
1616
#[serde_as]
1717
#[derive(
1818
Clone, Debug, PartialEq, CanonicalSerialize, CanonicalDeserialize, Serialize, Deserialize,

0 commit comments

Comments
 (0)