Skip to content

Commit 00efd1c

Browse files
authored
Merge pull request #29 from nasa/integration-candidate
tblcrctool Integration candidate: 2021-01-19
2 parents f21a641 + 9d0dedd commit 00efd1c

File tree

4 files changed

+54
-56
lines changed

4 files changed

+54
-56
lines changed

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ This lab application is a ground utility to generate binary table CRCs for cFS.
66

77
## Version Notes
88

9+
### Development Build: 1.2.0-rc1+dev9
10+
11+
- Documentation: Add `Security.md` with instructions on reporting vulnerabilities
12+
- Removes unimplemented CRC cases to eliminate static analysis warnings
13+
- See <https://github.com/nasa/tblCRCTool/pull/29>
14+
915
### Development Build: 1.2.0-rc1+dev3
1016

1117
- Use `sizeof()` instead of a hard coded value for the table file header size to keep this tool in sync if the size of the cFE file or table header should ever change.
1218
- Update version baseline to v1.2.0-rc1
1319
- Set REVISION number to 99 to indicate development version
14-
See <https://github.com/nasa/tblCRCTool/pull/25>
20+
- See <https://github.com/nasa/tblCRCTool/pull/25>
1521

1622
### Development Build: 1.1.0+dev7
1723

SECURITY.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
To report a vulnerability for the tblCRCTool subsystem please [submit an issue](https://github.com/nasa/tblCRCTool/issues/new/choose).
6+
7+
For general cFS vulnerabilities please [open a cFS framework issue](https://github.com/nasa/cfs/issues/new/choose) and see our [top-level security policy](https://github.com/nasa/cFS/security/policy).
8+
9+
In either case please use the "Bug Report" template and provide as much information as possible. Apply appropraite labels for each report. For security related reports, tag the issue with the "security" label.
10+
11+
## Additional Support
12+
13+
For additional support, email us at [email protected]. For help using OSAL and cFS, [subscribe to our mailing list](https://lists.nasa.gov/mailman/listinfo/cfs-community) that includes all the community members/users of the NASA core Flight Software (cFS) product line. The mailing list is used to communicate any information related to the cFS product such as current releases, bug findings and fixes, enhancement requests, community meeting notifications, sending out meeting minutes, etc.
14+
15+
If you wish to report a cybersecurity incident or concern please contact the NASA Security Operations Center either by phone at 1-877-627-2732 or via email address [email protected].

cfe_ts_crc.c

+31-54
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,25 @@
1616
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1717
** See the License for the specific language governing permissions and
1818
** limitations under the License.
19-
**
20-
** lro_ts_crc
21-
**
22-
** This program calculates the CRC of a given file using the same
23-
** algorithm as the LRO spacecraft cFE Table Services flight software uses.
24-
**
25-
** Inputs: One string containing the filename of the file to CRC.
26-
**
27-
**
28-
** Outputs: Prints to the terminal the filename, size, and CRC.
29-
** Returns the CRC.
30-
**
31-
** Author: Mike Blau, GSFC Code 582
32-
**
33-
** Date: 1/28/08
34-
**
35-
** Modified 4/24/08 MDB Added option to skip a specified number of header bytes
36-
** Modified 2/04/09 BDT Modified to compute cFE table services CS
37-
** Modified 4/01/09 STS Modified to always skip header (116 bytes)
38-
** Modified 4/01/09 STS Removed option to skip a specified number of header bytes
39-
** Modified 6/15/12 WFM Replaced the CRC Table with the table used in
40-
** CFE_ES_CalculateCRC
4119
*/
20+
21+
/*
22+
* This program calculates the CRC-16/ARC of a given table file.
23+
*
24+
* Algorithm:
25+
* - Name: CRC-16/ARC
26+
* - Polynomial: 0x8005
27+
* - Initialization: 0x0000
28+
* - Reflect Input/Output: true
29+
* - XorOut: 0x0000
30+
*
31+
* Inputs: One string containing the filename of the table file to CRC.
32+
*
33+
* Outputs: Prints to the terminal the filename, size, and CRC.
34+
* Returns the CRC.
35+
*
36+
* Author: Mike Blau, GSFC Code 582
37+
*/
4238
#include <stdio.h>
4339
#include <fcntl.h>
4440
#include <string.h>
@@ -49,25 +45,21 @@
4945

5046
/* These headers are needed for CFE_FS_Header_t and CFE_TBL_File_Hdr_t, respectively.
5147
* This uses the OSAL definition of fixed-width types, even thought this tool
52-
* is not using OSAL itself. */
48+
* is not using OSAL itself.
49+
*/
5350
#include "common_types.h"
5451
#include "cfe_fs_extern_typedefs.h"
5552
#include "cfe_tbl_extern_typedefs.h"
5653

57-
#define CFE_ES_CRC_8 1 /**< \brief CRC ( 8 bit additive - returns 32 bit total) (Currently not implemented) */
58-
#define CFE_ES_CRC_16 2 /**< \brief CRC (16 bit additive - returns 32 bit total) */
59-
#define CFE_ES_CRC_32 3 /**< \brief CRC (32 bit additive - returns 32 bit total) (Currently not implemented) */
60-
#define CFE_ES_DEFAULT_CRC CFE_ES_CRC_16 /**< \brief mission specific CRC type */
61-
6254
/*
6355
** Function Prologue
6456
**
65-
** Function: CFE_ES_CalculateCRC (taken directly from lro-cfe-4.2.1 delivery - 2/4/09)
57+
** Function: CalculateCRC (originated from lro-cfe-4.2.1 delivery - 2/4/09)
6658
**
6759
** Purpose: Perform a CRC calculation on a range of memory.
6860
**
6961
*/
70-
uint32 CFE_ES_CalculateCRC(void *DataPtr, uint32 DataLength, uint32 InputCRC, uint32 TypeCRC)
62+
uint32 CalculateCRC(void *DataPtr, uint32 DataLength, uint32 InputCRC)
7163
{
7264
int32 i;
7365
int16 Index;
@@ -96,33 +88,18 @@ uint32 CFE_ES_CalculateCRC(void *DataPtr, uint32 DataLength, uint32 InputCRC, ui
9688
0x4C80, 0x8C41, 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, 0x8201, 0x42C0, 0x4380, 0x8341,
9789
0x4100, 0x81C1, 0x8081, 0x4040};
9890

99-
switch (TypeCRC)
91+
Crc = (int16)(0xFFFF & InputCRC);
92+
BufPtr = (uint8 *)DataPtr;
93+
94+
for (i = 0; i < DataLength; i++, BufPtr++)
10095
{
101-
/* case CFE_ES_CRC_32: */
102-
/* CFE_ES_WriteToSysLog("CFE ES Calculate CRC32 not Implemented\n"); */
103-
/* break; */
104-
105-
case CFE_ES_CRC_16:
106-
Crc = (int16)(0xFFFF & InputCRC);
107-
BufPtr = (uint8 *)DataPtr;
108-
109-
for (i = 0; i < DataLength; i++, BufPtr++)
110-
{
111-
Index = ((Crc ^ *BufPtr) & 0x00FF);
112-
Crc = ((Crc >> 8) & 0x00FF) ^ CrcTable[Index];
113-
}
114-
break;
115-
116-
/* case CFE_ES_CRC_8: */
117-
/* CFE_ES_WriteToSysLog("CFE ES Calculate CRC8 not Implemented\n"); */
118-
/* break; */
119-
120-
default:
121-
break;
96+
Index = ((Crc ^ *BufPtr) & 0x00FF);
97+
Crc = ((Crc >> 8) & 0x00FF) ^ CrcTable[Index];
12298
}
99+
123100
return (Crc);
124101

125-
} /* End of CFE_ES_CalculateCRC() */
102+
}
126103

127104
int main(int argc, char **argv)
128105
{
@@ -158,7 +135,7 @@ int main(int argc, char **argv)
158135
while (done == 0)
159136
{
160137
readSize = read(fd, buffer, 100);
161-
fileCRC = CFE_ES_CalculateCRC(buffer, readSize, fileCRC, CFE_ES_CRC_16);
138+
fileCRC = CalculateCRC(buffer, readSize, fileCRC);
162139
fileSize += readSize;
163140
if (readSize != 100)
164141
done = 1;

cfe_ts_crc_version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
/*
3232
* Development Build Macro Definitions
3333
*/
34-
#define CFE_TS_CRC_BUILD_NUMBER 3 /*!< @brief Number of commits since baseline */
34+
#define CFE_TS_CRC_BUILD_NUMBER 9 /*!< @brief Number of commits since baseline */
3535
#define CFE_TS_CRC_BUILD_BASELINE \
3636
"v1.2.0+dev" /*!< @brief Development Build: git tag that is the base for the current */
3737

0 commit comments

Comments
 (0)