PQS: Post Quantum Shell Protocol 1.1.0.0a (A2)
A quantum secure secure shell protocol
pqs.h
1/* 2025-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 PQS_H
53#define PQS_H
54
55#include "pqscommon.h"
56#include "qsms.h"
57
58#ifndef PQS_CRYPTO_PHASH_CPU_COST
66# define PQS_CRYPTO_PHASH_CPU_COST 4U
67#endif
68
69#ifndef PQS_CRYPTO_PHASH_MEMORY_COST
77# define PQS_CRYPTO_PHASH_MEMORY_COST 1U
78#endif
79
80#ifndef PQS_USER_VERIFIER_DOMAIN
85# define PQS_USER_VERIFIER_DOMAIN "PQS-USER-SCB-VERIFIER-V2"
86#endif
87
95PQS_EXPORT_API typedef enum pqs_application_messages
96{
97 pqs_application_message_none = 0x00U,
98 pqs_application_message_login_request = 0x10U,
99 pqs_application_message_login_success = 0x11U,
100 pqs_application_message_login_failure = 0x12U,
101 pqs_application_message_command_request = 0x20U,
102 pqs_application_message_response_more = 0x21U,
103 pqs_application_message_response_final = 0x22U,
104 pqs_application_message_admin_request = 0x23U,
105 pqs_application_message_admin_response_more = 0x24U,
106 pqs_application_message_admin_response_final = 0x25U,
107 pqs_application_message_file_get_request = 0x40U,
108 pqs_application_message_file_put_start = 0x41U,
109 pqs_application_message_file_put_data = 0x42U,
110 pqs_application_message_file_put_final = 0x43U,
111 pqs_application_message_file_list_request = 0x44U,
112 pqs_application_message_file_mkdir_request = 0x45U,
113 pqs_application_message_file_remove_request = 0x46U,
114 pqs_application_message_file_data = 0x47U,
115 pqs_application_message_file_final = 0x48U,
116 pqs_application_message_file_status = 0x49U,
117 pqs_application_message_file_get_recursive_request = 0x4AU,
118 pqs_application_message_file_directory_begin = 0x4BU,
119 pqs_application_message_file_directory_end = 0x4CU,
120 pqs_application_message_file_begin = 0x4DU,
121 pqs_application_message_error = 0x30U,
122 pqs_application_message_disconnect = 0x31U
123} pqs_application_messages;
124
132PQS_EXPORT_API typedef enum pqs_session_states
133{
134 pqs_session_state_none = 0x00U,
135 pqs_session_state_connected = 0x01U,
136 pqs_session_state_login_required = 0x02U,
137 pqs_session_state_authenticated = 0x03U,
138 pqs_session_state_command_active = 0x04U,
139 pqs_session_state_closing = 0x05U
140} pqs_session_states;
141
146PQS_EXPORT_API typedef enum pqs_user_privileges
147{
148 pqs_user_privilege_none = 0x00U,
149 pqs_user_privilege_guest = 0x01U,
150 pqs_user_privilege_user = 0x02U,
151 pqs_user_privilege_admin = 0x03U
152} pqs_user_privileges;
153
160PQS_EXPORT_API typedef enum pqs_client_commands
161{
162 pqs_client_command_none = 0x00U,
163 pqs_client_command_cprint = 0x01U,
164 pqs_client_command_knownhosts = 0x02U,
165 pqs_client_command_knownhost_remove = 0x03U,
166 pqs_client_command_file_get = 0x04U,
167 pqs_client_command_file_put = 0x05U,
168 pqs_client_command_file_list = 0x06U,
169 pqs_client_command_file_mkdir = 0x07U,
170 pqs_client_command_file_remove = 0x08U,
171 pqs_client_command_help = 0x09U,
172 pqs_client_command_help_detail = 0x0AU,
173 pqs_client_command_execute = 0x0BU,
174 pqs_client_command_admin = 0x0CU,
175 pqs_client_command_quit = 0x0DU,
176} pqs_client_commands;
177
185PQS_EXPORT_API typedef enum pqs_errors
186{
187 pqs_error_none = 0x00U,
188 pqs_error_accept_fail = 0x01U,
189 pqs_error_authentication_failure = 0x02U,
190 pqs_error_bad_keep_alive = 0x03U,
191 pqs_error_channel_down = 0x04U,
192 pqs_error_connection_failure = 0x05U,
193 pqs_error_connect_failure = 0x06U,
194 pqs_error_decapsulation_failure = 0x07U,
195 pqs_error_decryption_failure = 0x08U,
196 pqs_error_establish_failure = 0x09U,
197 pqs_error_exchange_failure = 0x0AU,
198 pqs_error_hash_invalid = 0x0BU,
199 pqs_error_hosts_exceeded = 0x0CU,
200 pqs_error_invalid_input = 0x0DU,
201 pqs_error_invalid_request = 0x0EU,
202 pqs_error_keepalive_expired = 0x0FU,
203 pqs_error_keepalive_timeout = 0x10U,
204 pqs_error_key_expired = 0x11U,
205 pqs_error_key_unrecognized = 0x12U,
206 pqs_error_keychain_fail = 0x13U,
207 pqs_error_listener_fail = 0x14U,
208 pqs_error_memory_allocation = 0x15U,
209 pqs_error_packet_unsequenced = 0x16U,
210 pqs_error_random_failure = 0x17U,
211 pqs_error_receive_failure = 0x18U,
212 pqs_error_transmit_failure = 0x19U,
213 pqs_error_unknown_protocol = 0x1AU,
214 pqs_error_verify_failure = 0x1BU,
215 pqs_error_login_failure = 0x1CU,
216 pqs_error_login_success = 0x1DU,
217 pqs_error_message_time_invalid = 0x1EU,
218 pqs_error_connection_refused = 0x1FU,
219 pqs_messages_system_message = 0x20U,
220} pqs_errors;
221
222#endif