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

Unified Diff: firmware/stub/tpm_lite_stub.c

Issue 3032055: Allow passing TPM device path in the environment. (Closed) Base URL: ssh://git@chromiumos-git/vboot_reference.git
Patch Set: . Created 10 years, 4 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 | « no previous file | utility/tpm_init_temp_fix.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: firmware/stub/tpm_lite_stub.c
diff --git a/firmware/stub/tpm_lite_stub.c b/firmware/stub/tpm_lite_stub.c
index 0dabb8f1a49c70a537959860a92570f4dccf6e15..2211064363a257eb69b96dac678028d61fc1e2e2 100644
--- a/firmware/stub/tpm_lite_stub.c
+++ b/firmware/stub/tpm_lite_stub.c
@@ -15,6 +15,7 @@
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
@@ -111,12 +112,19 @@ void TlclCloseDevice(void) {
void TlclOpenDevice(void) {
+ char* device_path;
+
if (tpm_fd >= 0)
return; /* Already open */
- tpm_fd = open(TPM_DEVICE_PATH, O_RDWR);
+ device_path = getenv("TPM_DEVICE_PATH");
+ if (device_path == NULL) {
+ device_path = TPM_DEVICE_PATH;
+ }
+
+ tpm_fd = open(device_path, O_RDWR);
if (tpm_fd < 0) {
- error("cannot open TPM device %s: %s\n", TPM_DEVICE_PATH, strerror(errno));
+ error("cannot open TPM device %s: %s\n", device_path, strerror(errno));
}
}
« no previous file with comments | « no previous file | utility/tpm_init_temp_fix.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698