@@ -816,7 +816,7 @@ static int readKeyBlob(const char* filename, WOLFTPM2_KEYBLOB* key)
816816 WLOG (WS_LOG_DEBUG , "Leaving readKeyBlob(), rc = %d" , rc );
817817 return rc ;
818818}
819-
819+ // make rc check cleanup at end and get rid of uneeded returns
820820static int wolfSSH_TPM_InitKey (WOLFTPM2_DEV * dev , const char * name ,
821821 WOLFTPM2_KEY * pTpmKey )
822822{
@@ -832,7 +832,7 @@ static int wolfSSH_TPM_InitKey(WOLFTPM2_DEV* dev, const char* name,
832832 #ifdef DEBUG_WOLFSSH
833833 printf ("TPM 2.0 Device initialization failed\n" );
834834 #endif
835- return WOLFSSH_TPM_FAILED_INIT ;
835+ return WS_ERROR ;
836836 }
837837
838838 /* TPM 2.0 keys live under a Primary Key, acquire such key */
@@ -841,7 +841,7 @@ static int wolfSSH_TPM_InitKey(WOLFTPM2_DEV* dev, const char* name,
841841 #ifdef DEBUG_WOLFSSH
842842 printf ("Acquiring a Primary TPM 2.0 Key failed\n" );
843843 #endif
844- return WOLFSSH_TPM_FAILED_LOAD_PRIMARY ;
844+ return WS_BAD_ARGUMENT ;
845845 }
846846
847847 /* Load the TPM 2.0 key blob from disk */
@@ -850,7 +850,7 @@ static int wolfSSH_TPM_InitKey(WOLFTPM2_DEV* dev, const char* name,
850850 #ifdef DEBUG_WOLFSSH
851851 printf ("Reading key blob from disk failed\n" );
852852 #endif
853- return WOLFSSH_TPM_FAILED_READ_KEYBLOB ;
853+ return WS_DECRYPT_E ;
854854 }
855855
856856 /* TODO: workaround until password can be supplied */
@@ -866,7 +866,7 @@ static int wolfSSH_TPM_InitKey(WOLFTPM2_DEV* dev, const char* name,
866866 #ifdef DEBUG_WOLFSSH
867867 printf ("wolfTPM2_LoadKey failed\n" );
868868 #endif
869- return WOLFSSH_TPM_FAILED_LOAD_KEY ;
869+ return WS_BAD_ARGUMENT ;
870870 }
871871 #ifdef DEBUG_WOLFSSH
872872 printf ("Loaded key to 0x%x\n" , (word32 )tpmKeyBlob .handle .hndl );
@@ -880,7 +880,7 @@ static int wolfSSH_TPM_InitKey(WOLFTPM2_DEV* dev, const char* name,
880880 #ifdef DEBUG_WOLFSSH
881881 printf ("Exporting TPM key failed\n" );
882882 #endif
883- return WOLFSSH_TPM_FAILED_EXPORT_KEY ;
883+ return WS_MEMORY_E ;
884884 }
885885
886886 /* Read public key from the buffer and convert the key to OpenSSH format */
@@ -891,7 +891,7 @@ static int wolfSSH_TPM_InitKey(WOLFTPM2_DEV* dev, const char* name,
891891 #ifdef DEBUG_WOLFSSH
892892 printf ("Reading public key failed returned: %d\n" , rc );
893893 #endif
894- return WOLFSSH_TPM_FAILED_READ_PUBLIC_KEY ;
894+ return WS_PUBKEY_REJECTED_E ;
895895 }
896896 userPublicKey = p ;
897897
0 commit comments