Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
ascon-xof.h
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_ASCON_XOF_H
24 #define LWCRYPTO_ASCON_XOF_H
25 
33 #include <stddef.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
43 #define ASCON_HASH_SIZE 32
44 
49 #define ASCON_XOF_RATE 8
50 
54 typedef union
55 {
56  struct {
57  unsigned char state[40];
58  unsigned char count;
59  unsigned char mode;
60  } s;
61  unsigned long long align;
64 
81 int ascon_xof
82  (unsigned char *out, const unsigned char *in, size_t inlen);
83 
91 void ascon_xof_init(ascon_xof_state_t *state);
92 
106 void ascon_xof_init_fixed(ascon_xof_state_t *state, size_t outlen);
107 
117 void ascon_xof_absorb
118  (ascon_xof_state_t *state, const unsigned char *in, size_t inlen);
119 
129 void ascon_xof_squeeze
130  (ascon_xof_state_t *state, unsigned char *out, size_t outlen);
131 
142 void ascon_xof_pad(ascon_xof_state_t *state);
143 
160 int ascon_xofa
161  (unsigned char *out, const unsigned char *in, size_t inlen);
162 
170 void ascon_xofa_init(ascon_xof_state_t *state);
171 
185 void ascon_xofa_init_fixed(ascon_xof_state_t *state, size_t outlen);
186 
196 void ascon_xofa_absorb
197  (ascon_xof_state_t *state, const unsigned char *in, size_t inlen);
198 
208 void ascon_xofa_squeeze
209  (ascon_xof_state_t *state, unsigned char *out, size_t outlen);
210 
221 void ascon_xofa_pad(ascon_xof_state_t *state);
222 
223 #ifdef __cplusplus
224 }
225 #endif
226 
227 #endif
State information for ASCON-XOF and ASCON-XOFA incremental modes.
Definition: ascon-xof.h:54
unsigned char mode
Definition: ascon-xof.h:59
unsigned char count
Definition: ascon-xof.h:58
unsigned long long align
Definition: ascon-xof.h:61