(In reply to Richard Biener from comment #7) > (In reply to Takashi Iwai from comment #6) > > FWIW, ecc_swap_digits() handles the u64 array, so copying would be needed > > there instead of the caller. (And there are two calls of ecc_swap_digits() > > in > > ecdsa_set_pub_key()). > > > > If performance matters, we'd need two versions of ecc_swap_digits() for > > aligned and unaligned. But all calls of ecc_swap_digits() in ecdsa.c look > > suspicious wrt alignment. > > Instead of a memcpy you can also use > > typedef u64 unaligned_u64 __attribute__((aligned(1))); > > *(unaligned_u64 *)digits > > that avoids the memcpy (which should be similarly optimized in most cases, > but you'd need to check). It might of course be slow when the target > cannot do unaligned accesses as it will to shifting/masking/etc. to > produce the u64 value which might not actually be needed as 'u64' (without > knowing the code in question) Or may be use get_unaligned().