keccak: ARMv8 asm! cleanups (#101)

We pass in `state.as_mut_ptr()` as `x0`, which was previously marked as
`in`. However, it's modified in the `asm!`, e.g.:

    sub x0, x0, #192

Note: it's also post-incremented by `ld1.1d` as state is loaded.

Since it's modified, it needs to be `inout`. This marks it as such,
using the `=> _` syntax to discard the result, then it's reset, then
modified as state is written).

Similar mutations were occurring with `x1` and `x8` as well, which have
been modified accordingly.
This commit is contained in:
Tony Arcieri 2026-02-13 07:29:27 -07:00 committed by GitHub
parent 239ff349af
commit 7ac1920198
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -124,9 +124,9 @@ pub unsafe fn p1600_armv8_sha3_asm(state: &mut [u64; 25], round_count: usize) {
st1.1d {{v20-v23}}, [x0], #32
st1.1d {{v24}}, [x0]
",
in("x0") state.as_mut_ptr(),
in("x1") crate::RC[24-round_count..].as_ptr(),
in("x8") round_count,
inout("x0") state.as_mut_ptr() => _,
inout("x1") crate::RC[24-round_count..].as_ptr() => _,
inout("x8") round_count => _,
clobber_abi("C"),
options(nostack)
);