| author | |
| committer | |
| log | 0bed4fb384f2e4d0f33307f63e9d3a1f023438e4 |
| tree | bb49b1012029445d2d5fa7edeb1a209095851c79 |
| parent | 469bf6af07ad16fc5ac1421a302178a3fd508343 |
also removed some related ptrCasts3 files changed, 3 insertions(+), 3 deletions(-)
lib/std/crypto.zig+1-1| ... | @@ -412,7 +412,7 @@ test "issue #4532: no index out of bounds" { | ... | @@ -412,7 +412,7 @@ test "issue #4532: no index out of bounds" { |
| 412 | /// Sets a slice to zeroes. | 412 | /// Sets a slice to zeroes. |
| 413 | /// Prevents the store from being optimized out. | 413 | /// Prevents the store from being optimized out. |
| 414 | pub fn secureZero(comptime T: type, s: []volatile T) void { | 414 | pub fn secureZero(comptime T: type, s: []volatile T) void { |
| 415 | @memset(s, 0); | 415 | @memset(s, std.mem.zeroes(T)); |
| 416 | } | 416 | } |
| 417 | 417 | ||
| 418 | test secureZero { | 418 | test secureZero { |
lib/std/crypto/ghash_polyval.zig+1-1| ... | @@ -402,7 +402,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type { | ... | @@ -402,7 +402,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type { |
| 402 | st.pad(); | 402 | st.pad(); |
| 403 | mem.writeInt(u128, out[0..16], st.acc, endian); | 403 | mem.writeInt(u128, out[0..16], st.acc, endian); |
| 404 | 404 | ||
| 405 | std.crypto.secureZero(u8, @as([*]u8, @ptrCast(st))[0..@sizeOf(Self)]); | 405 | std.crypto.secureZero(Self, st[0..1]); |
| 406 | } | 406 | } |
| 407 | 407 | ||
| 408 | /// Compute the GHASH of a message. | 408 | /// Compute the GHASH of a message. |
lib/std/crypto/poly1305.zig+1-1| ... | @@ -184,7 +184,7 @@ pub const Poly1305 = struct { | ... | @@ -184,7 +184,7 @@ pub const Poly1305 = struct { |
| 184 | mem.writeInt(u64, out[0..8], st.h[0], .little); | 184 | mem.writeInt(u64, out[0..8], st.h[0], .little); |
| 185 | mem.writeInt(u64, out[8..16], st.h[1], .little); | 185 | mem.writeInt(u64, out[8..16], st.h[1], .little); |
| 186 | 186 | ||
| 187 | std.crypto.secureZero(u8, @as([*]u8, @ptrCast(st))[0..@sizeOf(Poly1305)]); | 187 | std.crypto.secureZero(Poly1305, st[0..1]); |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | pub fn create(out: *[mac_length]u8, msg: []const u8, key: *const [key_length]u8) void { | 190 | pub fn create(out: *[mac_length]u8, msg: []const u8, key: *const [key_length]u8) void { |