uncategorized

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. DownloadingFor the test, we downloaded cyassl-3.0.0.zip file from our download page.2. BuildingInstead 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.940s3. BenchmarkingTo 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 Librarypi@raspberrypi ~/cyassl-3.0.0 $ ./ctaocrypt/benchmark/benchmarkAES 5 megs took 0.880 seconds, 5.681 MB/sARC4 5 megs took 0.230 seconds, 21.734 MB/s3DES 5 megs took 3.064 seconds, 1.632 MB/sMD5 5 megs took 0.104 seconds, 48.112 MB/sSHA 5 megs took 0.217 seconds, 23.072 MB/sSHA-256 5 megs took 0.498 seconds, 10.032 MB/sRSA 2048 encryption took 17.453 milliseconds, avg over 100 iterationsRSA 2048 decryption took 147.625 milliseconds, avg over 100 iterationsDH 2048 key generation 48.942 milliseconds, avg over 100 iterationsDH 2048 key agreement 61.991 milliseconds, avg over 100 iterationswolfSSL Benchmark, Fast Big Integer Math Librarypi@raspberrypi ~/cyassl-3.0.0 $ ./ctaocrypt/benchmark/benchmarkAES 5 megs took 0.889 seconds, 5.624 MB/sARC4 5 megs took 0.200 seconds, 24.943 MB/s3DES 5 megs took 2.479 seconds, 2.017 MB/sMD5 5 megs took 0.101 seconds, 49.303 MB/sSHA 5 megs took 0.217 seconds, 23.004 MB/sSHA-256 5 megs took 0.561 seconds, 8.914 MB/sRSA 2048 encryption took 4.622 milliseconds, avg over 100 iterationsRSA 2048 decryption took 131.030 milliseconds, avg over 100 iterationsDH 2048 key generation 57.496 milliseconds, avg over 100 iterationsDH 2048 key agreement 57.325 milliseconds, avg over 100 iterationsAs expected, the fastmath provided more performant RSA operations - thus we used this build for the example test.4. RunningAfter 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_serverSSL version is TLSv1.2SSL cipher suite is TLS_RSA_WITH_AES_256_CBC_SHA256Server response: I hear you fa shizzle!real 0m0.885suser 0m0.520ssys 0m0.080s5. ConclusionwolfSSL 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. ExtraIf 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