authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2026-10-15 21:37:19+02:00
committergravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2026-10-19 00:56:14+02:00
log9552ca4c2e9a478fa9187b1eaf64d82c7c2d2b84
tree0e5114396550b9f5e0d77bf9e564080c3ae525a3
parent76789ff59c8a63d75ffcb556cc05713ebbea4c0c

Mention the limitations of secureZero()


1 files changed, 2 insertions(+), 0 deletions(-)

lib/std/crypto.zig+2
...@@ -417,6 +417,8 @@ test "issue #4532: no index out of bounds" {...@@ -417,6 +417,8 @@ test "issue #4532: no index out of bounds" {
417417
418/// Sets a slice to zeroes.418/// Sets a slice to zeroes.
419/// Prevents the store from being optimized out.419/// Prevents the store from being optimized out.
420/// Does not clear copies in registers or elsewhere in memory.
421/// Wiping a value held in registers can force an extra copy into memory.
420pub fn secureZero(comptime T: type, s: []volatile T) void {422pub fn secureZero(comptime T: type, s: []volatile T) void {
421 @memset(s, std.mem.zeroes(T));423 @memset(s, std.mem.zeroes(T));
422}424}