linux – Using a TPM as a hardware authentication device


My company is currently developing a product which consists of a fairly generic PC hardware platform and a software stack (the software stack is based on a Debian Buster Linux OS + some applications we develop). As most of the value of our product is the software we would like to make sure that our software won’t run on unauthorised (i.e. not purchased from us) hardware.

I wanted to use the TPM (v1.2) module that is present on our motherboard to perform this verification.
The scheme I have in mind is as following:

  • At manufacturing time, the TPM generates a public/private key pair. This public key identifies this machine and is part of a license file that is signed by our master licensing system private key.
  • At runtime the software checks that the license signature is valid. To check that the public key is indeed the one of this machine, it generates a challenge that is encrypted using the public key and asks the TPM to decrypt it.

Hence my questions:

  • Is it possible to have the TPMĀ generate a public/private key pair, and then perform decryption operations, with the private key being impossible to extract from the TPM?
  • If so could i be pointed to the relevant Linux APIs to perform this operation?

Note:

  • I’m fully aware that fairly basic modifications to our binaries (which can be downloaded from our website, for update purposes) would defeat these protection measures.
  • I’m in an industry where our users would not risk running software that does not come directly from us, however we have been victim of clones of our hardware being distributed without the users noticing it, which is what I want to prevent.