Have <ed448::Point as Zeroize>::zeroize yield a well-defined value

This commit is contained in:
Luke Parker
2025-08-20 08:14:00 -04:00
parent 9841061b49
commit 758d422595
3 changed files with 15 additions and 3 deletions

2
Cargo.lock generated
View File

@@ -4827,7 +4827,7 @@ dependencies = [
[[package]] [[package]]
name = "minimal-ed448" name = "minimal-ed448"
version = "0.4.1" version = "0.4.2"
dependencies = [ dependencies = [
"ciphersuite", "ciphersuite",
"crypto-bigint", "crypto-bigint",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "minimal-ed448" name = "minimal-ed448"
version = "0.4.1" version = "0.4.2"
description = "Unaudited, inefficient implementation of Ed448 in Rust" description = "Unaudited, inefficient implementation of Ed448 in Rust"
license = "MIT" license = "MIT"
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/ed448" repository = "https://github.com/serai-dex/serai/tree/develop/crypto/ed448"

View File

@@ -50,13 +50,25 @@ fn recover_x(y: FieldElement) -> CtOption<FieldElement> {
} }
/// Ed448 point. /// Ed448 point.
#[derive(Clone, Copy, Debug, Zeroize)] #[derive(Clone, Copy, Debug)]
pub struct Point { pub struct Point {
x: FieldElement, x: FieldElement,
y: FieldElement, y: FieldElement,
z: FieldElement, z: FieldElement,
} }
impl Zeroize for Point {
fn zeroize(&mut self) {
self.x.zeroize();
self.y.zeroize();
self.z.zeroize();
let identity = Self::identity();
self.x = identity.x;
self.y = identity.y;
self.z = identity.z;
}
}
const G: Point = Point { x: G_X, y: G_Y, z: FieldElement::ONE }; const G: Point = Point { x: G_X, y: G_Y, z: FieldElement::ONE };
impl ConstantTimeEq for Point { impl ConstantTimeEq for Point {