Using wolfSSL on Raspberry Pi



Did you know that the wolfSSL lightweight SSL library builds and runs out of the box on the Raspberry Pi? We recently ran tests on a Raspberry Pi model B with wolfSSL 3.0.0. You can check out the results below:

1. Downloading

For the test, we downloaded cyassl-3.0.0.zip file from our download page.

2. Building

Instead of cross compiling wolfSSL to armv6, we compiled wolfSSL directly on our Raspberry Pi to get an average time of the building process. Following the process described in the README file to configure and build wolfSSL, the results were as follows:

$ time ./configure
...
real 1m33.504s
user 0m50.270s
sys 0m16.550s

$ time make
...
real 3m20.676s
user 2m50.290s
sys 0m6.940s

3. Benchmarking

To decide which math library to use we compared the results of the default build (./configure) with a modified one (./configure --enable-fastmath):

wolfSSL Benchmark, Normal Big Integer Math Library

pi@raspberrypi ~/cyassl-3.0.0 $ ./ctaocrypt/benchmark/benchmark
AES 5 megs took 0.880 seconds, 5.681 MB/s
ARC4 5 megs took 0.230 seconds, 21.734 MB/s
3DES 5 megs took 3.064 seconds, 1.632 MB/s

MD5 5 megs took 0.104 seconds, 48.112 MB/s
SHA 5 megs took 0.217 seconds, 23.072 MB/s
SHA-256 5 megs took 0.498 seconds, 10.032 MB/s

RSA 2048 encryption took 17.453 milliseconds, avg over 100 iterations
RSA 2048 decryption took 147.625 milliseconds, avg over 100 iterations
DH 2048 key generation 48.942 milliseconds, avg over 100 iterations
DH 2048 key agreement 61.991 milliseconds, avg over 100 iterations

wolfSSL Benchmark, Fast Big Integer Math Library

pi@raspberrypi ~/cyassl-3.0.0 $ ./ctaocrypt/benchmark/benchmark
AES 5 megs took 0.889 seconds, 5.624 MB/s
ARC4 5 megs took 0.200 seconds, 24.943 MB/s
3DES 5 megs took 2.479 seconds, 2.017 MB/s

MD5 5 megs took 0.101 seconds, 49.303 MB/s
SHA 5 megs took 0.217 seconds, 23.004 MB/s
SHA-256 5 megs took 0.561 seconds, 8.914 MB/s

RSA 2048 encryption took 4.622 milliseconds, avg over 100 iterations
RSA 2048 decryption took 131.030 milliseconds, avg over 100 iterations
DH 2048 key generation 57.496 milliseconds, avg over 100 iterations
DH 2048 key agreement 57.325 milliseconds, avg over 100 iterations

As expected, the fastmath provided more performant RSA operations - thus we used this build for the example test.

4. Running

After testing the crypto layer, it was time to test the protocol layer running our client example against our server example running or a remote Ubuntu server:

$ time ./examples/client/client -h external_server
SSL version is TLSv1.2
SSL cipher suite is TLS_RSA_WITH_AES_256_CBC_SHA256
Server response: I hear you fa shizzle!

real 0m0.885s
user 0m0.520s
sys 0m0.080s

5. Conclusion

wolfSSL 3.0.0 works out of the box on Raspberry Pi. While building wolfSSL on Raspberry Pi is OK, it does take some time to do so. Users should consider using cross compilation during the development cycle if building wolfSSL for the Pi on a regular basis needed.

6. Extra

If you like to stay synchronized with the latest commits of our github repository, don't like to wait for stable releases, love git repositories, or just want to checkout a specific version, you can do so by following these steps before compiling wolfSSL:

* Check if you have libtool, autoconf and automake installed on your Pi:
$ sudo apt-get install libtool autoconf automake
* Clone wolfSSL repository from GitHub:
$ git clone https://github.com/cyassl/cyassl.git
* Run the autogen script:
$ cd cyassl
$ ./autogen.sh


Originally posted at: http://www.wolfssl.com/wolfSSL/Blog/Entries/2014/6/19_Using_CyaSSL_on_Raspberry_Pi.html
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.