authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2026-04-20 12:39:25+02:00
committergravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2026-05-28 16:27:45+02:00
logb70c1ad89f96c49d9812655b53c05b690ea42be2
treeb05dbca6f8870d7bbd2890dcb4b075e780420ccf
parent3f1dead2fc5922b588fbfb108f421ca957d6934a

std.crypto.aes: fix BlockVec xorBytes and orBlocks signatures

Both methods had wrong parameter or return types that would cause compilation failures.

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

lib/std/crypto/aes/aesni.zig+1-1
...@@ -312,7 +312,7 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {...@@ -312,7 +312,7 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {
312 }312 }
313313
314 /// Apply the bitwise OR operation to the content of two block vectors.314 /// Apply the bitwise OR operation to the content of two block vectors.
315 pub fn orBlocks(block_vec1: Self, block_vec2: Block) Self {315 pub fn orBlocks(block_vec1: Self, block_vec2: Self) Self {
316 var out: Self = undefined;316 var out: Self = undefined;
317 inline for (0..native_words) |i| {317 inline for (0..native_words) |i| {
318 out.repr[i] = block_vec1.repr[i] | block_vec2.repr[i];318 out.repr[i] = block_vec1.repr[i] | block_vec2.repr[i];
lib/std/crypto/aes/armcrypto.zig+4-4
...@@ -216,10 +216,10 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {...@@ -216,10 +216,10 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {
216 }216 }
217217
218 /// XOR the block vector with a byte sequence.218 /// XOR the block vector with a byte sequence.
219 pub fn xorBytes(block_vec: Self, bytes: *const [blocks_count * 16]u8) [32]u8 {219 pub fn xorBytes(block_vec: Self, bytes: *const [blocks_count * 16]u8) [blocks_count * 16]u8 {
220 var out: Self = undefined;220 var out: [blocks_count * 16]u8 = undefined;
221 inline for (0..native_words) |i| {221 inline for (0..native_words) |i| {
222 out.repr[i] = block_vec.repr[i].xorBytes(bytes[i * native_word_size ..][0..native_word_size]);222 out[i * native_word_size ..][0..native_word_size].* = block_vec.repr[i].xorBytes(bytes[i * native_word_size ..][0..native_word_size]);
223 }223 }
224 return out;224 return out;
225 }225 }
...@@ -279,7 +279,7 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {...@@ -279,7 +279,7 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {
279 }279 }
280280
281 /// Apply the bitwise OR operation to the content of two block vectors.281 /// Apply the bitwise OR operation to the content of two block vectors.
282 pub fn orBlocks(block_vec1: Self, block_vec2: Block) Self {282 pub fn orBlocks(block_vec1: Self, block_vec2: Self) Self {
283 var out: Self = undefined;283 var out: Self = undefined;
284 inline for (0..native_words) |i| {284 inline for (0..native_words) |i| {
285 out.repr[i] = block_vec1.repr[i].orBlocks(block_vec2.repr[i]);285 out.repr[i] = block_vec1.repr[i].orBlocks(block_vec2.repr[i]);
lib/std/crypto/aes/soft.zig+4-4
...@@ -391,10 +391,10 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {...@@ -391,10 +391,10 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {
391 }391 }
392392
393 /// XOR the block vector with a byte sequence.393 /// XOR the block vector with a byte sequence.
394 pub fn xorBytes(block_vec: Self, bytes: *const [blocks_count * 16]u8) [32]u8 {394 pub fn xorBytes(block_vec: Self, bytes: *const [blocks_count * 16]u8) [blocks_count * 16]u8 {
395 var out: Self = undefined;395 var out: [blocks_count * 16]u8 = undefined;
396 for (0..native_words) |i| {396 for (0..native_words) |i| {
397 out.repr[i] = block_vec.repr[i].xorBytes(bytes[i * native_word_size ..][0..native_word_size]);397 out[i * native_word_size ..][0..native_word_size].* = block_vec.repr[i].xorBytes(bytes[i * native_word_size ..][0..native_word_size]);
398 }398 }
399 return out;399 return out;
400 }400 }
...@@ -454,7 +454,7 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {...@@ -454,7 +454,7 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {
454 }454 }
455455
456 /// Apply the bitwise OR operation to the content of two block vectors.456 /// Apply the bitwise OR operation to the content of two block vectors.
457 pub fn orBlocks(block_vec1: Self, block_vec2: Block) Self {457 pub fn orBlocks(block_vec1: Self, block_vec2: Self) Self {
458 var out: Self = undefined;458 var out: Self = undefined;
459 for (0..native_words) |i| {459 for (0..native_words) |i| {
460 out.repr[i] = block_vec1.repr[i].orBlocks(block_vec2.repr[i]);460 out.repr[i] = block_vec1.repr[i].orBlocks(block_vec2.repr[i]);