AERN: Authenticated Encrypted Relay Network 1.0.0.0a (A1)
A post quantum authenticated and encrypted proxy chain network
aerncommon.h
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 STANDAARS:
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: contact@qrcscorp.ca
38 */
39
40#ifndef AERN_COMMON_H
41#define AERN_COMMON_H
42
43#include "qsccommon.h"
44#include <assert.h>
45#include <errno.h>
46#include <stdbool.h>
47#include <stdint.h>
48#include <limits.h>
49#include <string.h>
50
56
58
59static const char AERN_DEFAULT_APP_PATH[] = "C:\\";
60static const char AERN_LOG_FILENAME[] = "\\userlog.mlog";
61
66#define AERN_CONFIG_DILITHIUM_KYBER
67
73#if !defined(AERN_CONFIG_DILITHIUM_KYBER)
74# define AERN_CONFIG_SPHINCS_MCELIECE
75#endif
76
77#if defined(DEBUG) || defined(_DEBUG) || defined(__DEBUG__) || (defined(__GNUC__) && !defined(__OPTIMIZE__))
82# define AERN_COMPILE_DEBUG_MODE
83#endif
84
89#if defined(AERN_COMPILE_DEBUG_MODE)
90//# define AERN_DEBUG_TESTS_RUN
91#endif
92
93/* application constants */
94#define AERN_CRYPTO_PASSWORD_HASH 32U
95#define AERN_DEFAULT_AUTH_RETRIES 3U
96#define AERN_DEFAULT_PORT 8022U
97#define AERN_DEFAULT_SESSION_TIMEOUT 5U
98#define AERN_STORAGE_ADDRESS_MIN 7U
99#define AERN_STORAGE_ADDRESS_MAX 65U
100#define AERN_STORAGE_ASSOCIATION_HOSTS_MAX 16U
101#define AERN_STORAGE_CERTIFICATE_NAME 128U
102#define AERN_STORAGE_DEVICENAME_MAX 16U
103#define AERN_STORAGE_DEVICENAME_MIN 2U
104#define AERN_STORAGE_DOMAINNAME_MAX 260U
105#define AERN_STORAGE_DOMAINNAME_MIN 2U
106#define AERN_STORAGE_FILEPATH_MAX 256U
107#define AERN_STORAGE_FILEPATH_MIN 8U
108#define AERN_STORAGE_HOSTNAME_MIN 2U
109#define AERN_STORAGE_HOSTNAME_MAX 128U
110#define AERN_STORAGE_INPUT_MAX 256U
111#define AERN_STORAGE_MAC_SIZE 32U
112#define AERN_STORAGE_MAX_PATH 260U
113#define AERN_STORAGE_MESSAGE_MAX 8192U
114#define AERN_STORAGE_PASSWORD_MAX 256U
115#define AERN_STORAGE_PASSWORD_MIN 8U
116#define AERN_STORAGE_PASSWORD_RETRY 3U
117#define AERN_STORAGE_PATH_MAX 260U
118#define AERN_STORAGE_PROMPT_MAX 64U
119#define AERN_STORAGE_RETRIES_MIN 1U
120#define AERN_STORAGE_RETRIES_MAX 5U
121#define AERN_STORAGE_SERVER_PAUSE_INTERVAL 250U
122#define AERN_STORAGE_TIMEOUT_MIN 1U
123#define AERN_STORAGE_TIMEOUT_MAX 60U
124#define AERN_STORAGE_USERNAME_MAX 128U
125#define AERN_STORAGE_USERNAME_MIN 6U
126#define AERN_STORAGE_USERNAME_RETRY 3U
127
132#if defined(_DLL)
133# define AERN_DLL_API
134#endif
135
140#if defined(AERN_DLL_API)
141# if defined(QSC_SYSTEM_COMPILER_MSC)
142# if defined(AERN_DLL_IMPORT)
143# define AERN_EXPORT_API __declspec(dllimport)
144# else
145# define AERN_EXPORT_API __declspec(dllexport)
146# endif
147# elif defined(QSC_SYSTEM_COMPILER_GCC)
148# if defined(AERN_DLL_IMPORT)
149# define AERN_EXPORT_API __attribute__((dllimport))
150# else
151# define AERN_EXPORT_API __attribute__((dllexport))
152# endif
153# else
154# if defined(__SUNPRO_C)
155# if !defined(__GNU_C__)
156# define AERN_EXPORT_API __attribute__ (visibility(__global))
157# else
158# define AERN_EXPORT_API __attribute__ __global
159# endif
160# elif defined(_MSG_VER)
161# define AERN_EXPORT_API extern __declspec(dllexport)
162# else
163# define AERN_EXPORT_API __attribute__ ((visibility ("default")))
164# endif
165# endif
166#else
167# define AERN_EXPORT_API
168#endif
169
170#if defined(DEBUG) || defined(_DEBUG) || defined(__DEBUG__) || (defined(__GNUC__) && !defined(__OPTIMIZE__))
175# define AERN_DEBUG_MODE
176#endif
177
178#ifdef AERN_DEBUG_MODE
183# define AERN_ASSERT(expr) assert(expr)
184#else
185# define AERN_ASSERT(expr) ((void)0)
186#endif
187
189
190#endif