| ... | @@ -417,6 +417,8 @@ test "issue #4532: no index out of bounds" { | ... | @@ -417,6 +417,8 @@ test "issue #4532: no index out of bounds" { |
| 417 | | 417 | |
| 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. |
| 420 | pub fn secureZero(comptime T: type, s: []volatile T) void { | 422 | pub 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 | } |