AES with vector permutations

Mike Hamburg, Stanford University, 2009, public domain.

This software is a public-domain implementation following my paper on implementing AES using vector permute instructions. Doing so has several advantages:

This code is an implementation in x86-64 GNU C and assembly language. It can be ported to other architectures, but I haven't gotten to this yet and might not for a while. Here are performance numbers on 3 machines I tested:

Performance in cycles/byte
CPU familymode 128-bit 192-bit 256-bit
Nehalemctr9.4511.2313.65
cbc9.3311.5512.89
cbc-111.0713.9115.25
Penrynctr11.6413.7415.86
cbc11.3513.4915.53
cbc-113.8016.4119.18
Conroectr19.0025.7829.97
cbc21.3325.6930.03
cbc-125.8931.0536.30

As you can see, this code is quite fast on recent machines: much faster than OpenSSL, and comparable to Crypto++. The exception here is Conroe, which has a very slow shuffler. vpaes doesn't (yet) implement CTR-mode caching, so CTR mode is not any faster than CBC mode. Furthermore, encryption is faster than decryption due to the more complex MixColumns matrix for decryption.

There are still several "to do" items in vpaes:

I'd also like to try these tricks with Camellia and Fugue, which use the AES core.

Download: vpaes (312 KB).

Note that this is a preliminary release, is only minimally tested, comes with no warranty, etc. Please send questions or comments to Mike Hamburg.

Changelog: