Skip to content

Commit

Permalink
zeroize mat array on end of usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Colfenor committed Nov 10, 2024
1 parent ead1096 commit d03ab15
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/pk_gen.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Generation of public key
use zeroize::Zeroize;

use crate::{
gf::{gf_inv, gf_mul},
macros::sub,
Expand Down Expand Up @@ -305,6 +307,10 @@ pub(crate) fn pk_gen(
{
if row == PK_NROWS - 32 {
if mov_columns(&mut mat, pi, pivots) != 0 {
#[cfg(feature = "alloc")]
{
mat.zeroize();
}
return -1;
}
}
Expand All @@ -322,6 +328,10 @@ pub(crate) fn pk_gen(
}

if ((mat[row][i] >> j) & 1) == 0 {
#[cfg(feature = "alloc")]
{
mat.zeroize();
}
return -1;
}

Expand Down Expand Up @@ -361,6 +371,11 @@ pub(crate) fn pk_gen(
}
}

#[cfg(feature = "alloc")]
{
mat.zeroize();
}

0
}

Expand Down

0 comments on commit d03ab15

Please sign in to comment.