Skip to content

Commit

Permalink
Merge branch 'kmc'
Browse files Browse the repository at this point in the history
  • Loading branch information
jlucas9 committed Aug 16, 2023
2 parents d00dfbc + 8e36142 commit 00cc9f0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ static int32_t cryptography_validate_authentication(uint8_t* data_out, size_t le
printf("%02X", tmac[i]);
}
printf("\n");
free(tmac);
if (!tmac) free(tmac);

printf("Received MAC:\n\t");
for (uint32_t i = 0; i < mac_size; i ++){
Expand Down
12 changes: 6 additions & 6 deletions src/src_main/crypto_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ int32_t Crypto_TC_ApplySecurity_Cam(const uint8_t* p_in_frame, const uint16_t in
}
if (status != CRYPTO_LIB_SUCCESS)
{
free(aad);
if (!aad) free (aad);
return status; // Cryptography IF call failed, return.
}
}
Expand Down Expand Up @@ -752,7 +752,7 @@ int32_t Crypto_TC_ApplySecurity_Cam(const uint8_t* p_in_frame, const uint16_t in
#ifdef DEBUG
printf(KYEL "----- Crypto_TC_ApplySecurity END -----\n" RESET);
#endif
free(aad);
if (!aad) free (aad);
return status;
}

Expand Down Expand Up @@ -1148,7 +1148,7 @@ int32_t Crypto_TC_ProcessSecurity_Cam(uint8_t* ingest, int *len_ingest, TC_t* tc

if (status != CRYPTO_LIB_SUCCESS)
{
free(aad);
if (!aad) free (aad);
return status; // Cryptography IF call failed, return.
}

Expand All @@ -1159,15 +1159,15 @@ int32_t Crypto_TC_ProcessSecurity_Cam(uint8_t* ingest, int *len_ingest, TC_t* tc

if(status != CRYPTO_LIB_SUCCESS)
{
free(aad);
if (!aad) free (aad);
return status;
}

// Only save the SA (IV/ARSN) if checking the anti-replay counter; Otherwise we don't update.
status = sadb_routine->sadb_save_sa(sa_ptr);
if(status != CRYPTO_LIB_SUCCESS)
{
free(aad);
if (!aad) free (aad);
return status;
}
}
Expand All @@ -1190,7 +1190,7 @@ int32_t Crypto_TC_ProcessSecurity_Cam(uint8_t* ingest, int *len_ingest, TC_t* tc
{
status = Crypto_Process_Extended_Procedure_Pdu(tc_sdls_processed_frame, ingest);
}
free(aad);
if (!aad) free (aad);
return status;
}

Expand Down
2 changes: 1 addition & 1 deletion util/src_util/standalone.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ void* crypto_standalone_tc_apply(void* sock)
memset(tc_apply_in, 0x00, sizeof(tc_apply_in));
tc_in_len = 0;
tc_out_len = 0;
free(tc_out_ptr);
if (!tc_out_ptr) free(tc_out_ptr);
#ifdef CRYPTO_STANDALONE_TC_APPLY_DEBUG
printf("\n");
#endif
Expand Down

0 comments on commit 00cc9f0

Please sign in to comment.