@@ -87,13 +87,20 @@ void CF_CFDP_R2_Reset(CF_Transaction_t *txn)
8787CFE_Status_t CF_CFDP_R_CheckCrc (CF_Transaction_t *txn, U32 expected_crc)
8888{
8989 CFE_Status_t ret = CFE_SUCCESS;
90- CF_CRC_Finalize (&txn->crc );
91- if (txn->crc .result != expected_crc)
90+ U32 crc_result;
91+
92+ // The F' version does not have an equivelent finalize call as it
93+ // - Never stores a partial word internally
94+ // - Never needs to "flush" anything
95+ // - Always accounts for padding at update time
96+ // CF_CRC_Finalize(&txn->crc);
97+ crc_result = txn->crc .getValue ();
98+ if (crc_result != expected_crc)
9299 {
93100 CFE_EVS_SendEvent (CF_CFDP_R_CRC_ERR_EID, CFE_EVS_EventType_ERROR,
94101 " CF R%d(%lu:%lu): CRC mismatch for R trans. got 0x%08lx expected 0x%08lx" ,
95102 (txn->state == CF_TxnState_R2), (unsigned long )txn->history ->src_eid ,
96- (unsigned long )txn->history ->seq_num , (unsigned long )txn-> crc . result ,
103+ (unsigned long )txn->history ->seq_num , (unsigned long )crc_result ,
97104 (unsigned long )expected_crc);
98105 ++CF_AppData.hk .Payload .channel_hk [txn->chan_num ].counters .fault .crc_mismatch ;
99106 ret = CF_ERROR;
@@ -386,7 +393,7 @@ void CF_CFDP_R1_SubstateRecvFileData(CF_Transaction_t *txn, CF_Logical_PduBuffer
386393 if (ret == CFE_SUCCESS)
387394 {
388395 /* class 1 digests CRC */
389- CF_CRC_Digest (& txn->crc , ph->int_header .fd .data_ptr , ph->int_header .fd .data_len );
396+ txn->crc . update (ph-> int_header . fd . data_ptr , ph->int_header .fd .offset , ph->int_header .fd .data_len );
390397 }
391398 else
392399 {
@@ -631,7 +638,7 @@ CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *txn)
631638
632639 if (txn->state_data .receive .r2 .rx_crc_calc_bytes == 0 )
633640 {
634- CF_CRC_Start (& txn->crc );
641+ txn->crc = CFDP::Checksum ( 0 );
635642 }
636643
637644 while ((count_bytes < CF_AppData.config_table ->rx_crc_calc_bytes_per_wakeup ) &&
@@ -677,7 +684,7 @@ CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *txn)
677684 break ;
678685 }
679686
680- CF_CRC_Digest (& txn->crc , buf , read_size);
687+ txn->crc . update (buf, txn-> state_data . receive . r2 . rx_crc_calc_bytes , read_size);
681688 txn->state_data .receive .r2 .rx_crc_calc_bytes += read_size;
682689 txn->state_data .receive .cached_pos = txn->state_data .receive .r2 .rx_crc_calc_bytes ;
683690 count_bytes += read_size;
0 commit comments