jacobsa/crypto

Add xorBlock for RISC-V architecture

nmeum opened this issue · 1 comments

nmeum commented

The xorBlock function does not have support for RISC-V and thus software depending on crypto e.g. gocryptfs does not compile on RISC-V:

// +build amd64 arm64 ppc64 ppc64le s390x mips64 mips64le

Unfortunately, unaligned loads (which are used by the present xorBlock implementation) are implementation-defined behavior on RISC-V and should thus not be relied on (Section 2.6, "Load and Store Instructions" in the unprivileged ISA specification):

Loads and stores where the effective address is not naturally aligned to the referenced datatype (i.e., on a four-byte boundary for 32-bit accesses, and a two-byte boundary for 16-bit accesses) have behavior dependent on the EEI.

Maybe it makes sense to add a generic fallback implementation of the xorBlock function which does not make use of unaligned loads?

Alpine Linux downstream issue where this was originally reported: https://gitlab.alpinelinux.org/alpine/aports/-/issues/12793