Commit 7391df2be5

Andrew Kelley <andrew@ziglang.org>
2022-12-29 23:43:22
std.crypto: make proper use of `undefined`
1 parent 1d20ada
Changed files (2)
lib
lib/std/crypto/aegis.zig
@@ -174,7 +174,7 @@ pub const Aegis128L = struct {
             acc |= (computed_tag[j] ^ tag[j]);
         }
         if (acc != 0) {
-            mem.set(u8, m, 0xaa);
+            @memset(m.ptr, undefined, m.len);
             return error.AuthenticationFailed;
         }
     }
@@ -343,7 +343,7 @@ pub const Aegis256 = struct {
             acc |= (computed_tag[j] ^ tag[j]);
         }
         if (acc != 0) {
-            mem.set(u8, m, 0xaa);
+            @memset(m.ptr, undefined, m.len);
             return error.AuthenticationFailed;
         }
     }
lib/std/crypto/aes_gcm.zig
@@ -91,7 +91,7 @@ fn AesGcm(comptime Aes: anytype) type {
                 acc |= (computed_tag[p] ^ tag[p]);
             }
             if (acc != 0) {
-                mem.set(u8, m, 0xaa);
+                @memset(m.ptr, undefined, m.len);
                 return error.AuthenticationFailed;
             }