Performance

The test results shown below were executed on a MacBook Pro Mid 2015 that contained an Intel Core i7 4870HQ @ 2.5GHz and 16GB of RAM. Performance results are contingent on the computer system and dependent on which OpenSSL library is used while testing performance. To execute performance testing, OpenSSL contains a function, speed, which allows one to test the speed of various encryption algorithms. To ensure AES-NI is utilized doing the test, testers must use the –evp flag. Functions within the EVP library automatically uses AES-NI if available.

Below are results from several tests. These tests were executed with several changing variables, such as AES-NI enabled and AES-NI disabled. As shown in Figure 3, OpenSSL version 1.0.2f performed at 786 MB/s 8192 bytes block size when AES-NI is enabled.

MacBook-Pro:bin $ ./openssl speed -elapsed -evp aes-128-cbc

You have chosen to measure elapsed time instead of user CPU time.

Doing aes-128-cbc for 3s on 16 size blocks: 127081126 aes-128-cbc’s in 3.00s

Doing aes-128-cbc for 3s on 64 size blocks: 35936898 aes-128-cbc’s in 3.00s

Doing aes-128-cbc for 3s on 256 size blocks: 9220403 aes-128-cbc’s in 3.00s

Doing aes-128-cbc for 3s on 1024 size blocks: 2303418 aes-128-cbc’s in 3.00s

Doing aes-128-cbc for 3s on 8192 size blocks: 288105 aes-128-cbc’s in 3.00s

OpenSSL 1.0.2f 28 Jan 2016

built on: reproducible build, date unspecified

options:bn(64,64) rc4(ptr,int) des(idx,cisc,16,int) aes(partial) idea(int) blowfish(idx)

compiler: clang -I. -I.. -I../include -fPIC -fno-common -DOPENSSL_PIC -DZLIB_SHARED -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch x86_64 -O3 -DL_ENDIAN -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM

The ‘numbers’ are in 1000s of bytes per second processed.

type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes

aes-128-cbc 677766.01k 766653.82k 786807.72k 786233.34k 786718.72k

Figure 3. Speed test of AES-128-CBC using OpenSSL 1.0.2f

To keep the speed performance test uniform, the functions with the EVP library will be utilized with AES_NI disabled. Since functions within the library will automatically use AES-NI, the OPENSSL_ia32cap=”~0x200000200000000" environment variable will trigger OpenSSL to disable AES-NI. With AES-NI disabled, AES-128-CBC clocked in a drastically lower rate at 369MB/s on an 8192 block size.

MacBook-Pro:bin $ OPENSSL_ia32cap=”~0x200000200000000" ./openssl speed -elapsed -evp aes-128-cbc

You have chosen to measure elapsed time instead of user CPU time.

Doing aes-128-cbc for 3s on 16 size blocks: 58707174 aes-128-cbc’s in 3.01s

Doing aes-128-cbc for 3s on 64 size blocks: 14667713 aes-128-cbc’s in 3.00s

Doing aes-128-cbc for 3s on 256 size blocks: 3920894 aes-128-cbc’s in 3.00s

Doing aes-128-cbc for 3s on 1024 size blocks: 1097018 aes-128-cbc’s in 3.00s

Doing aes-128-cbc for 3s on 8192 size blocks: 135340 aes-128-cbc’s in 3.00s

OpenSSL 1.0.2f 28 Jan 2016

built on: reproducible build, date unspecified

options:bn(64,64) rc4(ptr,int) des(idx,cisc,16,int) aes(partial) idea(int) blowfish(idx)

compiler: clang -I. -I.. -I../include -fPIC -fno-common -DOPENSSL_PIC -DZLIB_SHARED -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch x86_64 -O3 -DL_ENDIAN -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM

The ‘numbers’ are in 1000s of bytes per second processed.

type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes

aes-128-cbc 312064.71k 312911.21k 334582.95k 374448.81k 369568.43k

Figure 4. Speed test of AES-128-CBC using OpenSSL 1.0.2f with AES-NI disabled

RC4 is well known for its speed, but not for its security, as with the AES encryption algorithm. To determine how AES-128 in CBC mode using the new AES instructions holds up, we conducted an RC4 speed test and concluded that RC4 is slower than AES-128-CBC with the use of the new instructions. RC4 clocked in at 621 MB/s on block sizes of 8190 as seen in Figure 5, while AES-128-CBC clocked in at 786 MB/s. However, the use of AES-NI is critical; RC4 is more than twice as fast as AES without the new instructions.

MacBook-Pro:bin $ ./openssl speed -elapsed -evp rc4

You have chosen to measure elapsed time instead of user CPU time.

Doing rc4 for 3s on 16 size blocks: 98100856 rc4’s in 3.00s

Doing rc4 for 3s on 64 size blocks: 31242136 rc4’s in 3.00s

Doing rc4 for 3s on 256 size blocks: 8148845 rc4’s in 3.00s

Doing rc4 for 3s on 1024 size blocks: 1972899 rc4’s in 3.01s

Doing rc4 for 3s on 8192 size blocks: 227644 rc4’s in 3.00s

OpenSSL 1.0.2f 28 Jan 2016

built on: reproducible build, date unspecified

options:bn(64,64) rc4(ptr,int) des(idx,cisc,16,int) aes(partial) idea(int) blowfish(idx)

compiler: clang -I. -I.. -I../include -fPIC -fno-common -DOPENSSL_PIC -DZLIB_SHARED -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch x86_64 -O3 -DL_ENDIAN -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM

The ‘numbers’ are in 1000s of bytes per second processed.

type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes

rc4 523204.57k 666498.90k 695368.11k 671178.93k 621619.88k

Figure 5. Speed test of RC4 using OpenSSL 1.0.2f