QSC Post Quantum Cryptographic Library 1.0.0.6c (A6)
A post quantum secure library written in Ansi C
 
Loading...
Searching...
No Matches
csg.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_CSG_H
42#define QSC_CSG_H
43
44#include "common.h"
45#include "sha3.h"
46
47QSC_CPLUSPLUS_ENABLED_START
48
84
89#define QSC_CSG_256_SEED_SIZE 32ULL
90
95#define QSC_CSG_512_SEED_SIZE 64ULL
96
101#define QSC_CSG_RESEED_THRESHHOLD 1024000ULL
102
109QSC_EXPORT_API typedef struct
110{
113 size_t bctr;
114 size_t cpos;
115 size_t crmd;
116 size_t rate;
117 bool pres;
119
128
142QSC_EXPORT_API void qsc_csg_initialize(qsc_csg_state* ctx, const uint8_t* seed, size_t seedlen, const uint8_t* info, size_t infolen, bool predres);
143
153QSC_EXPORT_API void qsc_csg_generate(qsc_csg_state* ctx, uint8_t* output, size_t otplen);
154
164QSC_EXPORT_API void qsc_csg_update(qsc_csg_state* ctx, const uint8_t* seed, size_t seedlen);
165
166QSC_CPLUSPLUS_ENABLED_END
167
168#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 void qsc_csg_initialize(qsc_csg_state *ctx, const uint8_t *seed, size_t seedlen, const uint8_t *info, size_t infolen, bool predres)
Initialize the pseudo-random provider state with a seed and optional personalization string.
Definition csg.c:66
QSC_EXPORT_API void qsc_csg_generate(qsc_csg_state *ctx, uint8_t *output, size_t otplen)
Generate pseudo-random bytes.
Definition csg.c:120
QSC_EXPORT_API void qsc_csg_update(qsc_csg_state *ctx, const uint8_t *seed, size_t seedlen)
Update the DRBG with new seed material.
Definition csg.c:177
QSC_EXPORT_API void qsc_csg_dispose(qsc_csg_state *ctx)
Dispose of the DRBG state.
Definition csg.c:50
SHA3 family of hash functions.
#define QSC_KECCAK_256_RATE
The 256-bit absorption rate.
Definition sha3.h:165
The CSG state structure.
Definition csg.h:110
size_t cpos
Definition csg.h:114
size_t bctr
Definition csg.h:113
size_t rate
Definition csg.h:116
qsc_keccak_state kstate
Definition csg.h:111
size_t crmd
Definition csg.h:115
uint8_t cache[QSC_KECCAK_256_RATE]
Definition csg.h:112
bool pres
Definition csg.h:117
The Keccak state array; state array must be initialized by the caller.
Definition sha3.h:240