ASCON Suite
hmac.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Southern Storm Software, Pty Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef ASCON_HMAC_H
24 #define ASCON_HMAC_H
25 
26 #include <ascon/hash.h>
27 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
53 #define ASCON_HMAC_SIZE ASCON_HASH_SIZE
54 
58 #define ASCON_HMACA_SIZE ASCON_HASHA_SIZE
59 
63 typedef struct
64 {
68 
72 typedef struct
73 {
77 
89  (unsigned char *out,
90  const unsigned char *key, size_t keylen,
91  const unsigned char *in, size_t inlen);
92 
106  (ascon_hmac_state_t *state, const unsigned char *key, size_t keylen);
107 
124  (ascon_hmac_state_t *state, const unsigned char *key, size_t keylen);
125 
132 
143  (ascon_hmac_state_t *state, const unsigned char *in, size_t inlen);
144 
157  (ascon_hmac_state_t *state, const unsigned char *key, size_t keylen,
158  unsigned char *out);
159 
171  (unsigned char *out,
172  const unsigned char *key, size_t keylen,
173  const unsigned char *in, size_t inlen);
174 
188  (ascon_hmaca_state_t *state, const unsigned char *key, size_t keylen);
189 
206  (ascon_hmaca_state_t *state, const unsigned char *key, size_t keylen);
207 
214 
225  (ascon_hmaca_state_t *state, const unsigned char *in, size_t inlen);
226 
239  (ascon_hmaca_state_t *state, const unsigned char *key, size_t keylen,
240  unsigned char *out);
241 
242 #ifdef __cplusplus
243 }
244 #endif
245 
246 #endif
ASCON-HASH and ASCON-HASHA hash algorithms.
void ascon_hmac_update(ascon_hmac_state_t *state, const unsigned char *in, size_t inlen)
Updates an incremental ASCON-HMAC state with more input data.
void ascon_hmaca_finalize(ascon_hmaca_state_t *state, const unsigned char *key, size_t keylen, unsigned char *out)
Finalizes an incremental ASCON-HMACA state.
void ascon_hmaca_reinit(ascon_hmaca_state_t *state, const unsigned char *key, size_t keylen)
Re-initializes an incremental HMAC state using ASCON-HASHA.
void ascon_hmaca_update(ascon_hmaca_state_t *state, const unsigned char *in, size_t inlen)
Updates an incremental ASCON-HMACA state with more input data.
void ascon_hmac_reinit(ascon_hmac_state_t *state, const unsigned char *key, size_t keylen)
Re-initializes an incremental HMAC state using ASCON-HASH.
void ascon_hmaca_init(ascon_hmaca_state_t *state, const unsigned char *key, size_t keylen)
Initializes an incremental HMAC state using ASCON-HASHA.
void ascon_hmac_init(ascon_hmac_state_t *state, const unsigned char *key, size_t keylen)
Initializes an incremental HMAC state using ASCON-HASH.
void ascon_hmac_finalize(ascon_hmac_state_t *state, const unsigned char *key, size_t keylen, unsigned char *out)
Finalizes an incremental ASCON-HMAC state.
void ascon_hmaca_free(ascon_hmaca_state_t *state)
Frees the ASCON-HMACA state and destroys any sensitive material.
void ascon_hmac(unsigned char *out, const unsigned char *key, size_t keylen, const unsigned char *in, size_t inlen)
Computes a HMAC value using ASCON-HASH.
void ascon_hmaca(unsigned char *out, const unsigned char *key, size_t keylen, const unsigned char *in, size_t inlen)
Computes a HMAC value using ASCON-HASHA.
void ascon_hmac_free(ascon_hmac_state_t *state)
Frees the ASCON-HMAC state and destroys any sensitive material.
ascon_state_t state
[snippet_key]
Definition: snippets.c:2
State information for the ASCON-HASH incremental mode.
Definition: hash.h:43
State information for the ASCON-HASHA incremental mode.
Definition: hash.h:52
State information for the ASCON-HMAC incremental mode.
Definition: hmac.h:64
ascon_hash_state_t hash
Definition: hmac.h:65
State information for the ASCON-HMACA incremental mode.
Definition: hmac.h:73
ascon_hasha_state_t hash
Definition: hmac.h:74