Skip to content

Commit

Permalink
Merge pull request #115 from nasa/AMMOSGH-89
Browse files Browse the repository at this point in the history
AMMOSGH-89: Add missing FECF field parsing logic
  • Loading branch information
IbraheemYSaleh committed May 10, 2022
2 parents 1da6391 + 7f837f0 commit 6e9d14a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/src_main/crypto_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,13 +787,15 @@ int32_t Crypto_TC_ProcessSecurity(uint8_t* ingest, int *len_ingest, TC_t* tc_sdl
segment_hdr_len = 0;
}

// Check FECF
// Parse & Check FECF
if (current_managed_parameters->has_fecf == TC_HAS_FECF)
{
tc_sdls_processed_frame->tc_sec_trailer.fecf = (((ingest[tc_sdls_processed_frame->tc_header.fl - 1] << 8) & 0xFF00) |
(ingest[tc_sdls_processed_frame->tc_header.fl] & 0x00FF));

if (crypto_config->crypto_check_fecf == TC_CHECK_FECF_TRUE)
{
uint16_t received_fecf = (((ingest[tc_sdls_processed_frame->tc_header.fl - 1] << 8) & 0xFF00) |
(ingest[tc_sdls_processed_frame->tc_header.fl] & 0x00FF));
uint16_t received_fecf = tc_sdls_processed_frame->tc_sec_trailer.fecf;
// Calculate our own
uint16_t calculated_fecf = Crypto_Calc_FECF(ingest, *len_ingest - 2);
// Compare
Expand Down

0 comments on commit 6e9d14a

Please sign in to comment.