authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-29 15:43:22-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-01-02 16:57:16-07:00
log7391df2be5143db8308ab7c5281842aea99cb1d7
tree6c868bc3da8e06e0299651bbd5fc7e3d77ac050e
parent1d20ada3665102ad09fec0ff486b22f4f0a56141

std.crypto: make proper use of `undefined`


2 files changed, 3 insertions(+), 3 deletions(-)

lib/std/crypto/aegis.zig+2-2
...@@ -174,7 +174,7 @@ pub const Aegis128L = struct {...@@ -174,7 +174,7 @@ pub const Aegis128L = struct {
174 acc |= (computed_tag[j] ^ tag[j]);174 acc |= (computed_tag[j] ^ tag[j]);
175 }175 }
176 if (acc != 0) {176 if (acc != 0) {
177 mem.set(u8, m, 0xaa);177 @memset(m.ptr, undefined, m.len);
178 return error.AuthenticationFailed;178 return error.AuthenticationFailed;
179 }179 }
180 }180 }
...@@ -343,7 +343,7 @@ pub const Aegis256 = struct {...@@ -343,7 +343,7 @@ pub const Aegis256 = struct {
343 acc |= (computed_tag[j] ^ tag[j]);343 acc |= (computed_tag[j] ^ tag[j]);
344 }344 }
345 if (acc != 0) {345 if (acc != 0) {
346 mem.set(u8, m, 0xaa);346 @memset(m.ptr, undefined, m.len);
347 return error.AuthenticationFailed;347 return error.AuthenticationFailed;
348 }348 }
349 }349 }
lib/std/crypto/aes_gcm.zig+1-1
...@@ -91,7 +91,7 @@ fn AesGcm(comptime Aes: anytype) type {...@@ -91,7 +91,7 @@ fn AesGcm(comptime Aes: anytype) type {
91 acc |= (computed_tag[p] ^ tag[p]);91 acc |= (computed_tag[p] ^ tag[p]);
92 }92 }
93 if (acc != 0) {93 if (acc != 0) {
94 mem.set(u8, m, 0xaa);94 @memset(m.ptr, undefined, m.len);
95 return error.AuthenticationFailed;95 return error.AuthenticationFailed;
96 }96 }
9797