mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Fix incorrect alignment in ChaCha20
This commit is contained in:
@@ -150,7 +150,8 @@ fn void ChaCha20.transform(&self, char[] data)
|
||||
self.mutate_keystream();
|
||||
for (usz i = 0; i < BLOCK_SIZE / usz.sizeof; i++)
|
||||
{
|
||||
((usz*)data.ptr)[i] ^= ((usz*)&self.key_stream)[i];
|
||||
usz* data_ref = (usz*)data.ptr + i;
|
||||
@unaligned_store(*data_ref, @unaligned_load(*data_ref, 1) ^ ((usz*)&self.key_stream)[i], 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user