diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-04-29 00:19:55 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-29 00:19:55 -0700 |
| commit | d65b42e07caa00dfe2f2fbf221c593ce57882784 (patch) | |
| tree | 7926cbea1499e0affe930bf6d7455dc24adf014e /lib/std/crypto/modes.zig | |
| parent | fd6200eda6d4fe19c34a59430a88a9ce38d6d7a4 (diff) | |
| parent | fa200ca0cad2705bad40eb723dedf4e3bf11f2ff (diff) | |
| download | zig-d65b42e07caa00dfe2f2fbf221c593ce57882784.tar.gz zig-d65b42e07caa00dfe2f2fbf221c593ce57882784.zip | |
Merge pull request #15481 from ziglang/use-mem-intrinsics
actually use the new memory intrinsics
Diffstat (limited to 'lib/std/crypto/modes.zig')
| -rw-r--r-- | lib/std/crypto/modes.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/std/crypto/modes.zig b/lib/std/crypto/modes.zig index 325d8c0ceb..eed803a899 100644 --- a/lib/std/crypto/modes.zig +++ b/lib/std/crypto/modes.zig @@ -38,8 +38,10 @@ pub fn ctr(comptime BlockCipher: anytype, block_cipher: BlockCipher, dst: []u8, if (i < src.len) { mem.writeInt(u128, &counter, counterInt, endian); var pad = [_]u8{0} ** block_length; - mem.copy(u8, &pad, src[i..]); + const src_slice = src[i..]; + @memcpy(pad[0..src_slice.len], src_slice); block_cipher.xor(&pad, &pad, counter); - mem.copy(u8, dst[i..], pad[0 .. src.len - i]); + const pad_slice = pad[0 .. src.len - i]; + @memcpy(dst[i..][0..pad_slice.len], pad_slice); } } |
