Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
sparkle-hmac.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 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 LWCRYPTO_SPARKLE_HMAC_H
24 #define LWCRYPTO_SPARKLE_HMAC_H
25 
26 #include "sparkle-hash.h"
27 #include <stddef.h>
28 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
55 #define ESCH_256_HMAC_SIZE ESCH_256_HASH_SIZE
56 
60 #define ESCH_384_HMAC_SIZE ESCH_384_HASH_SIZE
61 
66 
71 
82 void esch_256_hmac
83  (unsigned char *out,
84  const unsigned char *key, size_t keylen,
85  const unsigned char *in, size_t inlen);
86 
100  (esch_256_hmac_state_t *state, const unsigned char *key, size_t keylen);
101 
112  (esch_256_hmac_state_t *state, const unsigned char *in, size_t inlen);
113 
126  (esch_256_hmac_state_t *state, const unsigned char *key, size_t keylen,
127  unsigned char *out);
128 
139 void esch_384_hmac
140  (unsigned char *out,
141  const unsigned char *key, size_t keylen,
142  const unsigned char *in, size_t inlen);
143 
157  (esch_384_hmac_state_t *state, const unsigned char *key, size_t keylen);
158 
169  (esch_384_hmac_state_t *state, const unsigned char *in, size_t inlen);
170 
183  (esch_384_hmac_state_t *state, const unsigned char *key, size_t keylen,
184  unsigned char *out);
185 
186 #ifdef __cplusplus
187 }
188 #endif
189 
190 #endif
void esch_384_hmac_init(esch_384_hmac_state_t *state, const unsigned char *key, size_t keylen)
Initializes an incremental HMAC state using Esch384.
void esch_256_hmac_update(esch_256_hmac_state_t *state, const unsigned char *in, size_t inlen)
Updates an incremental Esch256-HMAC state with more input data.
Hash algorithms based on the SPARKLE permutation.
void esch_384_hmac(unsigned char *out, const unsigned char *key, size_t keylen, const unsigned char *in, size_t inlen)
Computes a HMAC value using Esch384.
State information for the Esch384 incremental hash mod ande the XOEsch384 increment XOF mode...
Definition: sparkle-hash.h:90
esch_384_hash_state_t esch_384_hmac_state_t
State information for the Esch384-HMAC incremental mode.
Definition: sparkle-hmac.h:70
void esch_384_hmac_finalize(esch_384_hmac_state_t *state, const unsigned char *key, size_t keylen, unsigned char *out)
Finalizes an incremental Esch384-HMAC state.
void esch_256_hmac_init(esch_256_hmac_state_t *state, const unsigned char *key, size_t keylen)
Initializes an incremental HMAC state using Esch256.
void esch_384_hmac_update(esch_384_hmac_state_t *state, const unsigned char *in, size_t inlen)
Updates an incremental Esch384-HMAC state with more input data.
State information for the Esch256 incremental hash mode and the XOEsch256 increment XOF mode...
Definition: sparkle-hash.h:74
void esch_256_hmac_finalize(esch_256_hmac_state_t *state, const unsigned char *key, size_t keylen, unsigned char *out)
Finalizes an incremental Esch256-HMAC state.
esch_256_hash_state_t esch_256_hmac_state_t
State information for the Esch256-HMAC incremental mode.
Definition: sparkle-hmac.h:65
void esch_256_hmac(unsigned char *out, const unsigned char *key, size_t keylen, const unsigned char *in, size_t inlen)
Computes a HMAC value using Esch256.