rev180: Make TpmSetFailureMode static

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2023-12-13 16:53:53 -05:00 committed by Stefan Berger
parent 50b135e2b4
commit f66e894b82
2 changed files with 38 additions and 47 deletions

View File

@ -191,6 +191,44 @@ LIB_EXPORT void SetForceFailureMode(void)
}
#endif /* libtpms added */
/* libtpms added begin */
static void
TpmSetFailureMode(
#if FAIL_TRACE
const char *function,
int line,
#endif
int code
)
{
// Save the values that indicate where the error occurred.
// On a 64-bit machine, this may truncate the address of the string
// of the function name where the error occurred.
#if FAIL_TRACE
s_failFunction = *(UINT32 *)function;
s_failLine = line;
#else
s_failFunction = (UINT32)0;
s_failLine = 0;
#endif
s_failCode = code;
TPMLIB_LogTPM2Error("Entering failure mode; code: %d"
#if FAIL_TRACE
", location: %s line %d"
#endif
"\n", s_failCode
#if FAIL_TRACE
, function, s_failLine
#endif
);
// We are in failure mode
g_inFailureMode = TRUE;
}
/* libtpms added end */
/* 9.17.4.2 TpmLogFailure() */
/* This function saves the failure values when the code will continue to operate. It if similar to
TpmFail() but returns to the caller. The assumption is that the caller will propagate a failure
@ -290,43 +328,6 @@ NORETURN void TpmFail(
_plat__Fail();
}
/* libtpms added begin */
void
TpmSetFailureMode(
#if FAIL_TRACE
const char *function,
int line,
#endif
int code
)
{
// Save the values that indicate where the error occurred.
// On a 64-bit machine, this may truncate the address of the string
// of the function name where the error occurred.
#if FAIL_TRACE
s_failFunction = *(UINT32 *)function;
s_failLine = line;
#else
s_failFunction = (UINT32)0;
s_failLine = 0;
#endif
s_failCode = code;
TPMLIB_LogTPM2Error("Entering failure mode; code: %d"
#if FAIL_TRACE
", location: %s line %d"
#endif
"\n", s_failCode
#if FAIL_TRACE
, function, s_failLine
#endif
);
// We are in failure mode
g_inFailureMode = TRUE;
}
/* libtpms added end */
//*** TpmFailureMode(
// This function is called by the interface code when the platform is in failure
// mode.

View File

@ -65,7 +65,6 @@
#ifndef _TPM_FAIL_FP_H_
#define _TPM_FAIL_FP_H_
#include "BaseTypes.h"
#if 0 /* libtpms added */
//*** SetForceFailureMode()
@ -96,15 +95,6 @@ NORETURN void TpmFail(
#endif
int failureCode);
void
TpmSetFailureMode(
#if FAIL_TRACE /* libtpms added end */
const char *function,
int line,
#endif
int code
);
//*** TpmFailureMode(
// This function is called by the interface code when the platform is in failure
// mode.