crypto
                                
                                 crypto copied to clipboard
                                
                                    crypto copied to clipboard
                            
                            
                            
                        Add xorBlock for RISC-V architecture
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:
https://github.com/jacobsa/crypto/blob/e7a907a814d5c104f87bf371bd4f27a96ed310f9/cmac/hash_64bit.go#L16
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
https://github.com/rfjakob/gocryptfs/issues/666