uncategorized

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.)

  x64 Aarch64
RSA 2048 Sign 32.05% 44.69%
RSA 2048 Verify 21.30% 31.01%
DH 2048 Key Gen 10.90% 16.31%
DH 2048 Agree 6.56% 16.27%
ECC P-256 Key Gen 57.92% 56.95%
ECC P-256 Agree 54.38% 55.90%
ECC P-256 Sign 53.95% 49.95%
ECC P-256 Verify 41.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) TFM SP Math All  
+RSA +DH +ECC 490866 136842 -72.12%
+RSA +DH -ECC 485785 126410 -73.98%
-RSA -DH +ECC 485210 136266 -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 questions or run into any issues, contact us at facts@wolfssl.com, or call us at +1 425 245 8247.