lb
Posts: 261
Joined: Sat Jan 28, 2012 8:07 pm

OpenSSL assembly optimizations

Thu Jun 14, 2012 11:12 pm

OpenSSL has ARM assembly code to accelerate encryption/decryption of the most important ciphers. It's enabled in OpenSSL's default ARM configurations, but unfortunately not in Debian's or Raspbian's OpenSSL package. These optimizations have a *huge* impact.

A Debian bug includes a patch to enable these optimizations, and also some benchmarks. Needless to say, I'd really like to see them enabled by default in Raspbian. I've been using OpenSSL compiled with those optimizations for a while, and didn't have any problems. I definitely saw a nice speedup in various applications, e.g. ssh/scp.

User avatar
mpthompson
Posts: 620
Joined: Fri Feb 03, 2012 7:18 pm
Location: San Carlos, CA
Contact: Website

Re: OpenSSL assembly optimizations

Fri Jun 15, 2012 2:32 am

Here is the bug and the associated patch file to enable ARM assembly in OpenSSL. I'll work to include this in a Raspbian modified version of OpenSSL as these are the types of optimizations that will help give the Raspberry Pi a slightly better user experience.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=676533

I'll post back when I have the patch included in the repository.

User avatar
mpthompson
Posts: 620
Joined: Fri Feb 03, 2012 7:18 pm
Location: San Carlos, CA
Contact: Website

Re: OpenSSL assembly optimizations

Sun Jun 17, 2012 9:44 pm

I applied the linked optimization patch to the openssl package and rebuilt it. All build tests passed so it looks like it is good and should be in our public repository by Sunday evening. The updated binary packages are:

libssl1.0.0_1.0.1c-3+rpi1_armhf.deb
libssl1.0.0-dbg_1.0.1c-3+rpi1_armhf.deb
libssl-dev_1.0.1c-3+rpi1_armhf.deb
libssl-doc_1.0.1c-3+rpi1_all.deb
openssl_1.0.1c-3+rpi1_armhf.deb

This patch really needs to be pushed upstream so future updates include it. Perhaps lb can contact the upstream maintainer of the package for Debian and have them include it in the next release. Unfortunately, arm based versions of packages are often an afterthought for many maintainers and you have to be a bit proactive to get them to include arm specific changes such as this.

lingon
Posts: 118
Joined: Fri Aug 26, 2011 7:31 am

Re: OpenSSL assembly optimizations

Mon Jun 18, 2012 4:13 pm

mpthompson wrote:I applied the linked optimization patch to the openssl package and rebuilt it. All build tests passed so it looks like it is good and should be in our public repository by Sunday evening.
Did you happen to run openssl speed with the ARM optimized packages?

With my Raspberry Pi overclocked to 900 MHz I have been able to transfer files with scp with -c arcfour at 4,2 MB/s from the Raspberry Pi to another PC. It would be interesting to know if the scp transfer speed increases with the openssl optimizations.

User avatar
mpthompson
Posts: 620
Joined: Fri Feb 03, 2012 7:18 pm
Location: San Carlos, CA
Contact: Website

Re: OpenSSL assembly optimizations

Mon Jun 18, 2012 5:35 pm

lingon wrote:Did you happen to run openssl speed with the ARM optimized packages?
No, I didn't run any speeds tests as my concern was mostly with wanting to make sure functionality wasn't broken. Anecdotal evidence suggests it's a bit faster. On the #raspbian IRC channel, ratherdashing posting the following:
<ratherDashing> those open ssl package updates with the asm instructions reallydid make a difference. When I run speedtest.net through a SSH proxy I was between 50-60%CPU usage. Now it's closer to 30%

lb
Posts: 261
Joined: Sat Jan 28, 2012 8:07 pm

Re: OpenSSL assembly optimizations

Mon Jun 18, 2012 6:33 pm

According to OpenSSL's integrated benchmark, AES performance is about doubled (!) with the ASM, and most other important ciphers and hash functions see a notable speedup, too.

lingon
Posts: 118
Joined: Fri Aug 26, 2011 7:31 am

Re: OpenSSL assembly optimizations

Fri Jun 22, 2012 6:07 pm

Are the OpenSSL assembly optimizations available somewhere or will they be included in the Debian Wheezy Beta release as an update?

Return to “Raspbian”