I developed a simple C ++ program to evaluate the performance of OpenSSL AES / GCM calls to the EVP interface. What he does is take a string with a length of 1024 bytes, encrypt it with a key, then encrypt the result with the same key and again and again. I use incremental 4-byte initialization vectors.
When I tested it on my Macbook Pro (Intel i7), the result was very impressive: it took exactly one second to start 1048576 iterations of the above procedure on a single core. This encryption speed is 1 GB / s. 8 GB / s (more or less) if we use all the cores at the same time.
Now I have ported the same tests to Raspberry PI 2. However, when I ran it, it took 0.16 seconds to complete 1024 iterations. This is more or less 6 MB / s, on one core.
Now, I obviously understand that there is a huge, huge difference between a modern, expensive i7 processor and a small ARM processor that runs on raspberries, but still 170 times faster. Therefore, before assuming that the Raspberry PI 2 is really that bad, I wanted to check if these parameters are reasonable.
Has anyone made some kind of benchmark? Is encryption width of 6 MB / s reasonable for raspberries? Or am I doing something wrong?
(I plug it in with a Macbook USB drive: maybe it is so slow because it does not get enough power? It definitely doesnβt seem reasonable. It wonβt work at all, right? Or could there be a lock mechanism to save power?)
UPDATE 1 . I did openssl -evp speed aes-256-cbc on both my Macbook and raspberry.
On a Macbook:
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes aes-256-cbc 534591.95k 564057.62k 566522.81k 570717.87k 574876.33k
On raspberries:
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes aes-256-cbc 14288.53k 16653.74k 17165.31k 17298.43k 17337.00k
This is still a factor of 33, but the Intel processor can use hardware accelerated AES calls. However, as far as I know, GCM mode should be pretty fast than CBC. I donβt know why, but it seems that for GCM there is no opensl guideline, but even assuming that they run the same way, I miss factor 3.
UPDATE 2 Checked on this page: http://elinux.org/RPi_Performance#OpenSSL . It looks like I'm missing 10 MB / s. Total: 27 MB / s with AES / CBC (as it should be) versus 6 MB / s with AES / GCM (as it really is).