int main_v1_2(char version) { char *function = "Tspi_TPM_SetStatus-trans01"; TSS_HCONTEXT hContext; TSS_HTPM hTPM; TSS_RESULT result; TSS_HKEY hSRK, hSigningKey, hWrappingKey; print_begin_test( function ); result = connect_load_all(&hContext, &hSRK, &hTPM); if ( result != TSS_SUCCESS ) { print_error( "connect_load_all", (result) ); Tspi_Context_FreeMemory( hContext, NULL ); Tspi_Context_Close( hContext ); exit( result ); } result = Testsuite_Transport_Init(hContext, hSRK, hTPM, TRUE, FALSE, &hWrappingKey, &hSigningKey); if (result != TSS_SUCCESS) { print_error("Testsuite_Transport_Init", result); Tspi_Context_Close(hContext); exit(result); } //Get random number result = Tspi_TPM_SetStatus( hTPM, TSS_TPMSTATUS_SETOWNERINSTALL, TRUE ); if (result != TSS_SUCCESS) { print_error("Tspi_TPM_SetStatus", result); Tspi_Context_Close(hContext); exit(result); } result = Testsuite_Transport_Final(hContext, hSigningKey); if ( result != TSS_SUCCESS ) { if( !(checkNonAPI(result)) ) { print_error( function, result ); } else { print_error_nonapi( function, result ); } } else { print_success( function, result ); } print_end_test( function ); Tspi_Context_FreeMemory( hContext, NULL ); Tspi_Context_Close( hContext ); exit( result ); }
static int resetlock(TSS_HTPM hTPM) { TSS_RESULT ret; if (set_object_policy(hTPM, TSS_SECRET_MODE_POPUP, gettext("= TPM owner passphrase ="), 0, NULL)) return (ERR_FAIL); ret = Tspi_TPM_SetStatus(hTPM, TSS_TPMSTATUS_RESETLOCK, TRUE); if (ret) { print_error(ret, gettext("Reset Lock")); return (ERR_FAIL); } return (0); }
int main_v1_1( void ) { char *function = "Tspi_TPM_SetStatus02"; TSS_HCONTEXT hContext; TSS_HTPM hTPM; TSS_HTPM whTPM = -1; TSS_RESULT result; UINT32 exitCode = 0; print_begin_test( function ); // Create Context result = Tspi_Context_Create( &hContext ); if ( result != TSS_SUCCESS ) { print_error( "Tspi_Context_Create", result ); exit( result ); } // Connect to Context result = Tspi_Context_Connect( hContext, get_server(GLOBALSERVER) ); if ( result != TSS_SUCCESS ) { print_error( "Tspi_Context_Connect", result ); Tspi_Context_FreeMemory( hContext, NULL ); Tspi_Context_Close( hContext ); exit( result ); } // Retrieve TPM object of context result = Tspi_Context_GetTpmObject( hContext, &hTPM ); if ( result != TSS_SUCCESS ) { print_error( "Tspi_Context_GetTpmObject", result ); Tspi_Context_FreeMemory( hContext, NULL ); Tspi_Context_Close( hContext ); exit( result ); } //Get random number result = Tspi_TPM_SetStatus( whTPM, TSS_TPMSTATUS_SETOWNERINSTALL, TRUE ); if ( TSS_ERROR_CODE(result) != TSS_E_INVALID_HANDLE ) { if( !(checkNonAPI(result)) ) { print_error( function, result ); } else { print_error_nonapi( function, result ); } exitCode = result; } else { print_success( function, result ); } print_end_test( function ); Tspi_Context_FreeMemory( hContext, NULL ); Tspi_Context_Close( hContext ); exit( exitCode ); }