Skip to content

Commit 6588b79

Browse files
committed
[#230] Pull request fixes. Single return statements.
1 parent 826c275 commit 6588b79

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/core/crypto_tm.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,14 @@ int32_t Crypto_TM_Sanity_Check(uint8_t* pTfBuffer)
3535
// Passed a null, return an error
3636
if (!pTfBuffer)
3737
{
38-
return CRYPTO_LIB_ERR_NULL_BUFFER;
39-
return status;
38+
status = CRYPTO_LIB_ERR_NULL_BUFFER;
4039
}
4140

42-
if ((crypto_config.init_status == UNITIALIZED) || (mc_if == NULL) || (sa_if == NULL))
41+
if ((status == CRYPTO_LIB_SUCCESS) && ((crypto_config.init_status == UNITIALIZED) || (mc_if == NULL) || (sa_if == NULL)))
4342
{
4443
printf(KRED "ERROR: CryptoLib Configuration Not Set! -- CRYPTO_LIB_ERR_NO_CONFIG, Will Exit\n" RESET);
4544
status = CRYPTO_LIB_ERR_NO_CONFIG;
4645
// Can't mc_log since it's not configured
47-
return status; // return immediately so a NULL crypto_config is not dereferenced later
4846
}
4947
return status;
5048
}
@@ -81,8 +79,10 @@ int32_t Crypto_TM_Determine_SA_Service_Type(uint8_t* sa_service_type, SecurityAs
8179
// Leaving for now as it would be cleaner in SA to have an association enum returned I believe
8280
printf(KRED "Error: SA Service Type is not defined! \n" RESET);
8381
status = CRYPTO_LIB_ERROR;
82+
}
83+
if(status != CRYPTO_LIB_SUCCESS)
84+
{
8485
mc_if->mc_log(status);
85-
return status;
8686
}
8787
return status;
8888
}

0 commit comments

Comments
 (0)