QSMP: Quantum Secure Messaging Protocol 1.3.0.0a (A3)
A quantum secure encrypted tunneling protocol
kex.h
Go to the documentation of this file.
1/* 2025 Quantum Resistant Cryptographic Solutions Corporation
2 * All Rights Reserved.
3 *
4 * NOTICE: This software and all accompanying materials are the exclusive
5 * property of Quantum Resistant Cryptographic Solutions Corporation (QRCS).
6 * The intellectual and technical concepts contained within this implementation
7 * are proprietary to QRCS and its authorized licensors and are protected under
8 * applicable U.S. and international copyright, patent, and trade secret laws.
9 *
10 * CRYPTOGRAPHIC STANDARDS:
11 * - This software includes implementations of cryptographic algorithms such as
12 * SHA3, AES, and others. These algorithms are public domain or standardized
13 * by organizations such as NIST and are NOT the property of QRCS.
14 * - However, all source code, optimizations, and implementations in this library
15 * are original works of QRCS and are protected under this license.
16 *
17 * RESTRICTIONS:
18 * - Redistribution, modification, or unauthorized distribution of this software,
19 * in whole or in part, is strictly prohibited.
20 * - This software is provided for non-commercial, educational, and research
21 * purposes only. Commercial use in any form is expressly forbidden.
22 * - Licensing and authorized distribution are solely at the discretion of QRCS.
23 * - Any use of this software implies acceptance of these restrictions.
24 *
25 * DISCLAIMER:
26 * This software is provided "as is," without warranty of any kind, express or
27 * implied, including but not limited to warranties of merchantability or fitness
28 * for a particular purpose. QRCS disclaims all liability for any direct, indirect,
29 * incidental, or consequential damages resulting from the use or misuse of this software.
30 *
31 * FULL LICENSE:
32 * This software is subject to the **Quantum Resistant Cryptographic Solutions
33 * Proprietary License (QRCS-PL)**. The complete license terms are included
34 * in the LICENSE.txt file distributed with this software.
35 *
36 * Written by: John G. Underhill
37 * Contact: john.underhill@protonmail.com
38 */
39
40#ifndef QSMP_KEX_H
41#define QSMP_KEX_H
42
43#include "common.h"
44#include "../QSMP/qsmp.h"
45
73
103
126
145
165
182
199
216
233
251bool qsmp_kex_test();
252
253
254#endif
255
qsmp_errors qsmp_kex_simplex_server_key_exchange(qsmp_kex_simplex_server_state *kss, qsmp_connection_state *cns)
Execute the server-side Simplex key exchange.
Definition kex.c:1916
qsmp_errors qsmp_kex_duplex_client_key_exchange(qsmp_kex_duplex_client_state *kcs, qsmp_connection_state *cns)
Execute the client-side Duplex key exchange.
Definition kex.c:893
qsmp_errors qsmp_kex_simplex_client_key_exchange(qsmp_kex_simplex_client_state *kcs, qsmp_connection_state *cns)
Execute the client-side Simplex key exchange.
Definition kex.c:1744
bool qsmp_kex_test()
Run internal tests for the key exchange functions.
Definition kex.c:2065
qsmp_errors qsmp_kex_duplex_server_key_exchange(qsmp_kex_duplex_server_state *kss, qsmp_connection_state *cns)
Execute the server-side Duplex key exchange.
Definition kex.c:1127
QSMP support header Common defined parameters and functions of the qsmp client and server implementat...
#define QSMP_SECRET_SIZE
The size of the shared secret for each channel.
Definition qsmp.h:335
#define QSMP_ASYMMETRIC_PRIVATE_KEY_SIZE
The byte size of the asymmetric cipher private-key array.
Definition qsmp.h:436
#define QSMP_ASYMMETRIC_VERIFY_KEY_SIZE
The byte size of the asymmetric signature verification-key array.
Definition qsmp.h:454
#define QSMP_ASYMMETRIC_PUBLIC_KEY_SIZE
The byte size of the asymmetric cipher public-key array.
Definition qsmp.h:442
qsmp_errors
The QSMP error values.
Definition qsmp.h:854
#define QSMP_ASYMMETRIC_SIGNING_KEY_SIZE
The byte size of the asymmetric signature signing-key array.
Definition qsmp.h:448
#define QSMP_KEYID_SIZE
The QSMP key identity size.
Definition qsmp.h:266
#define QSMP_DUPLEX_SCHASH_SIZE
The Duplex session token 512-bit hash size.
Definition qsmp.h:191
#define QSMP_SIMPLEX_SCHASH_SIZE
The Simplex 256-bit session token hash size.
Definition qsmp.h:161
The QSMP socket connection state structure.
Definition qsmp.h:1002
Internal state for the Duplex key exchange (client-side).
Definition kex.h:92
uint64_t expiration
Definition kex.h:101
uint8_t schash[QSMP_DUPLEX_SCHASH_SIZE]
Definition kex.h:94
uint8_t rverkey[QSMP_ASYMMETRIC_VERIFY_KEY_SIZE]
Definition kex.h:97
uint8_t prikey[QSMP_ASYMMETRIC_PRIVATE_KEY_SIZE]
Definition kex.h:95
uint8_t sigkey[QSMP_ASYMMETRIC_SIGNING_KEY_SIZE]
Definition kex.h:98
uint8_t verkey[QSMP_ASYMMETRIC_VERIFY_KEY_SIZE]
Definition kex.h:100
uint8_t keyid[QSMP_KEYID_SIZE]
Definition kex.h:93
uint8_t pubkey[QSMP_ASYMMETRIC_PUBLIC_KEY_SIZE]
Definition kex.h:96
uint8_t ssec[QSMP_SECRET_SIZE]
Definition kex.h:99
Internal state for the Duplex key exchange (server-side).
Definition kex.h:115
uint64_t expiration
Definition kex.h:123
uint8_t schash[QSMP_DUPLEX_SCHASH_SIZE]
Definition kex.h:117
uint8_t rverkey[QSMP_ASYMMETRIC_VERIFY_KEY_SIZE]
Definition kex.h:120
uint8_t prikey[QSMP_ASYMMETRIC_PRIVATE_KEY_SIZE]
Definition kex.h:118
uint8_t sigkey[QSMP_ASYMMETRIC_SIGNING_KEY_SIZE]
Definition kex.h:121
uint8_t verkey[QSMP_ASYMMETRIC_VERIFY_KEY_SIZE]
Definition kex.h:122
uint8_t keyid[QSMP_KEYID_SIZE]
Definition kex.h:116
bool(* key_query)(uint8_t *, const uint8_t *)
Definition kex.h:124
uint8_t pubkey[QSMP_ASYMMETRIC_PUBLIC_KEY_SIZE]
Definition kex.h:119
Internal state for the Simplex key exchange (client-side).
Definition kex.h:137
uint64_t expiration
Definition kex.h:143
uint8_t rverkey[QSMP_ASYMMETRIC_VERIFY_KEY_SIZE]
Definition kex.h:139
uint8_t sigkey[QSMP_ASYMMETRIC_SIGNING_KEY_SIZE]
Definition kex.h:140
uint8_t schash[QSMP_SIMPLEX_SCHASH_SIZE]
Definition kex.h:141
uint8_t verkey[QSMP_ASYMMETRIC_VERIFY_KEY_SIZE]
Definition kex.h:142
uint8_t keyid[QSMP_KEYID_SIZE]
Definition kex.h:138
Internal state for the Simplex key exchange (server-side).
Definition kex.h:156
uint64_t expiration
Definition kex.h:163
uint8_t prikey[QSMP_ASYMMETRIC_PRIVATE_KEY_SIZE]
Definition kex.h:159
uint8_t sigkey[QSMP_ASYMMETRIC_SIGNING_KEY_SIZE]
Definition kex.h:161
uint8_t schash[QSMP_SIMPLEX_SCHASH_SIZE]
Definition kex.h:158
uint8_t verkey[QSMP_ASYMMETRIC_VERIFY_KEY_SIZE]
Definition kex.h:162
uint8_t keyid[QSMP_KEYID_SIZE]
Definition kex.h:157
uint8_t pubkey[QSMP_ASYMMETRIC_PUBLIC_KEY_SIZE]
Definition kex.h:160