Home | History | Annotate | Download | only in tpm_lite
      1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
      2  * Use of this source code is governed by a BSD-style license that can be
      3  * found in the LICENSE file.
      4  */
      5 
      6 /* Shared code for tests.
      7  */
      8 
      9 #include "sysincludes.h"
     10 
     11 #include "tlcl.h"
     12 #include "tlcl_tests.h"
     13 
     14 const char* resilient_startup = NULL;
     15 
     16 uint32_t TlclStartupIfNeeded(void) {
     17   static char* null_getenv = "some string";   /* just a unique address */
     18   uint32_t result = TlclStartup();
     19   if (resilient_startup == NULL) {
     20     resilient_startup = getenv("TLCL_RESILIENT_STARTUP");
     21     if (resilient_startup == NULL) {
     22       resilient_startup = null_getenv;
     23     }
     24   }
     25   if (resilient_startup == null_getenv) {
     26     return result;
     27   }
     28   return result == TPM_E_INVALID_POSTINIT ? TPM_SUCCESS : result;
     29 }
     30