58 UsefulBufC blk_enc = { (uint8_t *)buf.ptr + begin, end - begin };
60 uint8_t *endptr = (uint8_t *)blk_enc.ptr + blk_enc.len;
66 uint16_t *crc_enc = (uint16_t *)endptr - 1;
68 const uint16_t crc_val = bp_crc16(blk_enc);
70 *crc_enc = htons(crc_val);
75 uint32_t *crc_enc = (uint32_t *)endptr - 1;
77 const uint32_t crc_val = bp_crc32(blk_enc);
79 *crc_enc = htonl(crc_val);
101 UsefulBufC blk_enc = { (uint8_t *)buf.ptr + begin, end - begin };
103 const uint8_t *endptr = (uint8_t *)blk_enc.ptr + blk_enc.len;
110 const uint16_t *crc_enc = (uint16_t *)endptr - 1;
112 const uint16_t orig_val = ntohs(*crc_enc);
113 const uint16_t crc_val = bp_crc16(blk_enc);
114 same = (crc_val == orig_val);
119 const uint32_t *crc_enc = (uint32_t *)endptr - 1;
121 const uint32_t orig_val = ntohs(*crc_enc);
123 const uint16_t crc_val = bp_crc32(blk_enc);
124 same = (crc_val == orig_val);
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)
Check the CRC of an encoded block.