From 0c45021b2981fe8ddfbc30076e90cc75349bd4eb Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Wed, 17 Jul 2024 17:21:38 -0400 Subject: [PATCH 1/3] Implement `serde` for `Test` and `Production` params --- synedrion/src/cggmp21/params.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/synedrion/src/cggmp21/params.rs b/synedrion/src/cggmp21/params.rs index 67f09907..7f7c1709 100644 --- a/synedrion/src/cggmp21/params.rs +++ b/synedrion/src/cggmp21/params.rs @@ -8,6 +8,8 @@ use crate::uint::{ U2048Mod, U4096Mod, U512Mod, Zero, U1024, U2048, U4096, U512, U8192, }; +use serde::{Serialize, Deserialize}; + #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub struct PaillierTest; @@ -167,7 +169,7 @@ impl HashableType for P { /// Scheme parameters **for testing purposes only**. /// Security is weakened to allow for faster execution. -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct TestParams; // Some requirements from range proofs etc: @@ -191,7 +193,7 @@ impl SchemeParams for TestParams { } /// Production strength parameters. -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct ProductionParams; impl SchemeParams for ProductionParams { From b7d8af48bc0679025477c4d9d0df60f8cb230de3 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Wed, 17 Jul 2024 17:23:41 -0400 Subject: [PATCH 2/3] Add it to `Paillier` params too --- synedrion/src/cggmp21/params.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/synedrion/src/cggmp21/params.rs b/synedrion/src/cggmp21/params.rs index 7f7c1709..3b4847a0 100644 --- a/synedrion/src/cggmp21/params.rs +++ b/synedrion/src/cggmp21/params.rs @@ -10,7 +10,7 @@ use crate::uint::{ use serde::{Serialize, Deserialize}; -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct PaillierTest; impl PaillierParams for PaillierTest { @@ -65,7 +65,7 @@ impl PaillierParams for PaillierTest { type ExtraWideUint = U4096; } -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct PaillierProduction; impl PaillierParams for PaillierProduction { From 09caea3e8ae85d75716b7ba1ce14a7c3b7f7b8db Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Wed, 17 Jul 2024 17:28:29 -0400 Subject: [PATCH 3/3] RustFmt --- synedrion/src/cggmp21/params.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synedrion/src/cggmp21/params.rs b/synedrion/src/cggmp21/params.rs index 3b4847a0..25741402 100644 --- a/synedrion/src/cggmp21/params.rs +++ b/synedrion/src/cggmp21/params.rs @@ -8,7 +8,7 @@ use crate::uint::{ U2048Mod, U4096Mod, U512Mod, Zero, U1024, U2048, U4096, U512, U8192, }; -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; #[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct PaillierTest;