shithub: plan9front

Download patch

ref: 3356e0e731bb8e0f4c82caebe358fae2c8fc9113
parent: 4f27f6a04f8c8709e20767b50bd7c2a22ab29340
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Nov 12 18:15:15 EST 2017

libsec: AES-NI support for amd64

Add assembler versions for aes_encrypt/aes_decrypt and the key
setup using AES-NI instruction set. This makes aes_encrypt and
aes_decrypt into function pointers which get initialized by
the first call to setupAESstate().

Note that the expanded round key words are *NOT* stored in big
endian order as with the portable implementation. For that reason
the AESstate.ekey and AESstate.dkey fields have been changed to
void* forcing an error when someone is accessing the roundkey
words. One offender was aesXCBmac, which doesnt appear to be
used and the code looks horrible so it has been deleted.

The AES-NI implementation is for amd64 only as it requires the
kernel to save/restore the FPU state across syscalls and
pagefaults.