46#if defined(QSC_SYSTEM_AESNI_ENABLED)
47# include "intrinsics.h"
48# include <immintrin.h>
51QSC_CPLUSPLUS_ENABLED_START
113#if !defined(QSC_RCS_AUTHENTICATED)
114# define QSC_RCS_AUTHENTICATED
119#if defined(QSC_RCS_AUTHENTICATED)
137 # define QSC_RCS_AUTH_QMAC
141#if defined(QSC_RCS_AUTHENTICATED)
142# if !defined(QSC_RCS_AUTH_KMACR24) && !defined(QSC_RCS_AUTH_KMACR12) && !defined(QSC_RCS_AUTH_QMAC)
143# define QSC_RCS_AUTH_KMACR24
147#if defined(QSC_RCS_AUTH_QMAC)
159#define QSC_RCS_BLOCK_SIZE 32ULL
165#define QSC_RCS256_KEY_SIZE 32ULL
171#define QSC_RCS256_MAC_SIZE 32ULL
177#define QSC_RCS512_KEY_SIZE 64ULL
179#if defined(QSC_RCS_AUTH_QMAC)
184#define QSC_RCS512_MAC_SIZE 32ULL
190#define QSC_RCS512_MAC_SIZE 64ULL
197#define QSC_RCS_NONCE_SIZE 32ULL
231#if defined(QSC_SYSTEM_AESNI_ENABLED)
233# if defined(QSC_SYSTEM_HAS_AVX512)
234 __m512i roundkeysw[31];
241#if defined(QSC_RCS_AUTH_QMAC)
327QSC_CPLUSPLUS_ENABLED_END
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
QMAC function definitions.
QSC_EXPORT_API void qsc_rcs_initialize(qsc_rcs_state *ctx, const qsc_rcs_keyparams *keyparams, bool encryption)
Initialize the state with the input cipher-key and optional info tweak.
Definition rcs.c:723
rcs_cipher_type
The pre-defined cipher mode implementations.
Definition rcs.h:203
@ RCS512
Definition rcs.h:205
@ RCS256
Definition rcs.h:204
QSC_EXPORT_API void qsc_rcs_store_nonce(const qsc_rcs_state *ctx, uint8_t nonce[QSC_RCS_NONCE_SIZE])
Retrieves the current nonce from the state.
Definition rcs.c:775
#define QSC_RCS_NONCE_SIZE
The nonce size in bytes.
Definition rcs.h:197
QSC_EXPORT_API bool qsc_rcs_transform(qsc_rcs_state *ctx, uint8_t *output, const uint8_t *input, size_t length)
Transform an array of bytes.
Definition rcs.c:782
QSC_EXPORT_API void qsc_rcs_set_associated(qsc_rcs_state *ctx, const uint8_t *data, size_t length)
Set the associated data string used in authenticating the message.
Definition rcs.c:757
QSC_EXPORT_API bool qsc_rcs_extended_transform(qsc_rcs_state *ctx, uint8_t *output, const uint8_t *input, size_t length, bool finalize)
A multi-call transform for a large array of bytes.
Definition rcs.c:856
QSC_EXPORT_API void qsc_rcs_dispose(qsc_rcs_state *ctx)
Dispose of the RCS cipher state.
Definition rcs.c:693
SHA3 family of hash functions.
The Keccak state array; state array must be initialized by the caller.
Definition sha3.h:240
The QMAC state.
Definition qmac.h:122
The key parameters structure containing key, nonce, and info arrays and lengths.
Definition rcs.h:217
uint8_t * nonce
Definition rcs.h:220
const uint8_t * key
Definition rcs.h:218
size_t infolen
Definition rcs.h:222
size_t keylen
Definition rcs.h:219
const uint8_t * info
Definition rcs.h:221
The internal state structure containing the round-key array.
Definition rcs.h:229
uint64_t counter
Definition rcs.h:247
rcs_cipher_type ctype
Definition rcs.h:230
qsc_qmac_state kstate
Definition rcs.h:242
size_t roundkeylen
Definition rcs.h:239
size_t rounds
Definition rcs.h:240
uint8_t nonce[QSC_RCS_NONCE_SIZE]
Definition rcs.h:246
uint32_t roundkeys[248]
Definition rcs.h:237
bool encrypt
Definition rcs.h:248