[coreboot-gerrit] Change in coreboot[master]: security/tpm: Unify return value for tlcl_resume() across TPM 1.2 and...

Werner Zeh (Code Review) gerrit at coreboot.org
Thu Oct 18 07:09:40 CEST 2018


Werner Zeh has uploaded this change for review. ( https://review.coreboot.org/29176


Change subject: security/tpm: Unify return value for tlcl_resume() across TPM 1.2 and 2.0
......................................................................

security/tpm: Unify return value for tlcl_resume() across TPM 1.2 and 2.0

The TPM_Startup is slightly different in terms of the return value among
TPM version 1.2 and TPM 2.0. TPM 1.2 returns TPM_E_INVALID_POSTINIT
while TPM 2.0 returns TPM_RC_INITIALIZE in the case where the
TPM_Startup command is inappropriate. Do not expose this difference to
the TSPI layer but instead handle it in the TSS layer and provide a
common return value for both versions.

Change-Id: Ibaca1aa6100eaac69a3c1ba00e8c50dedc097d02
Signed-off-by: Werner Zeh <werner.zeh at siemens.com>
---
M src/security/tpm/tspi/tspi.c
M src/security/tpm/tss/tcg-1.2/tss.c
2 files changed, 11 insertions(+), 5 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/76/29176/1

diff --git a/src/security/tpm/tspi/tspi.c b/src/security/tpm/tspi/tspi.c
index fccf224..c13a9d2 100644
--- a/src/security/tpm/tspi/tspi.c
+++ b/src/security/tpm/tspi/tspi.c
@@ -97,10 +97,10 @@
 	/* Handle special init for S3 resume path */
 	if (s3flag) {
 		result = tlcl_resume();
-		if (result == TPM_E_INVALID_POSTINIT)
+		if (result == TPM_SUCCESS) {
 			printk(BIOS_INFO, "TPM: Already initialized.\n");
-
-		return TPM_SUCCESS;
+			return TPM_SUCCESS;
+		}
 	}
 
 	result = tlcl_startup();
diff --git a/src/security/tpm/tss/tcg-1.2/tss.c b/src/security/tpm/tss/tcg-1.2/tss.c
index 0cb7eaa..db98669 100644
--- a/src/security/tpm/tss/tcg-1.2/tss.c
+++ b/src/security/tpm/tss/tcg-1.2/tss.c
@@ -103,7 +103,7 @@
 	VBDEBUG("TPM: command 0x%x returned 0x%x\n",
 		tpm_command_code(request), result);
 
-return result;
+	return result;
 }
 
 
@@ -174,8 +174,14 @@
 
 uint32_t tlcl_resume(void)
 {
+	uint32_t result;
+
 	VBDEBUG("TPM: Resume\n");
-	return send(tpm_resume_cmd.buffer);
+	result = send(tpm_resume_cmd.buffer);
+	if (result == TPM_E_INVALID_POSTINIT)
+		return TPM_SUCCESS;
+	else
+		return result;
 }
 
 uint32_t tlcl_self_test_full(void)

-- 
To view, visit https://review.coreboot.org/29176
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibaca1aa6100eaac69a3c1ba00e8c50dedc097d02
Gerrit-Change-Number: 29176
Gerrit-PatchSet: 1
Gerrit-Owner: Werner Zeh <werner.zeh at siemens.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181018/44fd40b6/attachment-0001.html>


More information about the coreboot-gerrit mailing list