QSC Post Quantum Cryptographic Library 1.0.0.6c (A6)
A post quantum secure library written in Ansi C
 
Loading...
Searching...
No Matches
list.h
Go to the documentation of this file.
1/*
2 * 2025 Quantum Resistant Cryptographic Solutions Corporation
3 * All Rights Reserved.
4 *
5 * NOTICE: This software and all accompanying materials are the exclusive
6 * property of Quantum Resistant Cryptographic Solutions Corporation (QRCS).
7 * The intellectual and technical concepts contained within this implementation
8 * are proprietary to QRCS and its authorized licensors and are protected under
9 * applicable U.S. and international copyright, patent, and trade secret laws.
10 *
11 * CRYPTOGRAPHIC STANDARDS:
12 * - This software includes implementations of cryptographic algorithms such as
13 * SHA3, AES, and others. These algorithms are public domain or standardized
14 * by organizations such as NIST and are NOT the property of QRCS.
15 * - However, all source code, optimizations, and implementations in this library
16 * are original works of QRCS and are protected under this license.
17 *
18 * RESTRICTIONS:
19 * - Redistribution, modification, or unauthorized distribution of this software,
20 * in whole or in part, is strictly prohibited.
21 * - This software is provided for non-commercial, educational, and research
22 * purposes only. Commercial use in any form is expressly forbidden.
23 * - Licensing and authorized distribution are solely at the discretion of QRCS.
24 * - Any use of this software implies acceptance of these restrictions.
25 *
26 * DISCLAIMER:
27 * This software is provided "as is," without warranty of any kind, express or
28 * implied, including but not limited to warranties of merchantability or fitness
29 * for a particular purpose. QRCS disclaims all liability for any direct, indirect,
30 * incidental, or consequential damages resulting from the use or misuse of this software.
31 *
32 * FULL LICENSE:
33 * This software is subject to the **Quantum Resistant Cryptographic Solutions
34 * Proprietary License (QRCS-PL)**. The complete license terms are included
35 * in the LICENSE.txt file distributed with this software.
36 *
37 * Written by: John G. Underhill
38 * Contact: john.underhill@protonmail.com
39 */
40
41#ifndef QSC_LIST_H
42#define QSC_LIST_H
43
44#include "common.h"
45
46QSC_CPLUSPLUS_ENABLED_START
47
92
97#define QSC_LIST_ALIGNMENT 64ULL
98
103#define QSC_LIST_MAX_DEPTH 102400ULL
104
112QSC_EXPORT_API typedef struct
113{
114 uint8_t* items;
115 size_t count;
116 size_t width;
118
125QSC_EXPORT_API void qsc_list_add(qsc_list_state* ctx, void* item);
126
134QSC_EXPORT_API void qsc_list_copy(const qsc_list_state* ctx, size_t index, void* item);
135
143
150QSC_EXPORT_API void qsc_list_deserialize(qsc_list_state* ctx, const uint8_t* input);
151
158
165QSC_EXPORT_API void qsc_list_initialize(qsc_list_state* ctx, size_t width);
166
174
182
190QSC_EXPORT_API void qsc_list_item(const qsc_list_state* ctx, uint8_t* item, size_t index);
191
198
205QSC_EXPORT_API void qsc_list_remove(qsc_list_state* ctx, size_t index);
206
214QSC_EXPORT_API size_t qsc_list_serialize(uint8_t* output, const qsc_list_state* ctx);
215
223
230
231#if defined(QSC_DEBUG_MODE)
237QSC_EXPORT_API bool qsc_list_self_test(void);
238#endif
239
240QSC_CPLUSPLUS_ENABLED_END
241
242#endif
Contains common definitions for the Quantum Secure Cryptographic (QSC) library.
#define QSC_EXPORT_API
API export macro for Microsoft compilers when importing from a DLL.
Definition common.h:520
QSC_EXPORT_API size_t qsc_list_serialize(uint8_t *output, const qsc_list_state *ctx)
Serialize the list into a byte array.
Definition list.c:239
QSC_EXPORT_API void qsc_list_dispose(qsc_list_state *ctx)
Dispose of the list state.
Definition list.c:88
QSC_EXPORT_API void qsc_list_rshuffle(qsc_list_state *ctx)
Randomly shuffle the items in the list.
Definition list.c:165
QSC_EXPORT_API void qsc_list_add(qsc_list_state *ctx, void *item)
Add an item to the list.
Definition list.c:7
QSC_EXPORT_API void qsc_list_deserialize(qsc_list_state *ctx, const uint8_t *input)
Convert a serialized list into a list context.
Definition list.c:70
QSC_EXPORT_API size_t qsc_list_size(const qsc_list_state *ctx)
Get the serialized size of the list.
Definition list.c:262
QSC_EXPORT_API size_t qsc_list_count(const qsc_list_state *ctx)
Get the number of items in the list.
Definition list.c:54
QSC_EXPORT_API bool qsc_list_empty(const qsc_list_state *ctx)
Check if the list is empty.
Definition list.c:103
QSC_EXPORT_API void qsc_list_copy(const qsc_list_state *ctx, size_t index, void *item)
Copy an item from the list.
Definition list.c:36
QSC_EXPORT_API void qsc_list_item(const qsc_list_state *ctx, uint8_t *item, size_t index)
Retrieve a pointer to a list item.
Definition list.c:148
QSC_EXPORT_API void qsc_list_sort(qsc_list_state *ctx)
Sort the items in the list.
Definition list.c:278
QSC_EXPORT_API void qsc_list_remove(qsc_list_state *ctx, size_t index)
Remove an item from the list.
Definition list.c:201
QSC_EXPORT_API bool qsc_list_full(const qsc_list_state *ctx)
Check if the list is full.
Definition list.c:119
QSC_EXPORT_API void qsc_list_initialize(qsc_list_state *ctx, size_t width)
Initialize the list state.
Definition list.c:135
Contains the list context state.
Definition list.h:113
size_t width
Definition list.h:116
size_t count
Definition list.h:115
uint8_t * items
Definition list.h:114