Changeset View
Changeset View
Standalone View
Standalone View
sys/crypto/skein/skein.h
Show All 26 Lines | |||||
** 1: return SKEIN_FAIL to flag errors | ** 1: return SKEIN_FAIL to flag errors | ||||
** | ** | ||||
***************************************************************************/ | ***************************************************************************/ | ||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
extern "C" | extern "C" | ||||
{ | { | ||||
#endif | #endif | ||||
#ifndef _KERNEL | |||||
#include <stddef.h> /* get size_t definition */ | #include <stddef.h> /* get size_t definition */ | ||||
#endif | |||||
#include "skein_port.h" /* get platform-specific definitions */ | #include "skein_port.h" /* get platform-specific definitions */ | ||||
enum | enum | ||||
{ | { | ||||
SKEIN_SUCCESS = 0, /* return codes from Skein calls */ | SKEIN_SUCCESS = 0, /* return codes from Skein calls */ | ||||
SKEIN_FAIL = 1, | SKEIN_FAIL = 1, | ||||
SKEIN_BAD_HASHLEN = 2 | SKEIN_BAD_HASHLEN = 2 | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
int Skein_256_Init (Skein_256_Ctxt_t *ctx, size_t hashBitLen); | int Skein_256_Init (Skein_256_Ctxt_t *ctx, size_t hashBitLen); | ||||
int Skein_512_Init (Skein_512_Ctxt_t *ctx, size_t hashBitLen); | int Skein_512_Init (Skein_512_Ctxt_t *ctx, size_t hashBitLen); | ||||
int Skein1024_Init (Skein1024_Ctxt_t *ctx, size_t hashBitLen); | int Skein1024_Init (Skein1024_Ctxt_t *ctx, size_t hashBitLen); | ||||
int Skein_256_Update(Skein_256_Ctxt_t *ctx, const u08b_t *msg, size_t msgByteCnt); | int Skein_256_Update(Skein_256_Ctxt_t *ctx, const u08b_t *msg, size_t msgByteCnt); | ||||
int Skein_512_Update(Skein_512_Ctxt_t *ctx, const u08b_t *msg, size_t msgByteCnt); | int Skein_512_Update(Skein_512_Ctxt_t *ctx, const u08b_t *msg, size_t msgByteCnt); | ||||
int Skein1024_Update(Skein1024_Ctxt_t *ctx, const u08b_t *msg, size_t msgByteCnt); | int Skein1024_Update(Skein1024_Ctxt_t *ctx, const u08b_t *msg, size_t msgByteCnt); | ||||
int Skein_256_Final (Skein_256_Ctxt_t *ctx, u08b_t * hashVal); | int Skein_256_Final (Skein_256_Ctxt_t *ctx, u08b_t * hashVal); | ||||
int Skein_512_Final (Skein_512_Ctxt_t *ctx, u08b_t * hashVal); | int Skein_512_Final (Skein_512_Ctxt_t *ctx, u08b_t * hashVal); | ||||
int Skein1024_Final (Skein1024_Ctxt_t *ctx, u08b_t * hashVal); | int Skein1024_Final (Skein1024_Ctxt_t *ctx, u08b_t * hashVal); | ||||
cem: I'd prefer array-style output, e.g.,
```
int Skein_256_Final(Skein_256_Ctxt_t *, u08b_t[static… | |||||
/* | /* | ||||
** Skein APIs for "extended" initialization: MAC keys, tree hashing. | ** Skein APIs for "extended" initialization: MAC keys, tree hashing. | ||||
** After an InitExt() call, just use Update/Final calls as with Init(). | ** After an InitExt() call, just use Update/Final calls as with Init(). | ||||
** | ** | ||||
** Notes: Same parameters as _Init() calls, plus treeInfo/key/keyBytes. | ** Notes: Same parameters as _Init() calls, plus treeInfo/key/keyBytes. | ||||
** When keyBytes == 0 and treeInfo == SKEIN_SEQUENTIAL, | ** When keyBytes == 0 and treeInfo == SKEIN_SEQUENTIAL, | ||||
** the results of InitExt() are identical to calling Init(). | ** the results of InitExt() are identical to calling Init(). | ||||
▲ Show 20 Lines • Show All 206 Lines • ▼ Show 20 Lines | |||||
#define SKEIN_256_ROUNDS_TOTAL (8*((((SKEIN_ROUNDS/100) + 5) % 10) + 5)) | #define SKEIN_256_ROUNDS_TOTAL (8*((((SKEIN_ROUNDS/100) + 5) % 10) + 5)) | ||||
#define SKEIN_512_ROUNDS_TOTAL (8*((((SKEIN_ROUNDS/ 10) + 5) % 10) + 5)) | #define SKEIN_512_ROUNDS_TOTAL (8*((((SKEIN_ROUNDS/ 10) + 5) % 10) + 5)) | ||||
#define SKEIN1024_ROUNDS_TOTAL (8*((((SKEIN_ROUNDS ) + 5) % 10) + 5)) | #define SKEIN1024_ROUNDS_TOTAL (8*((((SKEIN_ROUNDS ) + 5) % 10) + 5)) | ||||
#endif | #endif | ||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
} | } | ||||
#endif | #endif | ||||
/* Pull in FreeBSD specific shims */ | |||||
#include "skein_freebsd.h" | |||||
#endif /* ifndef _SKEIN_H_ */ | #endif /* ifndef _SKEIN_H_ */ |
I'd prefer array-style output, e.g.,