Skip to content

Commit 089e0fb

Browse files
jejbjarkkojs
authored andcommitted
tpm: add the null key name as a sysfs export
This is the last component of encrypted tpm2 session handling that allows us to verify from userspace that the key derived from the NULL seed genuinely belongs to the TPM and has not been spoofed. The procedure for doing this involves creating an attestation identity key (which requires verification of the TPM EK certificate) and then using that AIK to sign a certification of the Elliptic Curve key over the NULL seed. Userspace must create this EC Key using the parameters prescribed in TCG TPM v2.0 Provisioning Guidance for the SRK ECC; if this is done correctly the names will match and the TPM can then run a TPM2_Certify operation on this derived primary key using the newly created AIK. Signed-off-by: James Bottomley <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Tested-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
1 parent 52ce7d9 commit 089e0fb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/char/tpm/tpm-sysfs.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,21 @@ static ssize_t tpm_version_major_show(struct device *dev,
309309
}
310310
static DEVICE_ATTR_RO(tpm_version_major);
311311

312+
#ifdef CONFIG_TCG_TPM2_HMAC
313+
static ssize_t null_name_show(struct device *dev, struct device_attribute *attr,
314+
char *buf)
315+
{
316+
struct tpm_chip *chip = to_tpm_chip(dev);
317+
int size = TPM2_NAME_SIZE;
318+
319+
bin2hex(buf, chip->null_key_name, size);
320+
size *= 2;
321+
buf[size++] = '\n';
322+
return size;
323+
}
324+
static DEVICE_ATTR_RO(null_name);
325+
#endif
326+
312327
static struct attribute *tpm1_dev_attrs[] = {
313328
&dev_attr_pubek.attr,
314329
&dev_attr_pcrs.attr,
@@ -326,6 +341,9 @@ static struct attribute *tpm1_dev_attrs[] = {
326341

327342
static struct attribute *tpm2_dev_attrs[] = {
328343
&dev_attr_tpm_version_major.attr,
344+
#ifdef CONFIG_TCG_TPM2_HMAC
345+
&dev_attr_null_name.attr,
346+
#endif
329347
NULL
330348
};
331349

0 commit comments

Comments
 (0)