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

View File

@@ -1,6 +1,6 @@
[package]
name = "minimal-ed448"
version = "0.4.1"
version = "0.4.2"
description = "Unaudited, inefficient implementation of Ed448 in Rust"
license = "MIT"
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.
#[derive(Clone, Copy, Debug, Zeroize)]
#[derive(Clone, Copy, Debug)]
pub struct Point {
x: FieldElement,
y: 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 };
impl ConstantTimeEq for Point {