Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMMOSGH-89: Add missing FECF field parsing logic #115

Merged
merged 1 commit into from
May 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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