mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Have <ed448::Point as Zeroize>::zeroize yield a well-defined value
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -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",
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user