Skip to content

Commit

Permalink
[#230] Pull request fixes. Single return statements.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbrown6 committed Apr 4, 2024
1 parent 826c275 commit 6588b79
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/core/crypto_tm.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ int32_t Crypto_TM_Sanity_Check(uint8_t* pTfBuffer)
// Passed a null, return an error
if (!pTfBuffer)
{
return CRYPTO_LIB_ERR_NULL_BUFFER;
return status;
status = CRYPTO_LIB_ERR_NULL_BUFFER;
}

if ((crypto_config.init_status == UNITIALIZED) || (mc_if == NULL) || (sa_if == NULL))
if ((status == CRYPTO_LIB_SUCCESS) && ((crypto_config.init_status == UNITIALIZED) || (mc_if == NULL) || (sa_if == NULL)))
{
printf(KRED "ERROR: CryptoLib Configuration Not Set! -- CRYPTO_LIB_ERR_NO_CONFIG, Will Exit\n" RESET);
status = CRYPTO_LIB_ERR_NO_CONFIG;
// Can't mc_log since it's not configured
return status; // return immediately so a NULL crypto_config is not dereferenced later
}
return status;
}
Expand Down Expand Up @@ -81,8 +79,10 @@ int32_t Crypto_TM_Determine_SA_Service_Type(uint8_t* sa_service_type, SecurityAs
// Leaving for now as it would be cleaner in SA to have an association enum returned I believe
printf(KRED "Error: SA Service Type is not defined! \n" RESET);
status = CRYPTO_LIB_ERROR;
}
if(status != CRYPTO_LIB_SUCCESS)
{
mc_if->mc_log(status);
return status;
}
return status;
}
Expand Down

0 comments on commit 6588b79

Please sign in to comment.