|
BSL v1.1.1 - 19.g31939de
AMMOS Bundle Protocol Security Library (BSL)
|
Declarations for BPv7 block CRC handling. More...
Include dependency graph for crc.c:Data Structures | |
| struct | mock_bpa_crc_desc_t |
Functions | |
| static void | mock_bpa_crc_crc16_init (void *state) |
| static void | mock_bpa_crc_crc16_update (void *state, UsefulBufC data) |
| static void | mock_bpa_crc_crc16_finalize (void *state, uint8_t out[MOCK_BPA_CRC_CRC16_LEN]) |
| static void | mock_bpa_crc_crc32c_init (void *state) |
| static void | mock_bpa_crc_crc32c_update (void *state, UsefulBufC data) |
| static void | mock_bpa_crc_crc32c_finalize (void *state, uint8_t out[MOCK_BPA_CRC_CRC32C_LEN]) |
| static const mock_bpa_crc_desc_t * | get_desc (BSL_BundleCRCType_e crc_type) |
| void | mock_bpa_crc_oneshot (uint8_t *out, UsefulBufC data, BSL_BundleCRCType_e crc_type) |
| Direct CRC function for testing. | |
| UsefulBufC | mock_bpa_crc_zero (BSL_BundleCRCType_e crc_type) |
| Get an empty placeholder for a CRC value. | |
| void | mock_bpa_crc_apply (UsefulBuf buf, size_t begin, size_t end, BSL_BundleCRCType_e crc_type) |
| Apply a CRC function to an encoded block. | |
| bool | mock_bpa_crc_check (UsefulBufC buf, size_t begin, size_t end, BSL_BundleCRCType_e crc_type, size_t got_len) |
| Check the CRC of an encoded block. | |
Variables | |
| static const mock_bpa_crc_desc_t | mock_bpa_crc_desc_crc16 |
| static const mock_bpa_crc_desc_t | mock_bpa_crc_desc_crc32c |
Declarations for BPv7 block CRC handling.
|
static |
References BSL_BUNDLECRCTYPE_16, BSL_BUNDLECRCTYPE_32, BSL_BUNDLECRCTYPE_NONE, BSL_LOG_CRIT, mock_bpa_crc_desc_crc16, and mock_bpa_crc_desc_crc32c.
Referenced by mock_bpa_crc_apply(), mock_bpa_crc_check(), and mock_bpa_crc_oneshot().
| void mock_bpa_crc_apply | ( | UsefulBuf | buf, |
| size_t | begin, | ||
| size_t | end, | ||
| BSL_BundleCRCType_e | crc_type | ||
| ) |
Apply a CRC function to an encoded block.
| buf | The buffer holding the encoded block. The buffer contents will be modified to hold the correct CRC value. |
| begin | The start of the block array |
| end | The end of the block array |
| crc_type | The needed CRC type. |
References buf, mock_bpa_crc_desc_t::finalize, get_desc(), mock_bpa_crc_desc_t::init, mock_bpa_crc_zero(), mock_bpa_crc_desc_t::out_size, mock_bpa_crc_desc_t::state_size, and mock_bpa_crc_desc_t::update.
Referenced by bsl_mock_encode_canonical(), and bsl_mock_encode_primary().
| bool mock_bpa_crc_check | ( | UsefulBufC | buf, |
| size_t | begin, | ||
| size_t | end, | ||
| BSL_BundleCRCType_e | crc_type, | ||
| size_t | got_len | ||
| ) |
Check the CRC of an encoded block.
This will manipulate the block to clear its current value.
| buf | The buffer holding the encoded block. |
| begin | The start of the block array |
| end | The end of the block array |
| crc_type | The needed CRC type. |
| got_len | The actual byte string length decoded. |
References BSL_LOG_ERR, buf, mock_bpa_crc_desc_t::finalize, get_desc(), mock_bpa_crc_desc_t::init, mock_bpa_crc_zero(), mock_bpa_crc_desc_t::out_size, mock_bpa_crc_desc_t::state_size, and mock_bpa_crc_desc_t::update.
Referenced by bsl_mock_decode_canonical(), and bsl_mock_decode_primary().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| void mock_bpa_crc_oneshot | ( | uint8_t * | out, |
| UsefulBufC | data, | ||
| BSL_BundleCRCType_e | crc_type | ||
| ) |
Direct CRC function for testing.
| [out] | out | The buffer to write into. Its size must be appropriate for the crc_type. The written value will be BPv7-compatible CRC value in network byte order. |
| [in] | data | The data to read. |
| crc_type | The needed CRC type. |
References mock_bpa_crc_desc_t::finalize, get_desc(), mock_bpa_crc_desc_t::init, mock_bpa_crc_desc_t::state_size, and mock_bpa_crc_desc_t::update.
Referenced by test_mock_bpa_crc_crc16(), and test_mock_bpa_crc_crc32c().
| UsefulBufC mock_bpa_crc_zero | ( | BSL_BundleCRCType_e | crc_type | ) |
Get an empty placeholder for a CRC value.
| crc_type | The needed CRC type. |
References BSL_BUNDLECRCTYPE_16, BSL_BUNDLECRCTYPE_32, BSL_BUNDLECRCTYPE_NONE, MOCK_BPA_CRC_CRC16_LEN, and MOCK_BPA_CRC_CRC32C_LEN.
Referenced by bsl_mock_encode_canonical(), bsl_mock_encode_primary(), mock_bpa_crc_apply(), and mock_bpa_crc_check().
|
static |
Referenced by get_desc().
|
static |
Referenced by get_desc().