35 lines
1.5 KiB
C
35 lines
1.5 KiB
C
/*
|
|
Implementation by the Keccak Team, namely, Guido Bertoni, Joan Daemen,
|
|
Michaël Peeters, Gilles Van Assche and Ronny Van Keer,
|
|
hereby denoted as "the implementer".
|
|
|
|
For more information, feedback or questions, please refer to our website:
|
|
https://keccak.team/
|
|
|
|
To the extent possible under law, the implementer has waived all copyright
|
|
and related or neighboring rights to the source code in this file.
|
|
http://creativecommons.org/publicdomain/zero/1.0/
|
|
*/
|
|
|
|
#ifndef _KeccakSpongeCommon_h_
|
|
#define _KeccakSpongeCommon_h_
|
|
|
|
#include <string.h>
|
|
#include "align.h"
|
|
|
|
#define KCP_DeclareSpongeStructure(prefix, size, alignment) \
|
|
ALIGN(alignment) typedef struct prefix##_SpongeInstanceStruct { \
|
|
unsigned char state[size]; \
|
|
unsigned int rate; \
|
|
unsigned int byteIOIndex; \
|
|
int squeezing; \
|
|
} prefix##_SpongeInstance;
|
|
|
|
#define KCP_DeclareSpongeFunctions(prefix) \
|
|
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); \
|
|
int prefix##_SpongeInitialize(prefix##_SpongeInstance *spongeInstance, unsigned int rate, unsigned int capacity); \
|
|
int prefix##_SpongeAbsorb(prefix##_SpongeInstance *spongeInstance, const unsigned char *data, size_t dataByteLen); \
|
|
int prefix##_SpongeAbsorbLastFewBits(prefix##_SpongeInstance *spongeInstance, unsigned char delimitedData); \
|
|
int prefix##_SpongeSqueeze(prefix##_SpongeInstance *spongeInstance, unsigned char *data, size_t dataByteLen);
|
|
|
|
#endif
|