1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /*********************************************************************** 3 * Copyright (c) 2017-2018, Intel Corporation 4 * 5 * All rights reserved. 6 ***********************************************************************/ 7 #ifdef HAVE_CONFIG_H 8 #include <config.h> 9 #endif 10 11 #include <inttypes.h> 12 13 #define LOGMODULE test 14 #include "util/log.h" 15 #include "sapi-util.h" 16 #include "test.h" 17 18 int test_invoke(TSS2_SYS_CONTEXT * sapi_context)19test_invoke (TSS2_SYS_CONTEXT *sapi_context) 20 { 21 TSS2_RC rc; 22 TPM2_HANDLE handle; 23 24 rc = create_primary_rsa_2048_aes_128_cfb (sapi_context, &handle); 25 if (rc != TSS2_RC_SUCCESS) { 26 LOG_ERROR("CreatePrimary failed with 0x%"PRIx32, rc); 27 return 1; 28 } 29 30 rc = Tss2_Sys_FlushContext(sapi_context, handle); 31 if (rc != TSS2_RC_SUCCESS) { 32 LOG_ERROR("Tss2_Sys_FlushContext failed with 0x%"PRIx32, rc); 33 return 99; /* fatal error */ 34 } 35 36 return 0; 37 } 38