16 #ifndef _KeccakSponge_h_
17 #define _KeccakSponge_h_
42 #ifdef DontReallyInclude_DocumentationOnly
67 int Prefix_Sponge(
unsigned int rate,
unsigned int capacity,
const unsigned char* input,
size_t inputByteLen,
unsigned char suffix,
68 unsigned char* output,
size_t outputByteLen);
80 int Prefix_SpongeInitialize(Prefix_SpongeInstance* spongeInstance,
unsigned int rate,
unsigned int capacity);
92 int Prefix_SpongeAbsorb(Prefix_SpongeInstance* spongeInstance,
const unsigned char* data,
size_t dataByteLen);
116 int Prefix_SpongeAbsorbLastFewBits(Prefix_SpongeInstance* spongeInstance,
unsigned char delimitedData);
128 int Prefix_SpongeSqueeze(Prefix_SpongeInstance* spongeInstance,
unsigned char* data,
size_t dataByteLen);
134 #define KCP_DeclareSpongeStructure(prefix, size, alignment) \
135 ALIGN(alignment) typedef struct prefix##_SpongeInstanceStruct { \
136 unsigned char state[size]; \
138 unsigned int byteIOIndex; \
140 } prefix##_SpongeInstance;
142 #define KCP_DeclareSpongeFunctions(prefix) \
143 int prefix##_Sponge(unsigned int rate, unsigned int capacity, const unsigned char *input, size_t inputByteLen, unsigned char suffix, unsigned char *output, size_t outputByteLen); \
144 int prefix##_SpongeInitialize(prefix##_SpongeInstance *spongeInstance, unsigned int rate, unsigned int capacity); \
145 int prefix##_SpongeAbsorb(prefix##_SpongeInstance *spongeInstance, const unsigned char *data, size_t dataByteLen); \
146 int prefix##_SpongeAbsorbLastFewBits(prefix##_SpongeInstance *spongeInstance, unsigned char delimitedData); \
147 int prefix##_SpongeSqueeze(prefix##_SpongeInstance *spongeInstance, unsigned char *data, size_t dataByteLen);
149 #ifndef KeccakP200_excluded
150 #include "KeccakP-200-SnP.h"
151 KCP_DeclareSpongeStructure(KeccakWidth200, KeccakP200_stateSizeInBytes, KeccakP200_stateAlignment)
152 KCP_DeclareSpongeFunctions(KeccakWidth200)
155 #ifndef KeccakP400_excluded
156 #include "KeccakP-400-SnP.h"
157 KCP_DeclareSpongeStructure(KeccakWidth400, KeccakP400_stateSizeInBytes, KeccakP400_stateAlignment)
158 KCP_DeclareSpongeFunctions(KeccakWidth400)
161 #ifndef KeccakP800_excluded
162 #include "KeccakP-800-SnP.h"
163 KCP_DeclareSpongeStructure(KeccakWidth800, KeccakP800_stateSizeInBytes, KeccakP800_stateAlignment)
164 KCP_DeclareSpongeFunctions(KeccakWidth800)
167 #ifndef KeccakP1600_excluded
168 #include "KeccakP-1600-SnP.h"
169 KCP_DeclareSpongeStructure(KeccakWidth1600, KeccakP1600_stateSizeInBytes, KeccakP1600_stateAlignment)
170 KCP_DeclareSpongeFunctions(KeccakWidth1600)
173 #ifndef KeccakP1600_excluded
174 #include "KeccakP-1600-SnP.h"
175 KCP_DeclareSpongeStructure(KeccakWidth1600_12rounds, KeccakP1600_stateSizeInBytes, KeccakP1600_stateAlignment)
176 KCP_DeclareSpongeFunctions(KeccakWidth1600_12rounds)