AES-NI stands for Advanced Encryption Standard New Instructions, an extension initially proposed by Intel in 2008 for speeding up AES algorithm implementations.
The following code checks whether AES-NI is supported by the CPU:
mov eax, 1 ; CPUID request code #1
cpuid
test ecx, 1 shl 25 ; Check bit 25
jz not_supported ; If bit 25 is not set - CPU does not support AES-NI
Instructions in this extension are rather simple and few:
- AESENC: This performs one round of AES encryption on 128-bit data using a 128-bit round key for all encryption rounds except the last round
- AESENCLAST: This performs the last round of AES encryption on 128-bit data
- AESDEC: This performs one round of AES decryption on 128-bit data using a 128-bit round key for all decryption rounds except the last round
- AESDECLAST: This performs the last round of AES decryption on 128-bit data
- AESKEYGENASSIST: This assists in the generation of an AES round key using an 8-bit round constant (RCON)
- AESIMC: This performs the inverse mix column transformation on a 128-bit round key