aboutsummaryrefslogtreecommitdiff
path: root/lib/std/crypto/ascon.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-04-29 00:19:55 -0700
committerGitHub <noreply@github.com>2023-04-29 00:19:55 -0700
commitd65b42e07caa00dfe2f2fbf221c593ce57882784 (patch)
tree7926cbea1499e0affe930bf6d7455dc24adf014e /lib/std/crypto/ascon.zig
parentfd6200eda6d4fe19c34a59430a88a9ce38d6d7a4 (diff)
parentfa200ca0cad2705bad40eb723dedf4e3bf11f2ff (diff)
downloadzig-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/ascon.zig')
-rw-r--r--lib/std/crypto/ascon.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/std/crypto/ascon.zig b/lib/std/crypto/ascon.zig
index f37d9acea5..ae4bb57d29 100644
--- a/lib/std/crypto/ascon.zig
+++ b/lib/std/crypto/ascon.zig
@@ -34,7 +34,7 @@ pub fn State(comptime endian: builtin.Endian) type {
/// Initialize the state from a slice of bytes.
pub fn init(initial_state: [block_bytes]u8) Self {
var state = Self{ .st = undefined };
- mem.copy(u8, state.asBytes(), &initial_state);
+ @memcpy(state.asBytes(), &initial_state);
state.endianSwap();
return state;
}
@@ -87,7 +87,7 @@ pub fn State(comptime endian: builtin.Endian) type {
}
if (i < bytes.len) {
var padded = [_]u8{0} ** 8;
- mem.copy(u8, padded[0 .. bytes.len - i], bytes[i..]);
+ @memcpy(padded[0 .. bytes.len - i], bytes[i..]);
self.st[i / 8] = mem.readInt(u64, padded[0..], endian);
}
}
@@ -109,7 +109,7 @@ pub fn State(comptime endian: builtin.Endian) type {
}
if (i < bytes.len) {
var padded = [_]u8{0} ** 8;
- mem.copy(u8, padded[0 .. bytes.len - i], bytes[i..]);
+ @memcpy(padded[0 .. bytes.len - i], bytes[i..]);
self.st[i / 8] ^= mem.readInt(u64, padded[0..], endian);
}
}
@@ -123,7 +123,7 @@ pub fn State(comptime endian: builtin.Endian) type {
if (i < out.len) {
var padded = [_]u8{0} ** 8;
mem.writeInt(u64, padded[0..], self.st[i / 8], endian);
- mem.copy(u8, out[i..], padded[0 .. out.len - i]);
+ @memcpy(out[i..], padded[0 .. out.len - i]);
}
}
@@ -138,16 +138,16 @@ pub fn State(comptime endian: builtin.Endian) type {
}
if (i < in.len) {
var padded = [_]u8{0} ** 8;
- mem.copy(u8, padded[0 .. in.len - i], in[i..]);
+ @memcpy(padded[0 .. in.len - i], in[i..]);
const x = mem.readIntNative(u64, &padded) ^ mem.nativeTo(u64, self.st[i / 8], endian);
mem.writeIntNative(u64, &padded, x);
- mem.copy(u8, out[i..], padded[0 .. in.len - i]);
+ @memcpy(out[i..], padded[0 .. in.len - i]);
}
}
/// Set the words storing the bytes of a given range to zero.
pub fn clear(self: *Self, from: usize, to: usize) void {
- mem.set(u64, self.st[from / 8 .. (to + 7) / 8], 0);
+ @memset(self.st[from / 8 .. (to + 7) / 8], 0);
}
/// Clear the entire state, disabling compiler optimizations.