HKDS: Heirarchal Key Derivation System 1.0.0.2 (A2)
A fast post-quantum secure replacement for DUKPT
|
This file contains the HKDS queue definitions. More...
Go to the source code of this file.
Data Structures | |
struct | hkds_queue_state |
Contains the queue context state. More... | |
struct | hkds_message_queue_state |
Contains the HKDS message queue context state. More... | |
Typedefs | |
typedef HKDS_EXPORT_API struct hkds_queue_state | hkds_queue_state |
typedef struct hkds_message_queue_state | hkds_message_queue_state |
Functions | |
HKDS_EXPORT_API void | hkds_message_queue_destroy (hkds_message_queue_state *ctx) |
Resets the queue context state. | |
HKDS_EXPORT_API void | hkds_message_queue_flush (hkds_message_queue_state *ctx, uint8_t *output) |
Flushes the contents of the queue to a byte array. | |
HKDS_EXPORT_API void | hkds_message_queue_initialize (hkds_message_queue_state *ctx, size_t depth, size_t width, uint8_t *tag) |
Initializes the queue state context. | |
HKDS_EXPORT_API void | hkds_message_queue_pop (hkds_message_queue_state *ctx, uint8_t *output, size_t outlen) |
Removes an item from the queue and copies it to the output array. | |
HKDS_EXPORT_API void | hkds_message_queue_push (hkds_message_queue_state *ctx, const uint8_t *inpput, size_t inplen) |
Adds an item to the queue. | |
HKDS_EXPORT_API bool | hkds_message_queue_full (const hkds_message_queue_state *ctx) |
Checks if the queue is full. | |
HKDS_EXPORT_API bool | hkds_message_queue_empty (const hkds_message_queue_state *ctx) |
Checks if the queue is empty. | |
HKDS_EXPORT_API size_t | hkds_message_queue_count (const hkds_message_queue_state *ctx) |
Returns the number of items in the queue. | |
HKDS_EXPORT_API size_t | hkds_message_queue_extract_block_x8 (hkds_message_queue_state *ctx, uint8_t output[HKDS_CACHX8_DEPTH][HKDS_MESSAGE_SIZE]) |
Exports a block of 8 messages to a 2-dimensional message queue. | |
HKDS_EXPORT_API size_t | hkds_message_queue_extract_block_x64 (hkds_message_queue_state *ctx, uint8_t output[HKDS_PARALLEL_DEPTH][HKDS_CACHX8_DEPTH][HKDS_MESSAGE_SIZE]) |
Exports 8 slots (8 blocks of messages) to a 3-dimensional message queue. | |
HKDS_EXPORT_API size_t | hkds_message_queue_extract_stream (hkds_message_queue_state *ctx, uint8_t *stream, size_t items) |
Serializes a set of messages from the queue to a linear array. | |
This file contains the HKDS queue definitions.
This header defines the constants, structures, and function prototypes for managing the HKDS message queue. The queue is used to store, manage, and export messages within the HKDS system. It provides functionality for initializing the queue, adding and removing items, checking the queue status, and exporting blocks or streams of messages.
HKDS_EXPORT_API size_t hkds_message_queue_count | ( | const hkds_message_queue_state * | ctx | ) |
Returns the number of items in the queue.
Retrieves the current count of items stored in the message queue.
ctx | [in] The message queue state context. |
HKDS_EXPORT_API void hkds_message_queue_destroy | ( | hkds_message_queue_state * | ctx | ) |
Resets the queue context state.
This function destroys the message queue context by clearing and freeing all allocated memory, resetting internal counters, and clearing associated tags.
ctx | [in,out] The message queue state context. |
HKDS_EXPORT_API bool hkds_message_queue_empty | ( | const hkds_message_queue_state * | ctx | ) |
Checks if the queue is empty.
Returns true
if there are no items in the queue.
ctx | [in] The message queue state context. |
true
if the queue is empty; otherwise, false
. HKDS_EXPORT_API size_t hkds_message_queue_extract_block_x64 | ( | hkds_message_queue_state * | ctx, |
uint8_t | output[HKDS_PARALLEL_DEPTH][HKDS_CACHX8_DEPTH][HKDS_MESSAGE_SIZE] ) |
Exports 8 slots (8 blocks of messages) to a 3-dimensional message queue.
This function extracts messages from the queue and arranges them in a 3D array with dimensions [HKDS_PARALLEL_DEPTH][HKDS_CACHX8_DEPTH][HKDS_MESSAGE_SIZE].
ctx | [in,out] The message queue state context. |
output | [out] A 3-dimensional array that will receive the exported messages. |
HKDS_EXPORT_API size_t hkds_message_queue_extract_block_x8 | ( | hkds_message_queue_state * | ctx, |
uint8_t | output[HKDS_CACHX8_DEPTH][HKDS_MESSAGE_SIZE] ) |
Exports a block of 8 messages to a 2-dimensional message queue.
This function extracts a block of 8 messages from the queue and stores them in a 2D array. The output array should have dimensions [HKDS_CACHX8_DEPTH][HKDS_MESSAGE_SIZE].
ctx | [in,out] The message queue state context. |
output | [out] A 2-dimensional array that will receive the exported messages. |
HKDS_EXPORT_API size_t hkds_message_queue_extract_stream | ( | hkds_message_queue_state * | ctx, |
uint8_t * | stream, | ||
size_t | items ) |
Serializes a set of messages from the queue to a linear array.
This function extracts a specified number of messages from the queue and serializes them into a linear byte array.
ctx | [in,out] The message queue state context. |
stream | [out] The array that will receive the serialized messages. |
items | [in] The number of messages to export. |
HKDS_EXPORT_API void hkds_message_queue_flush | ( | hkds_message_queue_state * | ctx, |
uint8_t * | output ) |
Flushes the contents of the queue to a byte array.
This function copies all items currently in the queue to the provided output array, then clears the queue and resets its state.
ctx | [in,out] The message queue state context. |
output | [out] The byte array that will receive the flushed queue items. |
HKDS_EXPORT_API bool hkds_message_queue_full | ( | const hkds_message_queue_state * | ctx | ) |
Checks if the queue is full.
Returns true
if the number of items in the queue has reached the maximum depth.
ctx | [in] The message queue state context. |
true
if the queue is full; otherwise, false
. HKDS_EXPORT_API void hkds_message_queue_initialize | ( | hkds_message_queue_state * | ctx, |
size_t | depth, | ||
size_t | width, | ||
uint8_t * | tag ) |
Initializes the queue state context.
This function allocates and initializes the internal structures of the message queue with the specified depth, width, and associated tag.
ctx | [in,out] The message queue state context. |
depth | [in] The maximum number of items the queue can hold. |
width | [in] The maximum byte length of each queue item. |
tag | [in] Pointer to the tag associated with the message queue. |
HKDS_EXPORT_API void hkds_message_queue_pop | ( | hkds_message_queue_state * | ctx, |
uint8_t * | output, | ||
size_t | outlen ) |
Removes an item from the queue and copies it to the output array.
This function removes the first item from the queue, copies its data to the provided output array, and shifts the remaining items forward in the queue.
ctx | [in,out] The message queue state context. |
output | [out] The output array where the removed item will be stored. |
outlen | [in] The length (in bytes) of the output array. |
HKDS_EXPORT_API void hkds_message_queue_push | ( | hkds_message_queue_state * | ctx, |
const uint8_t * | inpput, | ||
size_t | inplen ) |
Adds an item to the queue.
This function adds a new item to the message queue if space is available.
ctx | [in,out] The message queue state context. |
inpput | [in] The input array containing the data to be added. |
inplen | [in] The length (in bytes) of the input data. |