QSC Post Quantum Cryptographic Library 1.0.0.6c (A6)
A post quantum secure library written in Ansi C
 
Loading...
Searching...
No Matches
hcg.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_HCG_H
42#define QSC_HCG_H
43
44#include "common.h"
45#include "sha2.h"
46
47QSC_CPLUSPLUS_ENABLED_START
48
83
88#define QSC_HCG_KEY_SIZE 64ULL
89
94#define QSC_HCG_INFO_SIZE 19ULL
95
100#define QSC_HCG_MAX_INFO_SIZE 56ULL
101
106#define QSC_HCG_NONCE_SIZE 8ULL
107
112#define QSC_HCG_RESEED_THRESHHOLD 65535ULL
113
118#define QSC_HCG_SEED_SIZE 64ULL
119
143
152
163QSC_EXPORT_API void qsc_hcg_initialize(qsc_hcg_state* ctx, const uint8_t* seed, size_t seedlen, const uint8_t* info, size_t infolen, bool pres);
164
174QSC_EXPORT_API void qsc_hcg_generate(qsc_hcg_state* ctx, uint8_t* output, size_t otplen);
175
185QSC_EXPORT_API void qsc_hcg_update(qsc_hcg_state* ctx, const uint8_t* seed, size_t seedlen);
186
187QSC_CPLUSPLUS_ENABLED_END
188
189#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
#define QSC_HCG_KEY_SIZE
The HCG internal key size.
Definition hcg.h:88
#define QSC_HCG_NONCE_SIZE
The HCG nonce size.
Definition hcg.h:106
QSC_EXPORT_API void qsc_hcg_initialize(qsc_hcg_state *ctx, const uint8_t *seed, size_t seedlen, const uint8_t *info, size_t infolen, bool pres)
Initialize the pseudo-random provider state with a seed and optional personalization string.
Definition hcg.c:70
QSC_EXPORT_API void qsc_hcg_generate(qsc_hcg_state *ctx, uint8_t *output, size_t otplen)
Generate pseudo-random bytes using the generator.
Definition hcg.c:119
QSC_EXPORT_API void qsc_hcg_update(qsc_hcg_state *ctx, const uint8_t *seed, size_t seedlen)
Update the generator with new keying material.
Definition hcg.c:152
QSC_EXPORT_API void qsc_hcg_dispose(qsc_hcg_state *ctx)
Dispose of the HCG DRBG state.
Definition hcg.c:55
#define QSC_HCG_MAX_INFO_SIZE
The HCG maximum info size.
Definition hcg.h:100
The SHA2 family of hash functions.
The HCG state structure.
Definition hcg.h:135
size_t rpos
Definition hcg.h:140
uint8_t info[QSC_HCG_MAX_INFO_SIZE]
Definition hcg.h:137
uint8_t nonce[QSC_HCG_NONCE_SIZE]
Definition hcg.h:138
size_t inflen
Definition hcg.h:139
uint8_t key[QSC_HCG_KEY_SIZE]
Definition hcg.h:136
bool pres
Definition hcg.h:141