Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Unified Diff: src/platform/tpm_lite/src/tlcl/tlcl.c

Issue 1056001: Additional cases for the test suite, and more commands added to TLCL (Closed)
Patch Set: Various fixes for review Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform/tpm_lite/src/tlcl/generator.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/tpm_lite/src/tlcl/tlcl.c
diff --git a/src/platform/tpm_lite/src/tlcl/tlcl.c b/src/platform/tpm_lite/src/tlcl/tlcl.c
index 22d3613a809604cdd0a2fb96d4b7e8ef941cb010..7dc800bbff3dca82bfc74d5f8db98c638301c508 100644
--- a/src/platform/tpm_lite/src/tlcl/tlcl.c
+++ b/src/platform/tpm_lite/src/tlcl/tlcl.c
@@ -150,9 +150,11 @@ static void SendReceive(uint8_t* request, uint8_t* response, int max_length) {
printf("response (%d bytes): ", y);
PrintBytes(response, 10);
PrintBytes(response + 10, y - 10);
+#if !USE_TPM_EMULATOR
printf("execution time: %dms\n",
(int) ((after.tv_sec - before.tv_sec) * 1000 +
(after.tv_usec - before.tv_usec) / 1000));
+#endif
}
/* sanity checks */
@@ -273,3 +275,48 @@ int TlclIsOwned(void) {
result = TpmReturnCode(response);
return (result != TPM_SUCCESS);
}
+
+void TlclForceClear(void) {
+ uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE];
+ uint32_t result;
+ SendReceive(tpm_forceclear_cmd.buffer, response, sizeof(response));
+ result = TpmReturnCode(response);
+ if (result != TPM_SUCCESS) {
+ warning("ForceClear failed with code %d (0x%x)\n", result, result);
+ }
+}
+
+void TlclPhysicalEnable(void) {
+ Send(tpm_physicalenable_cmd.buffer);
+}
+
+int TlclPhysicalSetDeactivated(uint8_t flag) {
+ uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE];
+ uint32_t result;
+ *((uint8_t*)tpm_physicalsetdeactivated_cmd.deactivated) = flag;
+ SendReceive(tpm_physicalsetdeactivated_cmd.buffer,
+ response, sizeof(response));
+ result = TpmReturnCode(response);
+ return result;
+}
+
+int TlclGetFlags(uint8_t* disable, uint8_t* deactivated) {
+
+ uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE];
+ TPM_PERMANENT_FLAGS* pflags;
+ uint32_t result;
+ uint32_t size;
+
+ SendReceive(tpm_getcapability_cmd.buffer, response, sizeof(response));
+ result = TpmReturnCode(response);
+ if (result != TPM_SUCCESS) {
+ return result;
+ }
+ FromTpmUint32(response + kTpmResponseHeaderLength, &size);
+ assert(size == sizeof(TPM_PERMANENT_FLAGS));
+ pflags =
+ (TPM_PERMANENT_FLAGS*) (response + kTpmResponseHeaderLength + sizeof(size));
+ *disable = pflags->disable;
+ *deactivated = pflags->deactivated;
+ return result;
+}
« no previous file with comments | « src/platform/tpm_lite/src/tlcl/generator.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698