|
#define | QSC_CSX_AUTHENTICATED |
| Enables KMAC authentication mode.
|
|
#define | QSC_CSX_AUTH_QMAC |
| Enables the reduced rounds QMAC implementation.
|
|
#define | QSC_CSX_BLOCK_SIZE 128ULL |
| The internal block size in bytes, required by the encryption and decryption functions.
|
|
#define | QSC_CSX_INFO_SIZE 48ULL |
| The maximum byte length of the info string.
|
|
#define | QSC_CSX_KEY_SIZE 64ULL |
| The size in bytes of the CSX-512 input cipher-key.
|
|
#define | QSC_CSX_MAC_SIZE 32ULL |
| The CSX MAC code array length in bytes.
|
|
#define | QSC_CSX_NONCE_SIZE 16ULL |
| The byte size of the nonce array.
|
|
#define | QSC_CSX_STATE_SIZE 16ULL |
| The uint64 size of the internal state array.
|
|
|
QSC_EXPORT_API void | qsc_csx_dispose (qsc_csx_state *ctx) |
| Dispose of the CSX cipher state.
|
|
QSC_EXPORT_API void | qsc_csx_initialize (qsc_csx_state *ctx, const qsc_csx_keyparams *keyparams, bool encryption) |
| Initialize the state with the input cipher-key and optional info tweak.
|
|
QSC_EXPORT_API void | qsc_csx_set_associated (qsc_csx_state *ctx, const uint8_t *data, size_t length) |
| Set the associated data string used in authenticating the message. The associated data may be packet header information, domain specific data, or a secret shared by a group. The associated data must be set after initialization, and before each transformation call. The data is erased after each call to the transform.
|
|
QSC_EXPORT_API void | qsc_csx_store_nonce (const qsc_csx_state *ctx, uint8_t nonce[QSC_CSX_NONCE_SIZE]) |
| Retrieves the current nonce from the state.
|
|
QSC_EXPORT_API bool | qsc_csx_transform (qsc_csx_state *ctx, uint8_t *output, const uint8_t *input, size_t length) |
| Transform an array of bytes. In encryption mode, the input plain-text is encrypted and then an authentication MAC code is appended to the cipher-text. In decryption mode, the input cipher-text is authenticated internally and compared to the MAC code appended to the cipher-text, if the codes to not match, the cipher-text is not decrypted and the call fails.
|
|
QSC_EXPORT_API bool | qsc_csx_extended_transform (qsc_csx_state *ctx, uint8_t *output, const uint8_t *input, size_t length, bool finalize) |
| A multi-call transform for a large array of bytes, such as required by file encryption. This call can be used to transform and authenticate a very large array of bytes (+1GB). On the last call in the sequence, set the finalize parameter to true to complete authentication, and write the MAC code to the end of the output array in encryption mode, or compare to the embedded MAC code and authenticate in decryption mode. In encryption mode, the input plain-text is encrypted, then authenticated, and the MAC code is appended to the cipher-text. In decryption mode, the input cipher-text is authenticated internally and compared to the MAC code appended to the cipher-text, if the codes do not match, the cipher-text is not decrypted and the call fails.
|
|
ChaCha-based authenticated Stream cipher eXtension.
This header defines the public API for the CSX-512 cipher, a wide-block ChaCha-based authenticated stream cipher extension. CSX-512 is a vectorized, 64-bit, 40-round stream cipher that uses a 512-bit input key, a 16-byte nonce, and an optional tweak (info) parameter. The cipher employs the Keccak cSHAKE-512 extended output function (XOF) to expand the input cipher-key into both the cipher key and the MAC key. It integrates a post-quantum secure MAC function (QMAC or KMAC) for message authentication, operating in an encrypt-then-MAC configuration to provide authenticated encryption with associated data (AEAD). In decryption mode, the MAC code embedded in the ciphertext is verified prior to decryption, ensuring data integrity and authenticity.
- Example Usage:
#define CSTLEN 20
#define MSGLEN 200
uint8_t cust[CSTLEN] = { ... };
uint8_t msg[MSGLEN] = { ... };
qsc_csx_initialize(&state, &kp, true);
qsc_csx_transform(&state, cpt, msg, MSGLEN);
#define QSC_CSX_MAC_SIZE
The CSX MAC code array length in bytes.
Definition csx.h:154
#define QSC_CSX_KEY_SIZE
The size in bytes of the CSX-512 input cipher-key.
Definition csx.h:147
#define QSC_CSX_NONCE_SIZE
The byte size of the nonce array.
Definition csx.h:167
The key parameters structure containing key, nonce, and info arrays and lengths. Use this structure t...
Definition csx.h:184
The internal state structure containing the round-key array.
Definition csx.h:197
Reference Links:
QSC_EXPORT_API bool qsc_csx_extended_transform |
( |
qsc_csx_state * | ctx, |
|
|
uint8_t * | output, |
|
|
const uint8_t * | input, |
|
|
size_t | length, |
|
|
bool | finalize ) |
A multi-call transform for a large array of bytes, such as required by file encryption. This call can be used to transform and authenticate a very large array of bytes (+1GB). On the last call in the sequence, set the finalize parameter to true to complete authentication, and write the MAC code to the end of the output array in encryption mode, or compare to the embedded MAC code and authenticate in decryption mode. In encryption mode, the input plain-text is encrypted, then authenticated, and the MAC code is appended to the cipher-text. In decryption mode, the input cipher-text is authenticated internally and compared to the MAC code appended to the cipher-text, if the codes do not match, the cipher-text is not decrypted and the call fails.
- Warning
- The cipher must be initialized before this function can be called
- Parameters
-
ctx | [struct] The cipher state structure |
output | [uint8_t*] A pointer to the output array |
input | [const] A pointer to the input array |
length | [size_t] The number of bytes to transform |
finalize | [bool] Complete authentication on a stream if set to true |
- Returns
- : [bool] Returns true if the cipher has been transformed the data successfully, false on failure