Snippet which uses NIST SP 800-108
KDF with Countermode
basically, this is an adaptation of github.com/hashicorp/vault/sdk/helper/kdf#CounterMode.
but with the HMAC operation using the TPM.
the sample below uses a swtpm
where the hmac key is saved as a PEM encoded file.
First embed the key: