QSC Post Quantum Cryptographic Library 1.3.0.0 (C1)
A post quantum secure library written in Ansi C
Loading...
Searching...
No Matches
tlsstate.h
Go to the documentation of this file.
1/* 2020-2026 Quantum Resistant Cryptographic Solutions Corporation
2 * All Rights Reserved.
3 *
4 * NOTICE:
5 * This software and all accompanying materials are the exclusive property of
6 * Quantum Resistant Cryptographic Solutions Corporation (QRCS). The intellectual
7 * and technical concepts contained herein are proprietary to QRCS and are
8 * protected under applicable Canadian, U.S., and international copyright,
9 * patent, and trade secret laws.
10 *
11 * CRYPTOGRAPHIC ALGORITHMS AND IMPLEMENTATIONS:
12 * - This software includes implementations of cryptographic primitives and
13 * algorithms that are standardized or in the public domain, such as AES
14 * and SHA-3, which are not proprietary to QRCS.
15 * - This software also includes cryptographic primitives, constructions, and
16 * algorithms designed by QRCS, including but not limited to RCS, SCB, CSX, QMAC, and
17 * related components, which are proprietary to QRCS.
18 * - All source code, implementations, protocol compositions, optimizations,
19 * parameter selections, and engineering work contained in this software are
20 * original works of QRCS and are protected under this license.
21 *
22 * LICENSE AND USE RESTRICTIONS:
23 * - This software is licensed under the Quantum Resistant Cryptographic Solutions
24 * Public Research and Evaluation License (QRCS-PREL), 2025-2026.
25 * - Permission is granted solely for non-commercial evaluation, academic research,
26 * cryptographic analysis, interoperability testing, and feasibility assessment.
27 * - Commercial use, production deployment, commercial redistribution, or
28 * integration into products or services is strictly prohibited without a
29 * separate written license agreement executed with QRCS.
30 * - Licensing and authorized distribution are solely at the discretion of QRCS.
31 *
32 * EXPERIMENTAL CRYPTOGRAPHY NOTICE:
33 * Portions of this software may include experimental, novel, or evolving
34 * cryptographic designs. Use of this software is entirely at the user's risk.
35 *
36 * DISCLAIMER:
37 * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38 * IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS
39 * FOR A PARTICULAR PURPOSE, SECURITY, OR NON-INFRINGEMENT. QRCS DISCLAIMS ALL
40 * LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
41 * ARISING FROM THE USE OR MISUSE OF THIS SOFTWARE.
42 *
43 * FULL LICENSE:
44 * This software is subject to the Quantum Resistant Cryptographic Solutions
45 * Public Research and Evaluation License (QRCS-PREL), 2025-2026. The complete license terms
46 * are provided in the accompanying LICENSE file or at https://www.qrcscorp.ca.
47 *
48 * Written by: John G. Underhill
49 * Contact: contact@qrcscorp.ca
50 */
51
52#ifndef QSC_TLS_STATE_H
53#define QSC_TLS_STATE_H
54
55#include "tlstypes.h"
56#include "tlscert.h"
57#include "sha2.h"
58#include "tlslimits.h"
59
60QSC_CPLUSPLUS_ENABLED_START
61
66
82
88{
90 uint8_t key[32U];
91 size_t keylen;
92 uint8_t iv[12U];
93 uint64_t sequence;
96
109
123
128
130{
132 size_t chainlength;
136 /* C6 fix: stored private key for the internal signing trampoline installed by
137 * qsc_tls_handshake_set_local_certificate(). Zeroed by set_local_certificate
138 * if a user-supplied callback is configured instead. */
142 void* signstate;
146
151typedef struct qsc_tls_psk_state
152{
153 //qsc_tls_session_ticket ticket; /*!< Cached TLS 1.3 resumption ticket. */
155 size_t binderlen;
156 bool enabled;
157 bool resumed;
159
160QSC_CPLUSPLUS_ENABLED_END
161
162#endif
The SHA2 family of hash functions.
The SHA2-256 digest state array.
Definition sha2.h:207
The SHA2-384 digest state array.
Definition sha2.h:277
The SHA2-512 digest state array.
Definition sha2.h:338
Stores a bounded ordered ALPN protocol list and its negotiation policy.
Definition tlsstate.h:102
uint8_t protocols[QSC_TLS_MAX_ALPN_PROTOCOLS][QSC_TLS_MAX_ALPN_SIZE]
Definition tlsstate.h:103
size_t protocolcount
Definition tlsstate.h:105
bool configured
Definition tlsstate.h:107
size_t protocollens[QSC_TLS_MAX_ALPN_PROTOCOLS]
Definition tlsstate.h:104
bool required
Definition tlsstate.h:106
A non-owning view over a single encoded certificate.
Definition tlscert.h:80
Stores the configured local certificate chain and CertificateVerify signing configuration.
Definition tlsstate.h:130
qsc_tls_certificate_sign_callback signcallback
Definition tlsstate.h:141
size_t signprivatekeylen
Definition tlsstate.h:140
size_t verifysignaturelen
Definition tlsstate.h:135
bool configured
Definition tlsstate.h:143
qsc_tls_certificate_view chain[QSC_TLS_CERTIFICATE_LIST_MAX_ENTRIES]
Definition tlsstate.h:131
size_t chainlength
Definition tlsstate.h:132
qsc_tls_signature_scheme verifyscheme
Definition tlsstate.h:133
uint8_t verifysignature[QSC_TLS_CERTIFICATE_VERIFY_MAX_SIGNATURE_SIZE]
Definition tlsstate.h:134
uint8_t signprivatekey[QSC_TLS_MAX_SIGNING_PRIVATE_KEY_SIZE]
Definition tlsstate.h:139
void * signstate
Definition tlsstate.h:142
bool staticsignature
Definition tlsstate.h:144
Stores the peer-advertised supported groups and signature-scheme capabilities.
Definition tlsstate.h:115
qsc_tls_signature_scheme certsigschemes[QSC_TLS_MAX_SIGNATURE_SCHEMES]
Definition tlsstate.h:120
qsc_tls_named_group groups[QSC_TLS_MAX_GROUPS]
Definition tlsstate.h:116
qsc_tls_signature_scheme sigschemes[QSC_TLS_MAX_SIGNATURE_SCHEMES]
Definition tlsstate.h:118
size_t certsigschemecount
Definition tlsstate.h:121
size_t sigschemecount
Definition tlsstate.h:119
size_t groupcount
Definition tlsstate.h:117
Stores cached TLS 1.3 resumption ticket state and the derived PSK binder for the active connection.
Definition tlsstate.h:152
bool resumed
Definition tlsstate.h:157
size_t binderlen
Definition tlsstate.h:155
bool enabled
Definition tlsstate.h:156
uint8_t binder[QSC_TLS_PSK_BINDER_MAX_SIZE]
Definition tlsstate.h:154
Stores the active TLS traffic keying material and sequence number for one record direction.
Definition tlsstate.h:88
uint8_t iv[12U]
Definition tlsstate.h:92
qsc_tls_cipher_suite suite
Definition tlsstate.h:89
uint8_t key[32U]
Definition tlsstate.h:90
uint64_t sequence
Definition tlsstate.h:93
bool initialized
Definition tlsstate.h:94
size_t keylen
Definition tlsstate.h:91
Stores the active transcript hash context and its selected hash algorithm.
Definition tlsstate.h:72
qsc_sha256_state sha256
Definition tlsstate.h:77
qsc_sha512_state sha512
Definition tlsstate.h:79
qsc_tls_hash_algorithm hash
Definition tlsstate.h:73
qsc_sha384_state sha384
Definition tlsstate.h:78
union qsc_tls_transcript_state::@217207304340054104166026204375043031367311177376 ctx
bool initialized
Definition tlsstate.h:74
TLS certificate bridge types and validation callbacks.
bool(* qsc_tls_certificate_sign_callback)(qsc_tls_signature_scheme scheme, const uint8_t *input, size_t inputlen, uint8_t *signature, size_t *signaturelen, void *state)
Produce a TLS 1.3 CertificateVerify signature.
Definition tlscert.h:141
Fixed upper bounds used by the TLS implementation.
#define QSC_TLS_MAX_GROUPS
Maximum number of supported groups tracked per peer.
Definition tlslimits.h:103
#define QSC_TLS_CERTIFICATE_LIST_MAX_ENTRIES
Maximum number of certificates tracked in a chain.
Definition tlslimits.h:152
#define QSC_TLS_MAX_ALPN_SIZE
Maximum ALPN identifier length in bytes.
Definition tlslimits.h:127
#define QSC_TLS_PSK_BINDER_MAX_SIZE
Maximum size of a PSK binder in bytes.
Definition tlslimits.h:188
#define QSC_TLS_MAX_SIGNATURE_SCHEMES
Maximum number of signature schemes tracked per peer.
Definition tlslimits.h:109
#define QSC_TLS_CERTIFICATE_VERIFY_MAX_SIGNATURE_SIZE
Maximum CertificateVerify signature size in bytes across the registered signature schemes.
Definition tlslimits.h:255
#define QSC_TLS_MAX_SIGNING_PRIVATE_KEY_SIZE
Maximum private-key size in bytes across all supported CertificateVerify signature schemes....
Definition tlslimits.h:264
#define QSC_TLS_MAX_ALPN_PROTOCOLS
Maximum number of ALPN identifiers stored in a TLS endpoint policy.
Definition tlslimits.h:133
Public TLS type definitions.
qsc_tls_cipher_suite
TLS 1.3 cipher-suite identifiers.
Definition tlstypes.h:129
qsc_tls_named_group
TLS named-group identifiers for classical, ML-KEM, and hybrid key exchange groups.
Definition tlstypes.h:159
qsc_tls_hash_algorithm
Identifies the transcript and HKDF hash algorithm associated with a TLS cipher suite.
Definition tlstypes.h:69
qsc_tls_signature_scheme
TLS signature-scheme identifiers.
Definition tlstypes.h:179