On Tue, 21 Dec 2021 08:24:48 +0100 Ard Biesheuvel wrote: > > Could you check whether this means that gcm_context_data in > > gcmaes_crypt_by_sg() does not have to be aligned either? It would be > > nice if we could drop that horrible hack as well. > > I guess you meant by "we take care of the meta-data (key, iv etc.) > alignment anyway" that we have these hacks for gcm_context_data (which > carries the key) and the IV, using oversized buffers on the stack and > open coded realignment. > > It would be really nice if we could just get rid of all of that as > well, and just use {v}movdqu to load those items. Yup, exactly. I did something close to s/movdqa/movdqu/ initially, but doing a competent job removing the alignment assumption would be more effort. Let's see if I can see the copy if any perf profile... FWIW there is a comment up top in arch/x86/crypto/aesni-intel_asm.S which explains the aligned operations were chosen because they have a shorter encoding. Seems like an intentional choice.