diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/tlcl.c | 10 | ||||
-rw-r--r-- | src/lib/tpm2_tlcl.c | 14 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/lib/tlcl.c b/src/lib/tlcl.c index ccf4e8004b..0a4706b164 100644 --- a/src/lib/tlcl.c +++ b/src/lib/tlcl.c @@ -14,6 +14,7 @@ * time. */ +#include <arch/early_variables.h> #include <assert.h> #include <string.h> #include <tpm_lite/tlcl.h> @@ -139,11 +140,20 @@ static uint32_t send(const uint8_t* command) { /* Exported functions. */ +static uint8_t tlcl_init_done CAR_GLOBAL; + uint32_t tlcl_lib_init(void) { + uint8_t done = car_get_var(tlcl_init_done); + if (done) + return VB2_SUCCESS; + if (tis_init()) return VB2_ERROR_UNKNOWN; if (tis_open()) return VB2_ERROR_UNKNOWN; + + car_set_var(tlcl_init_done, 1); + return VB2_SUCCESS; } diff --git a/src/lib/tpm2_tlcl.c b/src/lib/tpm2_tlcl.c index ecf0db6058..adc4c2e990 100644 --- a/src/lib/tpm2_tlcl.c +++ b/src/lib/tpm2_tlcl.c @@ -157,16 +157,22 @@ uint32_t tlcl_get_flags(uint8_t *disable, uint8_t *deactivated, return TPM_SUCCESS; } +static uint8_t tlcl_init_done CAR_GLOBAL; + +/* This function is called directly by vboot, uses vboot return types. */ uint32_t tlcl_lib_init(void) { - /* - * This function is called directly by vboot, uses vboot return - * types. - */ + uint8_t done = car_get_var(tlcl_init_done); + if (done) + return VB2_SUCCESS; + if (tis_init()) return VB2_ERROR_UNKNOWN; if (tis_open()) return VB2_ERROR_UNKNOWN; + + car_set_var(tlcl_init_done, 1); + return VB2_SUCCESS; } |