-
Notifications
You must be signed in to change notification settings - Fork 300
Closed
Description
Lines 98 to 120 in 50ea2ee
pub fn f8_impl<M: Machine>(mach: M, state: &mut [vec128_storage; 8], data: *const u8) { | |
#[allow(clippy::cast_ptr_alignment)] | |
let data: *const M::u128x1 = data.cast(); | |
let mut y = X8::<M>( | |
mach.unpack(state[0]), | |
mach.unpack(state[1]), | |
mach.unpack(state[2]), | |
mach.unpack(state[3]), | |
mach.unpack(state[4]), | |
mach.unpack(state[5]), | |
mach.unpack(state[6]), | |
mach.unpack(state[7]), | |
); | |
unsafe { | |
y.0 ^= ptr::read_unaligned(data); | |
y.1 ^= ptr::read_unaligned(data.offset(1)); | |
y.2 ^= ptr::read_unaligned(data.offset(2)); | |
y.3 ^= ptr::read_unaligned(data.offset(3)); | |
} | |
for rc in crate::consts::E8_BITSLICE_ROUNDCONSTANT.chunks_exact(7) { | |
unroll7!(j, { | |
y = ss(y, unsafe { X2Bytes::<M> { bytes: rc[j] }.x2 }); | |
y = l(y); |
Hi there, the parameter data
is read at line 112-115 without sufficient checks, which might cuase memory issue. Since this is publicly accessible to library user, would you consider to mark the function unsafe? or make it private in the crate.
Metadata
Metadata
Assignees
Labels
No labels