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/ |
| CRC-32 (IEEE 802.3) — one implementation for every integrity check. | |
| file | src/ |
| Wipe a buffer so the compiler cannot elide the clear. | |
Functions | |
| uint32_t | kleidos:: |
Fold len bytes into a running checksum. | |
| constexpr uint32_t | kleidos:: |
| Close a running checksum into the CRC-32 value. | |
| uint32_t | kleidos:: |
| CRC-32 of one buffer. | |
| void | kleidos:: |
Overwrite bytes bytes at data with zero, unconditionally. | |
Variables | |
| constexpr uint32_t | kleidos:: |
| Running value a checksum starts from. | |
Function Documentation
finish() #
uint32_t kleidos:: util:: crc32:: finish(uint32_t running)
constexprClose a running checksum into the CRC-32 value.
- Parameters
-
Name Direction Meaning running in Value 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
-
Name Direction Meaning data in Bytes to checksum; may be null when lenis 0.len in Number 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
-
Name Direction Meaning data out Start of the block; nullptr is a no-op. bytes in Number 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
-
Name Direction Meaning running in Value so far (kSeed for the first chunk). data in Bytes to fold in; may be null when lenis 0.len in Number of bytes.
- Returns
- The updated running value (not yet finished).