From 1c211828014ccd985f821bb2b4e3a9300e50e866 Mon Sep 17 00:00:00 2001 From: Thom Wiggers Date: Mon, 11 Nov 2024 14:55:32 +0900 Subject: [PATCH] Make serde work in no-std --- pqcrypto-classicmceliece/Cargo.toml | 4 ++-- pqcrypto-falcon/Cargo.toml | 4 ++-- pqcrypto-falcon/src/falcon1024.rs | 2 +- pqcrypto-falcon/src/falcon512.rs | 2 +- pqcrypto-falcon/src/falconpadded1024.rs | 2 +- pqcrypto-falcon/src/falconpadded512.rs | 2 +- pqcrypto-hqc/Cargo.toml | 4 ++-- pqcrypto-mldsa/Cargo.toml | 4 ++-- pqcrypto-mldsa/src/mldsa44.rs | 2 +- pqcrypto-mldsa/src/mldsa65.rs | 2 +- pqcrypto-mldsa/src/mldsa87.rs | 2 +- pqcrypto-mlkem/Cargo.toml | 4 ++-- pqcrypto-sphincsplus/Cargo.toml | 4 ++-- pqcrypto-sphincsplus/src/sphincssha2128fsimple.rs | 2 +- pqcrypto-sphincsplus/src/sphincssha2128ssimple.rs | 2 +- pqcrypto-sphincsplus/src/sphincssha2192fsimple.rs | 2 +- pqcrypto-sphincsplus/src/sphincssha2192ssimple.rs | 2 +- pqcrypto-sphincsplus/src/sphincssha2256fsimple.rs | 2 +- pqcrypto-sphincsplus/src/sphincssha2256ssimple.rs | 2 +- pqcrypto-sphincsplus/src/sphincsshake128fsimple.rs | 2 +- pqcrypto-sphincsplus/src/sphincsshake128ssimple.rs | 2 +- pqcrypto-sphincsplus/src/sphincsshake192fsimple.rs | 2 +- pqcrypto-sphincsplus/src/sphincsshake192ssimple.rs | 2 +- pqcrypto-sphincsplus/src/sphincsshake256fsimple.rs | 2 +- pqcrypto-sphincsplus/src/sphincsshake256ssimple.rs | 2 +- pqcrypto-template/scheme/Cargo.toml.j2 | 4 ++-- pqcrypto-template/scheme/src/scheme.rs.j2 | 2 +- 27 files changed, 34 insertions(+), 34 deletions(-) diff --git a/pqcrypto-classicmceliece/Cargo.toml b/pqcrypto-classicmceliece/Cargo.toml index bd4da7c..016ed9d 100644 --- a/pqcrypto-classicmceliece/Cargo.toml +++ b/pqcrypto-classicmceliece/Cargo.toml @@ -15,14 +15,14 @@ categories = ["cryptography", "no-std"] pqcrypto-internals = { path = "../pqcrypto-internals", version = "0.2.6" } pqcrypto-traits = { path = "../pqcrypto-traits", version = "0.3.5", default-features = false } libc = "0.2.0" -serde = { version = "1.0", features = ["derive"], optional = true } +serde = { version = "1.0", default-features = false, features = ["alloc", "derive"], optional = true } serde-big-array = { version = "0.5.1", optional = true } [features] default = ["avx2", "std"] avx2 = ["std"] std = ["pqcrypto-traits/std"] -serialization = ["serde", "serde-big-array"] +serialization = ["dep:serde", "dep:serde-big-array"] [dev-dependencies] diff --git a/pqcrypto-falcon/Cargo.toml b/pqcrypto-falcon/Cargo.toml index dc02417..fd35337 100644 --- a/pqcrypto-falcon/Cargo.toml +++ b/pqcrypto-falcon/Cargo.toml @@ -15,7 +15,7 @@ categories = ["cryptography", "no-std"] pqcrypto-internals = { path = "../pqcrypto-internals", version = "0.2.6" } pqcrypto-traits = { path = "../pqcrypto-traits", version = "0.3.5", default-features = false } libc = "0.2.0" -serde = { version = "1.0", features = ["derive"], optional = true } +serde = { version = "1.0", default-features = false, features = ["alloc", "derive"], optional = true } serde-big-array = { version = "0.5.1", optional = true } [features] @@ -23,7 +23,7 @@ default = ["avx2", "neon", "std"] avx2 = ["std"] neon = ["std"] std = ["pqcrypto-traits/std"] -serialization = ["serde", "serde-big-array"] +serialization = ["dep:serde", "dep:serde-big-array"] [dev-dependencies] rand = "0.8.5" diff --git a/pqcrypto-falcon/src/falcon1024.rs b/pqcrypto-falcon/src/falcon1024.rs index 5f40fd2..250159f 100644 --- a/pqcrypto-falcon/src/falcon1024.rs +++ b/pqcrypto-falcon/src/falcon1024.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_FALCON1024_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-falcon/src/falcon512.rs b/pqcrypto-falcon/src/falcon512.rs index e46c66f..34db62e 100644 --- a/pqcrypto-falcon/src/falcon512.rs +++ b/pqcrypto-falcon/src/falcon512.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_FALCON512_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-falcon/src/falconpadded1024.rs b/pqcrypto-falcon/src/falconpadded1024.rs index 46fddcd..5ca2027 100644 --- a/pqcrypto-falcon/src/falconpadded1024.rs +++ b/pqcrypto-falcon/src/falconpadded1024.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_FALCONPADDED1024_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-falcon/src/falconpadded512.rs b/pqcrypto-falcon/src/falconpadded512.rs index 0a1d3e9..f9e2a67 100644 --- a/pqcrypto-falcon/src/falconpadded512.rs +++ b/pqcrypto-falcon/src/falconpadded512.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_FALCONPADDED512_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-hqc/Cargo.toml b/pqcrypto-hqc/Cargo.toml index bb7679b..022e72d 100644 --- a/pqcrypto-hqc/Cargo.toml +++ b/pqcrypto-hqc/Cargo.toml @@ -15,13 +15,13 @@ categories = ["cryptography", "no-std"] pqcrypto-internals = { path = "../pqcrypto-internals", version = "0.2.6" } pqcrypto-traits = { path = "../pqcrypto-traits", version = "0.3.5", default-features = false } libc = "0.2.0" -serde = { version = "1.0", features = ["derive"], optional = true } +serde = { version = "1.0", default-features = false, features = ["alloc", "derive"], optional = true } serde-big-array = { version = "0.5.1", optional = true } [features] default = ["std"] std = ["pqcrypto-traits/std"] -serialization = ["serde", "serde-big-array"] +serialization = ["dep:serde", "dep:serde-big-array"] [dev-dependencies] diff --git a/pqcrypto-mldsa/Cargo.toml b/pqcrypto-mldsa/Cargo.toml index 888a015..2d7005d 100644 --- a/pqcrypto-mldsa/Cargo.toml +++ b/pqcrypto-mldsa/Cargo.toml @@ -15,7 +15,7 @@ categories = ["cryptography", "no-std"] pqcrypto-internals = { path = "../pqcrypto-internals", version = "0.2.6" } pqcrypto-traits = { path = "../pqcrypto-traits", version = "0.3.5", default-features = false } libc = "0.2.0" -serde = { version = "1.0", features = ["derive"], optional = true } +serde = { version = "1.0", default-features = false, features = ["alloc", "derive"], optional = true } serde-big-array = { version = "0.5.1", optional = true } paste = "1.0" @@ -24,7 +24,7 @@ default = ["avx2", "neon", "std"] avx2 = ["std"] neon = ["std"] std = ["pqcrypto-traits/std"] -serialization = ["serde", "serde-big-array"] +serialization = ["dep:serde", "dep:serde-big-array"] [dev-dependencies] rand = "0.8.5" diff --git a/pqcrypto-mldsa/src/mldsa44.rs b/pqcrypto-mldsa/src/mldsa44.rs index 5006296..b64ce7a 100644 --- a/pqcrypto-mldsa/src/mldsa44.rs +++ b/pqcrypto-mldsa/src/mldsa44.rs @@ -90,7 +90,7 @@ simple_struct!(PublicKey, ffi::PQCLEAN_MLDSA44_CLEAN_CRYPTO_PUBLICKEYBYTES); simple_struct!(SecretKey, ffi::PQCLEAN_MLDSA44_CLEAN_CRYPTO_SECRETKEYBYTES); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_MLDSA44_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-mldsa/src/mldsa65.rs b/pqcrypto-mldsa/src/mldsa65.rs index 826733b..0ca0dfa 100644 --- a/pqcrypto-mldsa/src/mldsa65.rs +++ b/pqcrypto-mldsa/src/mldsa65.rs @@ -90,7 +90,7 @@ simple_struct!(PublicKey, ffi::PQCLEAN_MLDSA65_CLEAN_CRYPTO_PUBLICKEYBYTES); simple_struct!(SecretKey, ffi::PQCLEAN_MLDSA65_CLEAN_CRYPTO_SECRETKEYBYTES); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_MLDSA65_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-mldsa/src/mldsa87.rs b/pqcrypto-mldsa/src/mldsa87.rs index 2fa1702..a3cdf82 100644 --- a/pqcrypto-mldsa/src/mldsa87.rs +++ b/pqcrypto-mldsa/src/mldsa87.rs @@ -90,7 +90,7 @@ simple_struct!(PublicKey, ffi::PQCLEAN_MLDSA87_CLEAN_CRYPTO_PUBLICKEYBYTES); simple_struct!(SecretKey, ffi::PQCLEAN_MLDSA87_CLEAN_CRYPTO_SECRETKEYBYTES); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_MLDSA87_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-mlkem/Cargo.toml b/pqcrypto-mlkem/Cargo.toml index d2396c0..d1af74f 100644 --- a/pqcrypto-mlkem/Cargo.toml +++ b/pqcrypto-mlkem/Cargo.toml @@ -15,7 +15,7 @@ categories = ["cryptography", "no-std"] pqcrypto-internals = { path = "../pqcrypto-internals", version = "0.2.6" } pqcrypto-traits = { path = "../pqcrypto-traits", version = "0.3.5", default-features = false } libc = "0.2.0" -serde = { version = "1.0", features = ["derive"], optional = true } +serde = { version = "1.0", default-features = false, features = ["alloc", "derive"], optional = true } serde-big-array = { version = "0.5.1", optional = true } [features] @@ -23,7 +23,7 @@ default = ["avx2", "neon", "std"] avx2 = ["std"] neon = ["std"] std = ["pqcrypto-traits/std"] -serialization = ["serde", "serde-big-array"] +serialization = ["dep:serde", "dep:serde-big-array"] [dev-dependencies] diff --git a/pqcrypto-sphincsplus/Cargo.toml b/pqcrypto-sphincsplus/Cargo.toml index 70ef2ed..3539b1e 100644 --- a/pqcrypto-sphincsplus/Cargo.toml +++ b/pqcrypto-sphincsplus/Cargo.toml @@ -15,14 +15,14 @@ categories = ["cryptography", "no-std"] pqcrypto-internals = { path = "../pqcrypto-internals", version = "0.2.6" } pqcrypto-traits = { path = "../pqcrypto-traits", version = "0.3.5", default-features = false } libc = "0.2.0" -serde = { version = "1.0", features = ["derive"], optional = true } +serde = { version = "1.0", default-features = false, features = ["alloc", "derive"], optional = true } serde-big-array = { version = "0.5.1", optional = true } [features] default = ["avx2", "std"] avx2 = ["std"] std = ["pqcrypto-traits/std"] -serialization = ["serde", "serde-big-array"] +serialization = ["dep:serde", "dep:serde-big-array"] [dev-dependencies] rand = "0.8.5" diff --git a/pqcrypto-sphincsplus/src/sphincssha2128fsimple.rs b/pqcrypto-sphincsplus/src/sphincssha2128fsimple.rs index 43b5d97..cc97bc1 100644 --- a/pqcrypto-sphincsplus/src/sphincssha2128fsimple.rs +++ b/pqcrypto-sphincsplus/src/sphincssha2128fsimple.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_SPHINCSSHA2128FSIMPLE_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-sphincsplus/src/sphincssha2128ssimple.rs b/pqcrypto-sphincsplus/src/sphincssha2128ssimple.rs index b8dd9c7..bb3e637 100644 --- a/pqcrypto-sphincsplus/src/sphincssha2128ssimple.rs +++ b/pqcrypto-sphincsplus/src/sphincssha2128ssimple.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_SPHINCSSHA2128SSIMPLE_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-sphincsplus/src/sphincssha2192fsimple.rs b/pqcrypto-sphincsplus/src/sphincssha2192fsimple.rs index 70a04e3..e8671be 100644 --- a/pqcrypto-sphincsplus/src/sphincssha2192fsimple.rs +++ b/pqcrypto-sphincsplus/src/sphincssha2192fsimple.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_SPHINCSSHA2192FSIMPLE_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-sphincsplus/src/sphincssha2192ssimple.rs b/pqcrypto-sphincsplus/src/sphincssha2192ssimple.rs index f23d110..56b73eb 100644 --- a/pqcrypto-sphincsplus/src/sphincssha2192ssimple.rs +++ b/pqcrypto-sphincsplus/src/sphincssha2192ssimple.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_SPHINCSSHA2192SSIMPLE_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-sphincsplus/src/sphincssha2256fsimple.rs b/pqcrypto-sphincsplus/src/sphincssha2256fsimple.rs index c62e93a..e28b391 100644 --- a/pqcrypto-sphincsplus/src/sphincssha2256fsimple.rs +++ b/pqcrypto-sphincsplus/src/sphincssha2256fsimple.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_SPHINCSSHA2256FSIMPLE_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-sphincsplus/src/sphincssha2256ssimple.rs b/pqcrypto-sphincsplus/src/sphincssha2256ssimple.rs index a325c7c..09ccb6a 100644 --- a/pqcrypto-sphincsplus/src/sphincssha2256ssimple.rs +++ b/pqcrypto-sphincsplus/src/sphincssha2256ssimple.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_SPHINCSSHA2256SSIMPLE_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-sphincsplus/src/sphincsshake128fsimple.rs b/pqcrypto-sphincsplus/src/sphincsshake128fsimple.rs index c76bf71..d81059d 100644 --- a/pqcrypto-sphincsplus/src/sphincsshake128fsimple.rs +++ b/pqcrypto-sphincsplus/src/sphincsshake128fsimple.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_SPHINCSSHAKE128FSIMPLE_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-sphincsplus/src/sphincsshake128ssimple.rs b/pqcrypto-sphincsplus/src/sphincsshake128ssimple.rs index e40af48..a21c250 100644 --- a/pqcrypto-sphincsplus/src/sphincsshake128ssimple.rs +++ b/pqcrypto-sphincsplus/src/sphincsshake128ssimple.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_SPHINCSSHAKE128SSIMPLE_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-sphincsplus/src/sphincsshake192fsimple.rs b/pqcrypto-sphincsplus/src/sphincsshake192fsimple.rs index db1d08d..b244858 100644 --- a/pqcrypto-sphincsplus/src/sphincsshake192fsimple.rs +++ b/pqcrypto-sphincsplus/src/sphincsshake192fsimple.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_SPHINCSSHAKE192FSIMPLE_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-sphincsplus/src/sphincsshake192ssimple.rs b/pqcrypto-sphincsplus/src/sphincsshake192ssimple.rs index 9a28792..36238e9 100644 --- a/pqcrypto-sphincsplus/src/sphincsshake192ssimple.rs +++ b/pqcrypto-sphincsplus/src/sphincsshake192ssimple.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_SPHINCSSHAKE192SSIMPLE_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-sphincsplus/src/sphincsshake256fsimple.rs b/pqcrypto-sphincsplus/src/sphincsshake256fsimple.rs index 2b65f1d..d8ab97d 100644 --- a/pqcrypto-sphincsplus/src/sphincsshake256fsimple.rs +++ b/pqcrypto-sphincsplus/src/sphincsshake256fsimple.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_SPHINCSSHAKE256FSIMPLE_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-sphincsplus/src/sphincsshake256ssimple.rs b/pqcrypto-sphincsplus/src/sphincsshake256ssimple.rs index 50d6646..306f0f4 100644 --- a/pqcrypto-sphincsplus/src/sphincsshake256ssimple.rs +++ b/pqcrypto-sphincsplus/src/sphincsshake256ssimple.rs @@ -94,7 +94,7 @@ simple_struct!( ); #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_SPHINCSSHAKE256SSIMPLE_CLEAN_CRYPTO_BYTES], diff --git a/pqcrypto-template/scheme/Cargo.toml.j2 b/pqcrypto-template/scheme/Cargo.toml.j2 index 7b9e3cf..35e98e2 100644 --- a/pqcrypto-template/scheme/Cargo.toml.j2 +++ b/pqcrypto-template/scheme/Cargo.toml.j2 @@ -15,7 +15,7 @@ categories = ["cryptography", "no-std"] pqcrypto-internals = { path = "../pqcrypto-internals", version = "0.2.6" } pqcrypto-traits = { path = "../pqcrypto-traits", version = "{{ traits_version }}", default-features = false } libc = "0.2.0" -serde = { version = "1.0", features = ["derive"], optional = true } +serde = { version = "1.0", default-features = false, features = ["alloc", "derive"], optional = true } serde-big-array = { version = "0.5.1", optional = true } {% if supports_context %} paste = "1.0" @@ -33,7 +33,7 @@ aes = ["std"] neon = ["std"] {% endif %} std = ["pqcrypto-traits/std"] -serialization = ["serde", "serde-big-array"] +serialization = ["dep:serde", "dep:serde-big-array"] {% if insecure %} cryptographically-insecure = [] {% endif %} diff --git a/pqcrypto-template/scheme/src/scheme.rs.j2 b/pqcrypto-template/scheme/src/scheme.rs.j2 index 4371522..ae8d472 100644 --- a/pqcrypto-template/scheme/src/scheme.rs.j2 +++ b/pqcrypto-template/scheme/src/scheme.rs.j2 @@ -139,7 +139,7 @@ simple_struct!(SharedSecret, ffi::PQCLEAN_{{ NS_NAME }}_CRYPTO_BYTES); {% else %} #[derive(Clone, Copy)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serialization", derive(Serialize, Deserialize))] pub struct DetachedSignature( #[cfg_attr(feature = "serialization", serde(with = "BigArray"))] [u8; ffi::PQCLEAN_{{ NS_NAME }}_CRYPTO_BYTES],