Skip to content

Commit ea05906

Browse files
committed
Implement Debug
1 parent 1e45876 commit ea05906

Some content is hidden

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

47 files changed

+640
-244
lines changed

implementations.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ traits_version: 0.3.5
55

66
kems:
77
mlkem:
8-
version: 0.1.0
8+
version: 0.1.1
99
x86_avx2_guard: 'target_arch == "x86_64" && avx2_enabled && !is_windows && !is_macos'
1010
implementations: [clean, avx2, aarch64]
1111
schemes:
@@ -16,7 +16,7 @@ kems:
1616
- name: ml-kem-1024
1717
implementations: [clean, avx2, aarch64]
1818
classicmceliece:
19-
version: 0.2.0
19+
version: 0.2.1
2020
notes: |
2121
This implementation requires a lot of stack space.
2222
You need to specify ``RUST_MIN_STACK=800000000``, probably.
@@ -50,7 +50,7 @@ kems:
5050
implementations: [clean, avx2]
5151
doctest: no
5252
hqc:
53-
version: 0.2.1
53+
version: 0.2.2
5454
implementations: [clean]
5555
schemes:
5656
- name: hqc-128
@@ -63,7 +63,7 @@ kems:
6363

6464
signs:
6565
mldsa:
66-
version: 0.1.1
66+
version: 0.1.2
6767
x86_avx2_guard: 'target_arch == "x86_64" && avx2_enabled && !is_windows'
6868
implementations: [clean, avx2, aarch64]
6969
supports_context: true
@@ -75,7 +75,7 @@ signs:
7575
- name: ml-dsa-87
7676
implementations: [clean, avx2, aarch64]
7777
falcon:
78-
version: 0.4.0
78+
version: 0.4.1
7979
implementations: [clean, avx2, aarch64]
8080
schemes:
8181
- name: falcon-512
@@ -87,7 +87,7 @@ signs:
8787
- name: falcon-padded-1024
8888
implementations: [clean, avx2, aarch64]
8989
sphincsplus:
90-
version: 0.7.1
90+
version: 0.7.2
9191
implementations: [clean, avx2]
9292
schemes:
9393
- name: sphincs-shake-128f-simple

pqcrypto-classicmceliece/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "pqcrypto-classicmceliece"
33
description = "Post-Quantum Key-Encapsulation Mechanism classicmceliece"
44
readme = "README.md"
5-
version = "0.2.0"
5+
version = "0.2.1"
66
authors = ["Thom Wiggers <thom@thomwiggers.nl>"]
77
edition = "2021"
88
license = "MIT OR Apache-2.0"

pqcrypto-classicmceliece/src/mceliece348864.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ use crate::ffi;
2727
use pqcrypto_traits::kem as primitive;
2828
use pqcrypto_traits::{Error, Result};
2929

30+
#[cfg(feature = "std")]
31+
use std::fmt;
32+
3033
macro_rules! simple_struct {
3134
($type: ident, $size: expr) => {
3235
#[derive(Clone, Copy)]
@@ -79,6 +82,14 @@ macro_rules! simple_struct {
7982
.is_ok()
8083
}
8184
}
85+
86+
#[cfg(feature = "std")]
87+
impl fmt::Debug for $type {
88+
/// Add a debug implementation that won't leak private values
89+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
90+
write!(f, "{} ({} bytes)", stringify!($type), self.0.len())
91+
}
92+
}
8293
};
8394
}
8495

pqcrypto-classicmceliece/src/mceliece348864f.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ use crate::ffi;
2727
use pqcrypto_traits::kem as primitive;
2828
use pqcrypto_traits::{Error, Result};
2929

30+
#[cfg(feature = "std")]
31+
use std::fmt;
32+
3033
macro_rules! simple_struct {
3134
($type: ident, $size: expr) => {
3235
#[derive(Clone, Copy)]
@@ -79,6 +82,14 @@ macro_rules! simple_struct {
7982
.is_ok()
8083
}
8184
}
85+
86+
#[cfg(feature = "std")]
87+
impl fmt::Debug for $type {
88+
/// Add a debug implementation that won't leak private values
89+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
90+
write!(f, "{} ({} bytes)", stringify!($type), self.0.len())
91+
}
92+
}
8293
};
8394
}
8495

pqcrypto-classicmceliece/src/mceliece460896.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ use crate::ffi;
2727
use pqcrypto_traits::kem as primitive;
2828
use pqcrypto_traits::{Error, Result};
2929

30+
#[cfg(feature = "std")]
31+
use std::fmt;
32+
3033
macro_rules! simple_struct {
3134
($type: ident, $size: expr) => {
3235
#[derive(Clone, Copy)]
@@ -79,6 +82,14 @@ macro_rules! simple_struct {
7982
.is_ok()
8083
}
8184
}
85+
86+
#[cfg(feature = "std")]
87+
impl fmt::Debug for $type {
88+
/// Add a debug implementation that won't leak private values
89+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
90+
write!(f, "{} ({} bytes)", stringify!($type), self.0.len())
91+
}
92+
}
8293
};
8394
}
8495

pqcrypto-classicmceliece/src/mceliece460896f.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ use crate::ffi;
2727
use pqcrypto_traits::kem as primitive;
2828
use pqcrypto_traits::{Error, Result};
2929

30+
#[cfg(feature = "std")]
31+
use std::fmt;
32+
3033
macro_rules! simple_struct {
3134
($type: ident, $size: expr) => {
3235
#[derive(Clone, Copy)]
@@ -79,6 +82,14 @@ macro_rules! simple_struct {
7982
.is_ok()
8083
}
8184
}
85+
86+
#[cfg(feature = "std")]
87+
impl fmt::Debug for $type {
88+
/// Add a debug implementation that won't leak private values
89+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
90+
write!(f, "{} ({} bytes)", stringify!($type), self.0.len())
91+
}
92+
}
8293
};
8394
}
8495

pqcrypto-classicmceliece/src/mceliece6688128.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ use crate::ffi;
2727
use pqcrypto_traits::kem as primitive;
2828
use pqcrypto_traits::{Error, Result};
2929

30+
#[cfg(feature = "std")]
31+
use std::fmt;
32+
3033
macro_rules! simple_struct {
3134
($type: ident, $size: expr) => {
3235
#[derive(Clone, Copy)]
@@ -79,6 +82,14 @@ macro_rules! simple_struct {
7982
.is_ok()
8083
}
8184
}
85+
86+
#[cfg(feature = "std")]
87+
impl fmt::Debug for $type {
88+
/// Add a debug implementation that won't leak private values
89+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
90+
write!(f, "{} ({} bytes)", stringify!($type), self.0.len())
91+
}
92+
}
8293
};
8394
}
8495

pqcrypto-classicmceliece/src/mceliece6688128f.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ use crate::ffi;
2727
use pqcrypto_traits::kem as primitive;
2828
use pqcrypto_traits::{Error, Result};
2929

30+
#[cfg(feature = "std")]
31+
use std::fmt;
32+
3033
macro_rules! simple_struct {
3134
($type: ident, $size: expr) => {
3235
#[derive(Clone, Copy)]
@@ -79,6 +82,14 @@ macro_rules! simple_struct {
7982
.is_ok()
8083
}
8184
}
85+
86+
#[cfg(feature = "std")]
87+
impl fmt::Debug for $type {
88+
/// Add a debug implementation that won't leak private values
89+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
90+
write!(f, "{} ({} bytes)", stringify!($type), self.0.len())
91+
}
92+
}
8293
};
8394
}
8495

pqcrypto-classicmceliece/src/mceliece6960119.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ use crate::ffi;
2727
use pqcrypto_traits::kem as primitive;
2828
use pqcrypto_traits::{Error, Result};
2929

30+
#[cfg(feature = "std")]
31+
use std::fmt;
32+
3033
macro_rules! simple_struct {
3134
($type: ident, $size: expr) => {
3235
#[derive(Clone, Copy)]
@@ -79,6 +82,14 @@ macro_rules! simple_struct {
7982
.is_ok()
8083
}
8184
}
85+
86+
#[cfg(feature = "std")]
87+
impl fmt::Debug for $type {
88+
/// Add a debug implementation that won't leak private values
89+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
90+
write!(f, "{} ({} bytes)", stringify!($type), self.0.len())
91+
}
92+
}
8293
};
8394
}
8495

pqcrypto-classicmceliece/src/mceliece6960119f.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ use crate::ffi;
2727
use pqcrypto_traits::kem as primitive;
2828
use pqcrypto_traits::{Error, Result};
2929

30+
#[cfg(feature = "std")]
31+
use std::fmt;
32+
3033
macro_rules! simple_struct {
3134
($type: ident, $size: expr) => {
3235
#[derive(Clone, Copy)]
@@ -79,6 +82,14 @@ macro_rules! simple_struct {
7982
.is_ok()
8083
}
8184
}
85+
86+
#[cfg(feature = "std")]
87+
impl fmt::Debug for $type {
88+
/// Add a debug implementation that won't leak private values
89+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
90+
write!(f, "{} ({} bytes)", stringify!($type), self.0.len())
91+
}
92+
}
8293
};
8394
}
8495

0 commit comments

Comments
 (0)