According to the BeagleBone Black (BBB) system reference manual, the TI processor supports cryptographic acceleration of AES, SHA (1 I assume), MD5 and has a hardware RNG. The performance with hardware acceleration is much better than just using the CPU. To date, I do not know how to take advantage of the hardware in a user-space application, like OpenSSL. In this post, I’ll document what I tried and hopefully I’ll either solve it later (look for a pingback below) or somebody will help post a solution!
I’m running a tor relay on my BBB, which establishes TLS connections that use AES and SHA according to the spec. My relay runs at about 70% CPU usage and I’m hoping I can lower that with hardware acceleration.
The TI Crypto Users Guide has a detailed walk-through, however it is for their Evaluation Module (EVM) for the Sitara Processor. So, it doesn’t directly apply to the BBB. There is a note on that page that, “The device drivers for AES and SHA/MD5 hardware acceleration is configured and built into the kernel by default in SDK 5.05.00.00. No other special setup is needed for OpenSSL to access the crypto modules.” Which sounds great, but when I run the OpenSSL speed tests on my BBB, I see performance comparable to software-only. This post seems to indicate that an individual was able to use the drivers from the TI website, however I have not found them.
Reading up on hardware acceleration in OpenSSL, it appears to me that for user-space applications, one needs the Cryptodev module. It was easy enough to download, but since then I’ve had some difficulty. Since it is a kernel module, I needed to build against a kernel. My BBB doesn’t have enough space (I’m using Ubuntu) to build a kernel. Also it would take a long time to build on the BBB. So, I tried to cross compile a kernel module. I documented the steps in an email to the Beagleboard mailing list. The TL;DR is that I was able to cross compile the module, but it doesn’t appear to be working.
Now I’m thinking that the running kernel is not the same as what I built against, so I’m following these instructions to build a new kernel and install that. Then I can rebuild my module and test it out.
I also should test my assumption that HW acceleration is not working. Maybe it just doesn’t work with the test parameters? I’m not sure.
Anyway, if anybody has any ideas, I’d love to hear them 🙂