3131#include <stdio.h>
3232
3333
34+ #ifndef WOLFTPM2_NO_WRAPPER
35+
3436/******************************************************************************/
3537/* --- BEGIN TPM Key Import / Blob Example -- */
3638/******************************************************************************/
@@ -57,7 +59,7 @@ int TPM2_Keyimport_Example(void* userCtx, int argc, char *argv[])
5759 size_t fileSz = 0 ;
5860#endif
5961 const char * outputFile = "keyblob.bin" ;
60-
62+
6163 if (argc >= 2 ) {
6264 if (XSTRNCMP (argv [1 ], "-?" , 2 ) == 0 ||
6365 XSTRNCMP (argv [1 ], "-h" , 2 ) == 0 ||
@@ -110,7 +112,7 @@ int TPM2_Keyimport_Example(void* userCtx, int argc, char *argv[])
110112 (word32 )tpmSession .handle .hndl );
111113
112114 /* set session for authorization of the storage key */
113- rc = wolfTPM2_SetAuthSession (& dev , 1 , & tpmSession ,
115+ rc = wolfTPM2_SetAuthSession (& dev , 1 , & tpmSession ,
114116 (TPMA_SESSION_decrypt | TPMA_SESSION_encrypt | TPMA_SESSION_continueSession ));
115117 if (rc != 0 ) goto exit ;
116118 }
@@ -173,16 +175,23 @@ int TPM2_Keyimport_Example(void* userCtx, int argc, char *argv[])
173175}
174176
175177/******************************************************************************/
176- /* --- END TPM Timestamp Test -- */
178+ /* --- END TPM Key Import / Blob Example -- */
177179/******************************************************************************/
180+ #endif /* !WOLFTPM2_NO_WRAPPER */
178181
179182
180183#ifndef NO_MAIN_DRIVER
181184int main (int argc , char * argv [])
182185{
183- int rc ;
186+ int rc = NOT_COMPILED_IN ;
184187
188+ #ifndef WOLFTPM2_NO_WRAPPER
185189 rc = TPM2_Keyimport_Example (NULL , argc , argv );
190+ #else
191+ printf ("KeyImport code not compiled in\n" );
192+ (void )argc ;
193+ (void )argv ;
194+ #endif
186195
187196 return rc ;
188197}
0 commit comments