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 All 14 Lines | |||||
#define SKEIN1024_STATE_BITS (64*SKEIN1024_STATE_WORDS) | #define SKEIN1024_STATE_BITS (64*SKEIN1024_STATE_WORDS) | ||||
#define SKEIN_256_BLOCK_BYTES ( 8*SKEIN_256_STATE_WORDS) | #define SKEIN_256_BLOCK_BYTES ( 8*SKEIN_256_STATE_WORDS) | ||||
#define SKEIN_512_BLOCK_BYTES ( 8*SKEIN_512_STATE_WORDS) | #define SKEIN_512_BLOCK_BYTES ( 8*SKEIN_512_STATE_WORDS) | ||||
#define SKEIN1024_BLOCK_BYTES ( 8*SKEIN1024_STATE_WORDS) | #define SKEIN1024_BLOCK_BYTES ( 8*SKEIN1024_STATE_WORDS) | ||||
typedef struct | typedef struct | ||||
{ | { | ||||
size_t hashBitLen; /* size of hash result, in bits */ | size_t hashBitLen; /* size of hash result, in bits */ | ||||
size_t bCnt; /* current byte count in buffer b[] */ | size_t bCnt; /* current byte count in buffer b[] */ | ||||
u64b_t T[SKEIN_MODIFIER_WORDS]; /* tweak words: T[0]=byte cnt, T[1]=flags */ | u_int64_t T[SKEIN_MODIFIER_WORDS]; /* tweak words: T[0]=byte cnt, T[1]=flags */ | ||||
} Skein_Ctxt_Hdr_t; | } Skein_Ctxt_Hdr_t; | ||||
typedef struct /* 256-bit Skein hash context structure */ | typedef struct /* 256-bit Skein hash context structure */ | ||||
{ | { | ||||
Skein_Ctxt_Hdr_t h; /* common header context variables */ | Skein_Ctxt_Hdr_t h; /* common header context variables */ | ||||
u64b_t X[SKEIN_256_STATE_WORDS]; /* chaining variables */ | u_int64_t X[SKEIN_256_STATE_WORDS]; /* chaining variables */ | ||||
u08b_t b[SKEIN_256_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ | u_int8_t b[SKEIN_256_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ | ||||
} Skein_256_Ctxt_t; | } Skein_256_Ctxt_t; | ||||
typedef struct /* 512-bit Skein hash context structure */ | typedef struct /* 512-bit Skein hash context structure */ | ||||
{ | { | ||||
Skein_Ctxt_Hdr_t h; /* common header context variables */ | Skein_Ctxt_Hdr_t h; /* common header context variables */ | ||||
u64b_t X[SKEIN_512_STATE_WORDS]; /* chaining variables */ | u_int64_t X[SKEIN_512_STATE_WORDS]; /* chaining variables */ | ||||
u08b_t b[SKEIN_512_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ | u_int8_t b[SKEIN_512_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ | ||||
} Skein_512_Ctxt_t; | } Skein_512_Ctxt_t; | ||||
typedef struct /* 1024-bit Skein hash context structure */ | typedef struct /* 1024-bit Skein hash context structure */ | ||||
{ | { | ||||
Skein_Ctxt_Hdr_t h; /* common header context variables */ | Skein_Ctxt_Hdr_t h; /* common header context variables */ | ||||
u64b_t X[SKEIN1024_STATE_WORDS]; /* chaining variables */ | u_int64_t X[SKEIN1024_STATE_WORDS]; /* chaining variables */ | ||||
u08b_t b[SKEIN1024_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ | u_int8_t b[SKEIN1024_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ | ||||
} Skein1024_Ctxt_t; | } Skein1024_Ctxt_t; | ||||
/* Skein APIs for (incremental) "straight hashing" */ | /* Skein APIs for (incremental) "straight hashing" */ | ||||
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 u_int8_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 u_int8_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 u_int8_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, u_int8_t *hashVal); | ||||
int Skein_512_Final (Skein_512_Ctxt_t *ctx, u08b_t * hashVal); | int Skein_512_Final (Skein_512_Ctxt_t *ctx, u_int8_t *hashVal); | ||||
int Skein1024_Final (Skein1024_Ctxt_t *ctx, u08b_t * hashVal); | int Skein1024_Final (Skein1024_Ctxt_t *ctx, u_int8_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(). | ||||
** The function Init() may be called once to "precompute" the IV for | ** The function Init() may be called once to "precompute" the IV for | ||||
** a given hashBitLen value, then by saving a copy of the context | ** a given hashBitLen value, then by saving a copy of the context | ||||
** the IV computation may be avoided in later calls. | ** the IV computation may be avoided in later calls. | ||||
** Similarly, the function InitExt() may be called once per MAC key | ** Similarly, the function InitExt() may be called once per MAC key | ||||
** to precompute the MAC IV, then a copy of the context saved and | ** to precompute the MAC IV, then a copy of the context saved and | ||||
** reused for each new MAC computation. | ** reused for each new MAC computation. | ||||
**/ | **/ | ||||
int Skein_256_InitExt(Skein_256_Ctxt_t *ctx, size_t hashBitLen, u64b_t treeInfo, const u08b_t *key, size_t keyBytes); | int Skein_256_InitExt(Skein_256_Ctxt_t *ctx, size_t hashBitLen, u_int64_t treeInfo, const u_int8_t *key, size_t keyBytes); | ||||
int Skein_512_InitExt(Skein_512_Ctxt_t *ctx, size_t hashBitLen, u64b_t treeInfo, const u08b_t *key, size_t keyBytes); | int Skein_512_InitExt(Skein_512_Ctxt_t *ctx, size_t hashBitLen, u_int64_t treeInfo, const u_int8_t *key, size_t keyBytes); | ||||
int Skein1024_InitExt(Skein1024_Ctxt_t *ctx, size_t hashBitLen, u64b_t treeInfo, const u08b_t *key, size_t keyBytes); | int Skein1024_InitExt(Skein1024_Ctxt_t *ctx, size_t hashBitLen, u_int64_t treeInfo, const u_int8_t *key, size_t keyBytes); | ||||
/* | /* | ||||
** Skein APIs for MAC and tree hash: | ** Skein APIs for MAC and tree hash: | ||||
** Final_Pad: pad, do final block, but no OUTPUT type | ** Final_Pad: pad, do final block, but no OUTPUT type | ||||
** Output: do just the output stage | ** Output: do just the output stage | ||||
*/ | */ | ||||
int Skein_256_Final_Pad(Skein_256_Ctxt_t *ctx, u08b_t * hashVal); | int Skein_256_Final_Pad(Skein_256_Ctxt_t *ctx, u_int8_t *hashVal); | ||||
int Skein_512_Final_Pad(Skein_512_Ctxt_t *ctx, u08b_t * hashVal); | int Skein_512_Final_Pad(Skein_512_Ctxt_t *ctx, u_int8_t *hashVal); | ||||
int Skein1024_Final_Pad(Skein1024_Ctxt_t *ctx, u08b_t * hashVal); | int Skein1024_Final_Pad(Skein1024_Ctxt_t *ctx, u_int8_t *hashVal); | ||||
#ifndef SKEIN_TREE_HASH | #ifndef SKEIN_TREE_HASH | ||||
#define SKEIN_TREE_HASH (1) | #define SKEIN_TREE_HASH (1) | ||||
#endif | #endif | ||||
#if SKEIN_TREE_HASH | #if SKEIN_TREE_HASH | ||||
int Skein_256_Output (Skein_256_Ctxt_t *ctx, u08b_t * hashVal); | int Skein_256_Output (Skein_256_Ctxt_t *ctx, u_int8_t *hashVal); | ||||
int Skein_512_Output (Skein_512_Ctxt_t *ctx, u08b_t * hashVal); | int Skein_512_Output (Skein_512_Ctxt_t *ctx, u_int8_t *hashVal); | ||||
int Skein1024_Output (Skein1024_Ctxt_t *ctx, u08b_t * hashVal); | int Skein1024_Output (Skein1024_Ctxt_t *ctx, u_int8_t *hashVal); | ||||
#endif | #endif | ||||
/***************************************************************** | /***************************************************************** | ||||
** "Internal" Skein definitions | ** "Internal" Skein definitions | ||||
** -- not needed for sequential hashing API, but will be | ** -- not needed for sequential hashing API, but will be | ||||
** helpful for other uses of Skein (e.g., tree hash mode). | ** helpful for other uses of Skein (e.g., tree hash mode). | ||||
** -- included here so that they can be shared between | ** -- included here so that they can be shared between | ||||
** reference and optimized code. | ** reference and optimized code. | ||||
******************************************************************/ | ******************************************************************/ | ||||
/* tweak word T[1]: bit field starting positions */ | /* tweak word T[1]: bit field starting positions */ | ||||
#define SKEIN_T1_BIT(BIT) ((BIT) - 64) /* offset 64 because it's the second word */ | #define SKEIN_T1_BIT(BIT) ((BIT) - 64) /* offset 64 because it's the second word */ | ||||
#define SKEIN_T1_POS_TREE_LVL SKEIN_T1_BIT(112) /* bits 112..118: level in hash tree */ | #define SKEIN_T1_POS_TREE_LVL SKEIN_T1_BIT(112) /* bits 112..118: level in hash tree */ | ||||
#define SKEIN_T1_POS_BIT_PAD SKEIN_T1_BIT(119) /* bit 119 : partial final input byte */ | #define SKEIN_T1_POS_BIT_PAD SKEIN_T1_BIT(119) /* bit 119 : partial final input byte */ | ||||
#define SKEIN_T1_POS_BLK_TYPE SKEIN_T1_BIT(120) /* bits 120..125: type field */ | #define SKEIN_T1_POS_BLK_TYPE SKEIN_T1_BIT(120) /* bits 120..125: type field */ | ||||
#define SKEIN_T1_POS_FIRST SKEIN_T1_BIT(126) /* bits 126 : first block flag */ | #define SKEIN_T1_POS_FIRST SKEIN_T1_BIT(126) /* bits 126 : first block flag */ | ||||
#define SKEIN_T1_POS_FINAL SKEIN_T1_BIT(127) /* bit 127 : final block flag */ | #define SKEIN_T1_POS_FINAL SKEIN_T1_BIT(127) /* bit 127 : final block flag */ | ||||
/* tweak word T[1]: flag bit definition(s) */ | /* tweak word T[1]: flag bit definition(s) */ | ||||
#define SKEIN_T1_FLAG_FIRST (((u64b_t) 1 ) << SKEIN_T1_POS_FIRST) | #define SKEIN_T1_FLAG_FIRST (((u_int64_t) 1 ) << SKEIN_T1_POS_FIRST) | ||||
#define SKEIN_T1_FLAG_FINAL (((u64b_t) 1 ) << SKEIN_T1_POS_FINAL) | #define SKEIN_T1_FLAG_FINAL (((u_int64_t) 1 ) << SKEIN_T1_POS_FINAL) | ||||
#define SKEIN_T1_FLAG_BIT_PAD (((u64b_t) 1 ) << SKEIN_T1_POS_BIT_PAD) | #define SKEIN_T1_FLAG_BIT_PAD (((u_int64_t) 1 ) << SKEIN_T1_POS_BIT_PAD) | ||||
/* tweak word T[1]: tree level bit field mask */ | /* tweak word T[1]: tree level bit field mask */ | ||||
#define SKEIN_T1_TREE_LVL_MASK (((u64b_t)0x7F) << SKEIN_T1_POS_TREE_LVL) | #define SKEIN_T1_TREE_LVL_MASK (((u_int64_t)0x7F) << SKEIN_T1_POS_TREE_LVL) | ||||
#define SKEIN_T1_TREE_LEVEL(n) (((u64b_t) (n)) << SKEIN_T1_POS_TREE_LVL) | #define SKEIN_T1_TREE_LEVEL(n) (((u_int64_t) (n)) << SKEIN_T1_POS_TREE_LVL) | ||||
/* tweak word T[1]: block type field */ | /* tweak word T[1]: block type field */ | ||||
#define SKEIN_BLK_TYPE_KEY ( 0) /* key, for MAC and KDF */ | #define SKEIN_BLK_TYPE_KEY ( 0) /* key, for MAC and KDF */ | ||||
#define SKEIN_BLK_TYPE_CFG ( 4) /* configuration block */ | #define SKEIN_BLK_TYPE_CFG ( 4) /* configuration block */ | ||||
#define SKEIN_BLK_TYPE_PERS ( 8) /* personalization string */ | #define SKEIN_BLK_TYPE_PERS ( 8) /* personalization string */ | ||||
#define SKEIN_BLK_TYPE_PK (12) /* public key (for digital signature hashing) */ | #define SKEIN_BLK_TYPE_PK (12) /* public key (for digital signature hashing) */ | ||||
#define SKEIN_BLK_TYPE_KDF (16) /* key identifier for KDF */ | #define SKEIN_BLK_TYPE_KDF (16) /* key identifier for KDF */ | ||||
#define SKEIN_BLK_TYPE_NONCE (20) /* nonce for PRNG */ | #define SKEIN_BLK_TYPE_NONCE (20) /* nonce for PRNG */ | ||||
#define SKEIN_BLK_TYPE_MSG (48) /* message processing */ | #define SKEIN_BLK_TYPE_MSG (48) /* message processing */ | ||||
#define SKEIN_BLK_TYPE_OUT (63) /* output stage */ | #define SKEIN_BLK_TYPE_OUT (63) /* output stage */ | ||||
#define SKEIN_BLK_TYPE_MASK (63) /* bit field mask */ | #define SKEIN_BLK_TYPE_MASK (63) /* bit field mask */ | ||||
#define SKEIN_T1_BLK_TYPE(T) (((u64b_t) (SKEIN_BLK_TYPE_##T)) << SKEIN_T1_POS_BLK_TYPE) | #define SKEIN_T1_BLK_TYPE(T) (((u_int64_t) (SKEIN_BLK_TYPE_##T)) << SKEIN_T1_POS_BLK_TYPE) | ||||
#define SKEIN_T1_BLK_TYPE_KEY SKEIN_T1_BLK_TYPE(KEY) /* key, for MAC and KDF */ | #define SKEIN_T1_BLK_TYPE_KEY SKEIN_T1_BLK_TYPE(KEY) /* key, for MAC and KDF */ | ||||
#define SKEIN_T1_BLK_TYPE_CFG SKEIN_T1_BLK_TYPE(CFG) /* configuration block */ | #define SKEIN_T1_BLK_TYPE_CFG SKEIN_T1_BLK_TYPE(CFG) /* configuration block */ | ||||
#define SKEIN_T1_BLK_TYPE_PERS SKEIN_T1_BLK_TYPE(PERS) /* personalization string */ | #define SKEIN_T1_BLK_TYPE_PERS SKEIN_T1_BLK_TYPE(PERS) /* personalization string */ | ||||
#define SKEIN_T1_BLK_TYPE_PK SKEIN_T1_BLK_TYPE(PK) /* public key (for digital signature hashing) */ | #define SKEIN_T1_BLK_TYPE_PK SKEIN_T1_BLK_TYPE(PK) /* public key (for digital signature hashing) */ | ||||
#define SKEIN_T1_BLK_TYPE_KDF SKEIN_T1_BLK_TYPE(KDF) /* key identifier for KDF */ | #define SKEIN_T1_BLK_TYPE_KDF SKEIN_T1_BLK_TYPE(KDF) /* key identifier for KDF */ | ||||
#define SKEIN_T1_BLK_TYPE_NONCE SKEIN_T1_BLK_TYPE(NONCE)/* nonce for PRNG */ | #define SKEIN_T1_BLK_TYPE_NONCE SKEIN_T1_BLK_TYPE(NONCE)/* nonce for PRNG */ | ||||
#define SKEIN_T1_BLK_TYPE_MSG SKEIN_T1_BLK_TYPE(MSG) /* message processing */ | #define SKEIN_T1_BLK_TYPE_MSG SKEIN_T1_BLK_TYPE(MSG) /* message processing */ | ||||
#define SKEIN_T1_BLK_TYPE_OUT SKEIN_T1_BLK_TYPE(OUT) /* output stage */ | #define SKEIN_T1_BLK_TYPE_OUT SKEIN_T1_BLK_TYPE(OUT) /* output stage */ | ||||
#define SKEIN_T1_BLK_TYPE_MASK SKEIN_T1_BLK_TYPE(MASK) /* field bit mask */ | #define SKEIN_T1_BLK_TYPE_MASK SKEIN_T1_BLK_TYPE(MASK) /* field bit mask */ | ||||
#define SKEIN_T1_BLK_TYPE_CFG_FINAL (SKEIN_T1_BLK_TYPE_CFG | SKEIN_T1_FLAG_FINAL) | #define SKEIN_T1_BLK_TYPE_CFG_FINAL (SKEIN_T1_BLK_TYPE_CFG | SKEIN_T1_FLAG_FINAL) | ||||
#define SKEIN_T1_BLK_TYPE_OUT_FINAL (SKEIN_T1_BLK_TYPE_OUT | SKEIN_T1_FLAG_FINAL) | #define SKEIN_T1_BLK_TYPE_OUT_FINAL (SKEIN_T1_BLK_TYPE_OUT | SKEIN_T1_FLAG_FINAL) | ||||
#define SKEIN_VERSION (1) | #define SKEIN_VERSION (1) | ||||
#ifndef SKEIN_ID_STRING_LE /* allow compile-time personalization */ | #ifndef SKEIN_ID_STRING_LE /* allow compile-time personalization */ | ||||
#define SKEIN_ID_STRING_LE (0x33414853) /* "SHA3" (little-endian)*/ | #define SKEIN_ID_STRING_LE (0x33414853) /* "SHA3" (little-endian)*/ | ||||
#endif | #endif | ||||
#define SKEIN_MK_64(hi32,lo32) ((lo32) + (((u64b_t) (hi32)) << 32)) | #define SKEIN_MK_64(hi32,lo32) ((lo32) + (((u_int64_t) (hi32)) << 32)) | ||||
#define SKEIN_SCHEMA_VER SKEIN_MK_64(SKEIN_VERSION,SKEIN_ID_STRING_LE) | #define SKEIN_SCHEMA_VER SKEIN_MK_64(SKEIN_VERSION,SKEIN_ID_STRING_LE) | ||||
#define SKEIN_KS_PARITY SKEIN_MK_64(0x1BD11BDA,0xA9FC1A22) | #define SKEIN_KS_PARITY SKEIN_MK_64(0x1BD11BDA,0xA9FC1A22) | ||||
#define SKEIN_CFG_STR_LEN (4*8) | #define SKEIN_CFG_STR_LEN (4*8) | ||||
/* bit field definitions in config block treeInfo word */ | /* bit field definitions in config block treeInfo word */ | ||||
#define SKEIN_CFG_TREE_LEAF_SIZE_POS ( 0) | #define SKEIN_CFG_TREE_LEAF_SIZE_POS ( 0) | ||||
#define SKEIN_CFG_TREE_NODE_SIZE_POS ( 8) | #define SKEIN_CFG_TREE_NODE_SIZE_POS ( 8) | ||||
#define SKEIN_CFG_TREE_MAX_LEVEL_POS (16) | #define SKEIN_CFG_TREE_MAX_LEVEL_POS (16) | ||||
#define SKEIN_CFG_TREE_LEAF_SIZE_MSK (((u64b_t) 0xFF) << SKEIN_CFG_TREE_LEAF_SIZE_POS) | #define SKEIN_CFG_TREE_LEAF_SIZE_MSK (((u_int64_t) 0xFF) << SKEIN_CFG_TREE_LEAF_SIZE_POS) | ||||
#define SKEIN_CFG_TREE_NODE_SIZE_MSK (((u64b_t) 0xFF) << SKEIN_CFG_TREE_NODE_SIZE_POS) | #define SKEIN_CFG_TREE_NODE_SIZE_MSK (((u_int64_t) 0xFF) << SKEIN_CFG_TREE_NODE_SIZE_POS) | ||||
#define SKEIN_CFG_TREE_MAX_LEVEL_MSK (((u64b_t) 0xFF) << SKEIN_CFG_TREE_MAX_LEVEL_POS) | #define SKEIN_CFG_TREE_MAX_LEVEL_MSK (((u_int64_t) 0xFF) << SKEIN_CFG_TREE_MAX_LEVEL_POS) | ||||
#define SKEIN_CFG_TREE_INFO(leaf,node,maxLvl) \ | #define SKEIN_CFG_TREE_INFO(leaf,node,maxLvl) \ | ||||
( (((u64b_t)(leaf )) << SKEIN_CFG_TREE_LEAF_SIZE_POS) | \ | ( (((u_int64_t)(leaf )) << SKEIN_CFG_TREE_LEAF_SIZE_POS) | \ | ||||
(((u64b_t)(node )) << SKEIN_CFG_TREE_NODE_SIZE_POS) | \ | (((u_int64_t)(node )) << SKEIN_CFG_TREE_NODE_SIZE_POS) | \ | ||||
(((u64b_t)(maxLvl)) << SKEIN_CFG_TREE_MAX_LEVEL_POS) ) | (((u_int64_t)(maxLvl)) << SKEIN_CFG_TREE_MAX_LEVEL_POS) ) | ||||
#define SKEIN_CFG_TREE_INFO_SEQUENTIAL SKEIN_CFG_TREE_INFO(0,0,0) /* use as treeInfo in InitExt() call for sequential processing */ | #define SKEIN_CFG_TREE_INFO_SEQUENTIAL SKEIN_CFG_TREE_INFO(0,0,0) /* use as treeInfo in InitExt() call for sequential processing */ | ||||
/* | /* | ||||
** Skein macros for getting/setting tweak words, etc. | ** Skein macros for getting/setting tweak words, etc. | ||||
** These are useful for partial input bytes, hash tree init/update, etc. | ** These are useful for partial input bytes, hash tree init/update, etc. | ||||
**/ | **/ | ||||
#define Skein_Get_Tweak(ctxPtr,TWK_NUM) ((ctxPtr)->h.T[TWK_NUM]) | #define Skein_Get_Tweak(ctxPtr,TWK_NUM) ((ctxPtr)->h.T[TWK_NUM]) | ||||
▲ Show 20 Lines • Show All 93 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.,