QSC Post Quantum Cryptographic Library 1.3.0.0 (C1)
A post quantum secure library written in Ansi C
Loading...
Searching...
No Matches
qmac.h
Go to the documentation of this file.
1/*
2 * 2025 Quantum Resistant Cryptographic Solutions Corporation
3 * All Rights Reserved.
4 *
5 * NOTICE: This software and all accompanying materials are the exclusive
6 * property of Quantum Resistant Cryptographic Solutions Corporation (QRCS).
7 * The intellectual and technical concepts contained within this implementation
8 * are proprietary to QRCS and its authorized licensors and are protected under
9 * applicable U.S. and international copyright, patent, and trade secret laws.
10 *
11 * CRYPTOGRAPHIC STANDARDS:
12 * - This software includes implementations of cryptographic algorithms such as
13 * SHA3, AES, and others. These algorithms are public domain or standardized
14 * by organizations such as NIST and are NOT the property of QRCS.
15 * - However, all source code, optimizations, and implementations in this library
16 * are original works of QRCS and are protected under this license.
17 *
18 * RESTRICTIONS:
19 * - Redistribution, modification, or unauthorized distribution of this software,
20 * in whole or in part, is strictly prohibited.
21 * - This software is provided for non-commercial, educational, and research
22 * purposes only. Commercial use in any form is expressly forbidden.
23 * - Licensing and authorized distribution are solely at the discretion of QRCS.
24 * - Any use of this software implies acceptance of these restrictions.
25 *
26 * DISCLAIMER:
27 * This software is provided "as is," without warranty of any kind, express or
28 * implied, including but not limited to warranties of merchantability or fitness
29 * for a particular purpose. QRCS disclaims all liability for any direct, indirect,
30 * incidental, or consequential damages resulting from the use or misuse of this software.
31 *
32 * FULL LICENSE:
33 * This software is subject to the **Quantum Resistant Cryptographic Solutions
34 * Proprietary License (QRCS-PL)**. The complete license terms are included
35 * in the LICENSE.txt file distributed with this software.
36 *
37 * Written by: John G. Underhill
38 * Contact: contact@qrcscorp.ca
39 */
40
41#ifndef QSC_QMAC_H
42#define QSC_QMAC_H
43
44#include "qsccommon.h"
45
46QSC_CPLUSPLUS_ENABLED_START
47
71
76#define QSC_QMAC_BLOCK_SIZE 32ULL
77
82#define QSC_QMAC_KEY_SIZE 32ULL
83
88#define QSC_QMAC_MAC_SIZE 32ULL
89
94#define QSC_QMAC_NONCE_SIZE 32ULL
95
100#define QSC_QMAC_STATE_SIZE (QSC_QMAC_BLOCK_SIZE / sizeof(uint64_t))
101
116
123QSC_EXPORT_API typedef struct
124{
125 const uint8_t* key;
126 uint8_t* nonce;
127 const uint8_t* info;
128 size_t keylen;
129 size_t noncelen;
130 size_t infolen;
132
143QSC_EXPORT_API void qsc_qmac_compute(uint8_t* output, qsc_qmac_keyparams* keyparams, const uint8_t* message, size_t msglen);
144
153
164QSC_EXPORT_API void qsc_qmac_finalize(qsc_qmac_state* ctx, uint8_t* output);
165
175
185QSC_EXPORT_API void qsc_qmac_update(qsc_qmac_state* ctx, const uint8_t* message, size_t msglen);
186
187QSC_CPLUSPLUS_ENABLED_END
188
189#endif
#define QSC_QMAC_STATE_SIZE
The QMAC state size.
Definition qmac.h:100
QSC_EXPORT_API void qsc_qmac_dispose(qsc_qmac_state *ctx)
Dispose of the state.
Definition qmac.c:83
QSC_EXPORT_API void qsc_qmac_compute(uint8_t *output, qsc_qmac_keyparams *keyparams, const uint8_t *message, size_t msglen)
Compute the MAC code.
Definition qmac.c:66
QSC_EXPORT_API void qsc_qmac_initialize(qsc_qmac_state *ctx, qsc_qmac_keyparams *keyparams)
Initialize the state with the secret key.
Definition qmac.c:110
QSC_EXPORT_API void qsc_qmac_finalize(qsc_qmac_state *ctx, uint8_t *output)
Finalize the message state and return the MAC code.
Definition qmac.c:96
QSC_EXPORT_API void qsc_qmac_update(qsc_qmac_state *ctx, const uint8_t *message, size_t msglen)
Update the QMAC generator with a single block of message input.
Definition qmac.c:138
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 qsccommon.h:645
The key parameters structure containing key and info arrays and lengths.
Definition qmac.h:124
uint8_t * nonce
Definition qmac.h:126
const uint8_t * key
Definition qmac.h:125
size_t noncelen
Definition qmac.h:129
size_t infolen
Definition qmac.h:130
size_t keylen
Definition qmac.h:128
const uint8_t * info
Definition qmac.h:127
The QMAC state.
Definition qmac.h:110
uint64_t H[QSC_QMAC_STATE_SIZE]
Definition qmac.h:112
uint64_t Y[QSC_QMAC_STATE_SIZE]
Definition qmac.h:113
uint64_t F[QSC_QMAC_STATE_SIZE]
Definition qmac.h:111
bool initialized
Definition qmac.h:114