37 #ifndef WOLFCRYPT_BLAKE2_INT_H 38 #define WOLFCRYPT_BLAKE2_INT_H 44 #define ALIGN(x) __declspec(align(x)) 45 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__) 46 #define ALIGN(x) __attribute__((aligned(x))) 52 #if defined(__cplusplus) 58 BLAKE2S_BLOCKBYTES = 64,
59 BLAKE2S_OUTBYTES = 32,
60 BLAKE2S_KEYBYTES = 32,
61 BLAKE2S_SALTBYTES = 8,
62 BLAKE2S_PERSONALBYTES = 8
67 BLAKE2B_BLOCKBYTES = 128,
68 BLAKE2B_OUTBYTES = 64,
69 BLAKE2B_KEYBYTES = 64,
70 BLAKE2B_SALTBYTES = 16,
71 BLAKE2B_PERSONALBYTES = 16
86 byte salt[BLAKE2B_SALTBYTES];
87 byte personal[BLAKE2S_PERSONALBYTES];
90 ALIGN( 32 ) typedef struct __blake2s_state
95 byte buf[2 * BLAKE2S_BLOCKBYTES];
111 byte salt[BLAKE2B_SALTBYTES];
112 byte personal[BLAKE2B_PERSONALBYTES];
115 ALIGN( 64 ) typedef struct __blake2b_state
120 byte buf[2 * BLAKE2B_BLOCKBYTES];
127 blake2s_state S[8][1];
129 byte buf[8 * BLAKE2S_BLOCKBYTES];
135 blake2b_state S[4][1];
137 byte buf[4 * BLAKE2B_BLOCKBYTES];
143 int blake2s_init( blake2s_state *S,
const byte outlen );
144 int blake2s_init_key( blake2s_state *S,
const byte outlen,
const void *key,
const byte keylen );
145 int blake2s_init_param( blake2s_state *S,
const blake2s_param *P );
146 int blake2s_update( blake2s_state *S,
const byte *in, word32 inlen );
147 int blake2s_final( blake2s_state *S, byte *out, byte outlen );
149 int blake2b_init( blake2b_state *S,
const byte outlen );
150 int blake2b_init_key( blake2b_state *S,
const byte outlen,
const void *key,
const byte keylen );
151 int blake2b_init_param( blake2b_state *S,
const blake2b_param *P );
152 int blake2b_update( blake2b_state *S,
const byte *in, word64 inlen );
153 int blake2b_final( blake2b_state *S, byte *out, byte outlen );
156 int blake2sp_init_key(
blake2sp_state *S,
const byte outlen,
const void *key,
const byte keylen );
157 int blake2sp_update(
blake2sp_state *S,
const byte *in, word32 inlen );
161 int blake2bp_init_key(
blake2bp_state *S,
const byte outlen,
const void *key,
const byte keylen );
162 int blake2bp_update(
blake2bp_state *S,
const byte *in, word64 inlen );
166 int blake2s( byte *out,
const void *in,
const void *key,
const byte outlen,
const word32 inlen, byte keylen );
167 int blake2b( byte *out,
const void *in,
const void *key,
const byte outlen,
const word64 inlen, byte keylen );
169 int blake2sp( byte *out,
const void *in,
const void *key,
const byte outlen,
const word32 inlen, byte keylen );
170 int blake2bp( byte *out,
const void *in,
const void *key,
const byte outlen,
const word64 inlen, byte keylen );
172 static WC_INLINE
int blake2( byte *out,
const void *in,
const void *key,
const byte outlen,
const word64 inlen, byte keylen )
174 return blake2b( out, in, key, outlen, inlen, keylen );
179 #if defined(__cplusplus) Definition: blake2-int.h:75
Definition: blake2-int.h:100
Definition: blake2-int.h:133
Definition: blake2-int.h:125