wolfSSL SP Math All and TFM Implementations

In previous blogs, the old math library implementations were discussed and wolfSSL‘s new SP Math All implementation was introduced. Also a comparison between the Integer and SP Math All implementations was discussed showing the improvements in the new library that make it a compelling replacement.

Let’s take a look at how much faster SP Math All is than TFM. (Note: SP Math All configured with –-enable-sp-math-all=huge, TFM configured with --enable-fasthugemath.)

RSA 2048 Sign32.05%44.69%
RSA 2048 Verify21.30%31.01%
DH 2048 Key Gen10.90%16.31%
DH 2048 Agree6.56%16.27%
ECC P-256 Key Gen57.92%56.95%
ECC P-256 Agree54.38%55.90%
ECC P-256 Sign53.95%49.95%
ECC P-256 Verify41.35%47.73%

The Elliptic Curve algorithms are consistently faster across the board – about 50% on x64 and Aarch64. The RSA and DH are variable but the RSA sign is significantly faster. This is all due to better multiplication and squaring operations that use better assembly code snippets.

Now for the code size:

x64 (bytes)TFMSP Math All 
+RSA +DH +ECC490866136842-72.12%
+RSA +DH -ECC485785126410-73.98%
-RSA -DH +ECC485210136266-71.92%

The TFM huge build includes Comba implementations of large bit sizes while the SP Math All uses significantly smaller Karatsuba implementations resulting in vast savings in size with increased speed.

Clearly SP Math All has all the features of TFM but does it better!

In the next blog, a comparison of the performance characteristics of SP Math All and OpenSSL. If you have any commentary or feedback please reach out to our team at facts@wolfssl.com or support@wolfssl.com!