diff --git a/lib/std/crypto/aes/aesni.zig b/lib/std/crypto/aes/aesni.zig index c7b82e0fb964a62a0cdb79b09cbee84a233def41..f21e57dae5919ad674cf3cb38878085928a2fd7a 100644 --- a/lib/std/crypto/aes/aesni.zig +++ b/lib/std/crypto/aes/aesni.zig @@ -312,7 +312,7 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type { } /// Apply the bitwise OR operation to the content of two block vectors. - pub fn orBlocks(block_vec1: Self, block_vec2: Block) Self { + pub fn orBlocks(block_vec1: Self, block_vec2: Self) Self { var out: Self = undefined; inline for (0..native_words) |i| { out.repr[i] = block_vec1.repr[i] | block_vec2.repr[i]; diff --git a/lib/std/crypto/aes/armcrypto.zig b/lib/std/crypto/aes/armcrypto.zig index 02cf207777a86b03b70fd03c5d9e453cfa89a506..438f27abf6b6cb5e041dd8b9ce700607507a6eec 100644 --- a/lib/std/crypto/aes/armcrypto.zig +++ b/lib/std/crypto/aes/armcrypto.zig @@ -216,10 +216,10 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type { } /// XOR the block vector with a byte sequence. - pub fn xorBytes(block_vec: Self, bytes: *const [blocks_count * 16]u8) [32]u8 { - var out: Self = undefined; + pub fn xorBytes(block_vec: Self, bytes: *const [blocks_count * 16]u8) [blocks_count * 16]u8 { + var out: [blocks_count * 16]u8 = undefined; inline for (0..native_words) |i| { - out.repr[i] = block_vec.repr[i].xorBytes(bytes[i * native_word_size ..][0..native_word_size]); + out[i * native_word_size ..][0..native_word_size].* = block_vec.repr[i].xorBytes(bytes[i * native_word_size ..][0..native_word_size]); } return out; } @@ -279,7 +279,7 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type { } /// Apply the bitwise OR operation to the content of two block vectors. - pub fn orBlocks(block_vec1: Self, block_vec2: Block) Self { + pub fn orBlocks(block_vec1: Self, block_vec2: Self) Self { var out: Self = undefined; inline for (0..native_words) |i| { out.repr[i] = block_vec1.repr[i].orBlocks(block_vec2.repr[i]); diff --git a/lib/std/crypto/aes/soft.zig b/lib/std/crypto/aes/soft.zig index 989635208bfeb7e8ddba58c4cc46f9e4e6f2fb5c..28a0ac9f98efbffc6d2a34d9780617ed46afd512 100644 --- a/lib/std/crypto/aes/soft.zig +++ b/lib/std/crypto/aes/soft.zig @@ -391,10 +391,10 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type { } /// XOR the block vector with a byte sequence. - pub fn xorBytes(block_vec: Self, bytes: *const [blocks_count * 16]u8) [32]u8 { - var out: Self = undefined; + pub fn xorBytes(block_vec: Self, bytes: *const [blocks_count * 16]u8) [blocks_count * 16]u8 { + var out: [blocks_count * 16]u8 = undefined; for (0..native_words) |i| { - out.repr[i] = block_vec.repr[i].xorBytes(bytes[i * native_word_size ..][0..native_word_size]); + out[i * native_word_size ..][0..native_word_size].* = block_vec.repr[i].xorBytes(bytes[i * native_word_size ..][0..native_word_size]); } return out; } @@ -454,7 +454,7 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type { } /// Apply the bitwise OR operation to the content of two block vectors. - pub fn orBlocks(block_vec1: Self, block_vec2: Block) Self { + pub fn orBlocks(block_vec1: Self, block_vec2: Self) Self { var out: Self = undefined; for (0..native_words) |i| { out.repr[i] = block_vec1.repr[i].orBlocks(block_vec2.repr[i]);