Pardon what is probably a novice question but I'm trying to determine if a TPM (ST33) is really a suitable...
Pardon what is probably a novice question but I'm trying to determine if a TPM (ST33) is really a suitable solution for our use case. Our device is an embedded system with many components on a PCBA - the TPM is one component connected to the main processor via SPI. Main use case for the TPM is to hold 3-4 ECC key pairs and associated certificates. Keys should be "persistent" in the TPM and may be used for key establishment, signing, decryption, etc.
1. Generate 3-4 ECC key pairs in the TPM in manufacturing and export public keys to test equipment connected directly to the TPM (e.g., bed of nails to the SPI bus). Test equipment is running custom code, likely including wolfTPM, to interact directly with the TPM via standard TPM 2.0 commands.
2. Test equipment generates CSRs for each key pair and hands them back to the TPM to be signed by the associated private key. TPM returns signed CSRs back to test equipment.
3. Test equipment hands signed CSRs to an "appliance" that creates each certificate and signs it with the appropriate CA (CA private keys are in an HSM). Appliance hands signed certificates back to test equipment which in turn hands them to the TPM for non-volatile storage.
4. A fielded device will use the private keys in the TPM for signing, decryption, etc. Ideally the private keys will *never* be exported from the TPM.
5. A fielded device may export the certificates from the TPM and hand them to other entities.
In summary, I'm primarily looking at using the TPM as: (a) a keystore to securely hold 3-4 private keys and associated certificates, and (b) a security co-processor to perform signing/decryption operations with the private keys.
This appears to be a somewhat atypical use of a TPM. I have some other options for storing keys securely and performing crypto operations so I'm trying to determine if using the TPM in this manner is feasible and if so, is it overkill and/or a waste of the TPM capabilities for what I'm trying to do?
#ChatAndFeedbackπ
2β€οΈ
π
π‘
π
π
Explore More Posts
Sneak-peak at our #TPMDEV2026 Conference. One slide from each main talk. Expect the recordings soon as we are migrating to Youtube. The news from today is that we are resuming our monthly calls and we will have in-person #TPMDEV2027! Check TPM.dev for more info.
Random Number Generator (TPM2)
1. IntroductionAmong other features, Trusted Platform Modules (TPM) comes with a True Random Number Generator (TRNG) that can be used for various applications including cryptographic purposes. This RNG module serves as the source for randomness for the TPM 2.0 Chip. A RNG module in TPM2 will typically contain the following -
An entropy source and collector
State Register
A mixing func.
There can be two types of calls to the TPMβs Random Number Generator, Internal call and External Call. RNG is capable to provide enough randomness for all the internal calls made. As well as, RNG is capable of providing 32 octets of randomness as per the specification to an external call. Another thing to note here is, each call made to the RNG produces a new value irrespective of the type of call. 1.1 The source of RandomnessThe source of entropy in the TPM is the entropy collector. As the name suggests, entropy collector collects entropy from entropy sources and also removes bias. A TPM2.0 has at least one internal source of entropy. These sources can include noise, clock variations, air movement amongst other events. As depicted in Fig 1.1 the entropy collector provides input to the State Register. 1.2 Stages involved Various algorithms and process supported by TPM calls RNG for unpredictable numbers, which is actually obtained from βRNG Protected Capabilityβ. The βDeterministic Random Bit Generator (DRBG) Protected Capabilityβ obtains entropy from βEntropy Protected Capabilityβ. Along with Entropy Protected Capability, TPM2_StirRandom() can also gather entropy from other entropy sources within the same TPM. 2. Random Numbers via TPM2 ToolsIf one needs to use TPMβs RNG for other external applications, then TPM2 Tools Command Line tools can be a great option. TPM2 Tools Command : tpm2_getrandom - - hex 16 - - hex : Converts output to hexadecimal 16 : Size in bytes Now, if one wants to have additional randomness, TPM2 Tools provides a convenient utility for this purpose called tpm2_stirrandom. To inject entropy via TPM2_StirRandom() to βEntropy Protected Capabilityβ , we can use some file or use stdin. TPM2 Tools Command : echo -n βsome_random_dataβ | tpm2_stirrandom Note : 128 bytes can only be injected using stdin at once through stirrandom() 3. ConclusionThe TPM2 provides in a sense True Random Numbers for use. These unpredictable numbers are coming from a dedicated hardware, hence can be trusted to be given as input to Crypto Algorithms amongst other applications. TPM2 also uses this for its internal use, and TCG claims it to be as secure as the strongest algorithm that TPM supports. Also, using the RNG is pretty straight forward via TPM2 Tools. #Tutorials
The latest tpm2-tools 5.8 release addresses three GitHub security advisories. One is a heap overflow in tpm2_getekcertificate, and the other is an out-of-bounds write that happens when too many sessions are in use. I donβt have information on the third advisory. Beyond the fixes, 5.8 extends EK certificate handling. It adds the option to read EK certificates from NV RAM, introduces new EK templates and supports a marshaled quote format. https://github.com/tpm2-software/tpm2-tools/releases/tag/5.8



Comments
Start the Conversation
I wouldn't say this is an "atypical" use of a TPM. On the contrary, it's very much an intended use of TPMs.
You might not want to store certificates on β¦more
Thanks for the feedback. The particular ST33 we're looking at has 43KB of NVM so it can probably fit a reasonable number of certificates (although our intermediate/root CAs use RSA4096 - grrr). Some related questions: β¦more
Dimitar Tomov the new x.509 functionality is essentially a function that can sign a certificate with an otherwise restricted signing key. It's designed such that the TPM need know very very little about x.509 and β¦more
Hi Craig Heilman , I concur that this sounds like a typical TPM 2.0 use case. In addition to Nicolas Williams point that NVRAM on TPMs is sometimes limited, I made this quick comparison https://developers.tpm.dev/posts/secure-non-volatile-storage-on-tpm-20-modules
Hi
All,
In addition to this, Iβm looking to securely β¦more
Oh. This post is 3y old. Answering anyway... I'd say that it's what TPMs are intended to do, but it's not always the case that they have been used that way. Physical TPMs across SPI buses are not going to be that fast, so one thing to look into, if you are trying to host certificates for HTTPS, is either https://datatracker.ietf.org/doc/rfc9345/ or https://www.rfc-editor.org/rfc/rfc9060.html would make sense. I still find having both confusing.
Also the OPs use case is the central topic of https://www.sandelman.ca/deviceidentityforum/