0

I am on a trade-off between the use of OpenSSL or NSS in an embedded Linux application that makes use of a TPM (HSM).

EDIT: I need a SSH server and Apache using TLS, both using the keys protected by the TPM.

I am looking for satisfying the following constraints:

  1. Good support of PKCS#11 (at least management of Elliptic Curve keys)
  2. Not too many dependencies
  3. Cross compilation friendly

As far as I could find, NSS natively supports PKCS#11, and OpenSSL needs an external engine, libengine-pkcs11-openssl, which supports only RSA keys. So an OpenSSL choice would lead me to add functionalities to this engine. Are there other PKCS11 engines available for OpenSSL with better support than this one?

Concerning dependencies, NSS requires the Netscape Portable Runtime (NSPR). In total, NSS and its dependencies have 2.5 x more lines of code than OpenSSL. This is a drawback and possibly a show-stopper for embedded applications, except if parts of it useless for the application can be easily dropped from the compilation via some defines. Is it possible?

Concerning cross-compilation, the wikipedia comparison says NSS is cumbersome. Does someone have a how-to to propose or a link please?

More generally, advice of people having experienced one or both of them with a TPM is welcome.

  • Please don't post duplicate questions. Your question is also too broad and subjective since it invites product recommendations. Please have a look at a sister site (Software Recommendations SE) after reading the rules in the help center. – Deer Hunter Oct 10 '14 at 10:10
  • 2
    To use OpenSSL you have to use an engine to utilize a TPM. Here are a couple of blog posts for how to use it. Maybe combined they're helpful to you. HowTo use OpenSSL w/ TPM, TPM Backed SSL – RoraΖ Oct 10 '14 at 12:59
2

Depending on what you are trying to do, you might get away with using neither NSS nor OpenSSL. PKCS#11 is an API that provides functions for running cryptographic primitives over keys; it is conceivable to use that API directly instead of through an extra library.

You would need NSS or OpenSSL if you need some non-PKCS#11 functionality, e.g. support of X.509 certificates or SSL. But if your application only calls for, say, raw signatures, then using PKCS#11 directly can be a reasonable thing to do.

As for lines of code, they don't nearly matter as much as binary size for embedded systems. The ratio of lines of code to binary size is not fixed; it depends on language, coding style, amount of comments, auto-generated code upon compilation... In fact, the fastest way to get the information you seek is probably to try both library (and possibly the no-library option) and see for yourself how well they fit your environment, compilation process and size constraints.

  • Thanks Tom, I need a SSH server and Apache with TLS, both using the keys in the TPM. – lalebarde Oct 10 '14 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.