Kleidos API Search

In development. It changes without notice.

Topic

Utilities

Text, lists and queues that never use the heap, a checksum, and a wipe the compiler cannot drop.

It is the lowest module: its files include the standard library and each other and nothing else, so every module and every test can use it.

Topic Holds
Safe Strings Copies, comparisons and searches of C text that cannot overflow
Fixed-Capacity Containers Text, lists, queues and functions in a fixed space
This topic The CRC-32 checksum, and the wipe
See also
Platform Abstraction

Topics

Safe Strings
Copies, comparisons and searches of C text that stay inside the space they are given.
Fixed-Capacity Containers
Text, lists, queues and functions that keep what they hold inside themselves and never allocate.

Files

file src/util/crc32.h
CRC-32 (IEEE 802.3) — one implementation for every integrity check.
file src/util/secure_zero.h
Wipe a buffer so the compiler cannot elide the clear.

Functions

uint32_tkleidos::util::crc32::update (uint32_t running, const uint8_t *data, size_t len)
Fold len bytes into a running checksum.
constexpr uint32_tkleidos::util::crc32::finish (uint32_t running)
Close a running checksum into the CRC-32 value.
uint32_tkleidos::util::crc32::of (const uint8_t *data, size_t len)
CRC-32 of one buffer.
voidkleidos::util::secureZero (void *data, size_t bytes)
Overwrite bytes bytes at data with zero, unconditionally.

Variables

constexpr uint32_tkleidos::util::crc32::kSeed
Running value a checksum starts from.

Function Documentation

finish() #

uint32_t kleidos::util::crc32::finish(uint32_t running)
constexpr

Close a running checksum into the CRC-32 value.

Parameters
NameDirectionMeaning
runninginValue after the last update.
Returns
The finished CRC-32.

of() #

uint32_t kleidos::util::crc32::of(const uint8_t * data, size_t len)

CRC-32 of one buffer.

Parameters
NameDirectionMeaning
datainBytes to checksum; may be null when len is 0.
leninNumber of bytes.
Returns
The finished CRC-32.

secureZero() #

void kleidos::util::secureZero(void * data, size_t bytes)

Overwrite bytes bytes at data with zero, unconditionally.

Parameters
NameDirectionMeaning
dataoutStart of the block; nullptr is a no-op.
bytesinNumber of bytes to clear.

update() #

uint32_t kleidos::util::crc32::update(uint32_t running, const uint8_t * data, size_t len)

Fold len bytes into a running checksum.

Parameters
NameDirectionMeaning
runninginValue so far (kSeed for the first chunk).
datainBytes to fold in; may be null when len is 0.
leninNumber of bytes.
Returns
The updated running value (not yet finished).