Loading drivers/staging/skein/include/skein.h +29 −29 Original line number Diff line number Diff line Loading @@ -63,46 +63,46 @@ enum #define SKEIN_512_BLOCK_BYTES ( 8*SKEIN_512_STATE_WORDS) #define SKEIN1024_BLOCK_BYTES ( 8*SKEIN1024_STATE_WORDS) typedef struct struct skein_ctx_hdr { size_t hashBitLen; /* size of hash result, in bits */ size_t bCnt; /* current byte count in buffer b[] */ u64 T[SKEIN_MODIFIER_WORDS]; /* tweak words: T[0]=byte cnt, T[1]=flags */ } Skein_Ctxt_Hdr_t; }; typedef struct /* 256-bit Skein hash context structure */ struct skein_256_ctx /* 256-bit Skein hash context structure */ { Skein_Ctxt_Hdr_t h; /* common header context variables */ struct skein_ctx_hdr h; /* common header context variables */ u64 X[SKEIN_256_STATE_WORDS]; /* chaining variables */ u8 b[SKEIN_256_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ } Skein_256_Ctxt_t; }; typedef struct /* 512-bit Skein hash context structure */ struct skein_512_ctx /* 512-bit Skein hash context structure */ { Skein_Ctxt_Hdr_t h; /* common header context variables */ struct skein_ctx_hdr h; /* common header context variables */ u64 X[SKEIN_512_STATE_WORDS]; /* chaining variables */ u8 b[SKEIN_512_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ } Skein_512_Ctxt_t; }; typedef struct /* 1024-bit Skein hash context structure */ struct skein1024_ctx /* 1024-bit Skein hash context structure */ { Skein_Ctxt_Hdr_t h; /* common header context variables */ struct skein_ctx_hdr h; /* common header context variables */ u64 X[SKEIN1024_STATE_WORDS]; /* chaining variables */ u8 b[SKEIN1024_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ } Skein1024_Ctxt_t; }; /* Skein APIs for (incremental) "straight hashing" */ 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 Skein1024_Init (Skein1024_Ctxt_t *ctx, size_t hashBitLen); int Skein_256_Init (struct skein_256_ctx *ctx, size_t hashBitLen); int Skein_512_Init (struct skein_512_ctx *ctx, size_t hashBitLen); int Skein1024_Init (struct skein1024_ctx *ctx, size_t hashBitLen); int Skein_256_Update(Skein_256_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt); int Skein_512_Update(Skein_512_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt); int Skein1024_Update(Skein1024_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt); int Skein_256_Update(struct skein_256_ctx *ctx, const u8 *msg, size_t msgByteCnt); int Skein_512_Update(struct skein_512_ctx *ctx, const u8 *msg, size_t msgByteCnt); int Skein1024_Update(struct skein1024_ctx *ctx, const u8 *msg, size_t msgByteCnt); int Skein_256_Final (Skein_256_Ctxt_t *ctx, u8 * hashVal); int Skein_512_Final (Skein_512_Ctxt_t *ctx, u8 * hashVal); int Skein1024_Final (Skein1024_Ctxt_t *ctx, u8 * hashVal); int Skein_256_Final (struct skein_256_ctx *ctx, u8 * hashVal); int Skein_512_Final (struct skein_512_ctx *ctx, u8 * hashVal); int Skein1024_Final (struct skein1024_ctx *ctx, u8 * hashVal); /* ** Skein APIs for "extended" initialization: MAC keys, tree hashing. Loading @@ -118,26 +118,26 @@ int Skein1024_Final (Skein1024_Ctxt_t *ctx, u8 * hashVal); ** to precompute the MAC IV, then a copy of the context saved and ** reused for each new MAC computation. **/ int Skein_256_InitExt(Skein_256_Ctxt_t *ctx, size_t hashBitLen, u64 treeInfo, const u8 *key, size_t keyBytes); int Skein_512_InitExt(Skein_512_Ctxt_t *ctx, size_t hashBitLen, u64 treeInfo, const u8 *key, size_t keyBytes); int Skein1024_InitExt(Skein1024_Ctxt_t *ctx, size_t hashBitLen, u64 treeInfo, const u8 *key, size_t keyBytes); int Skein_256_InitExt(struct skein_256_ctx *ctx, size_t hashBitLen, u64 treeInfo, const u8 *key, size_t keyBytes); int Skein_512_InitExt(struct skein_512_ctx *ctx, size_t hashBitLen, u64 treeInfo, const u8 *key, size_t keyBytes); int Skein1024_InitExt(struct skein1024_ctx *ctx, size_t hashBitLen, u64 treeInfo, const u8 *key, size_t keyBytes); /* ** Skein APIs for MAC and tree hash: ** Final_Pad: pad, do final block, but no OUTPUT type ** Output: do just the output stage */ int Skein_256_Final_Pad(Skein_256_Ctxt_t *ctx, u8 * hashVal); int Skein_512_Final_Pad(Skein_512_Ctxt_t *ctx, u8 * hashVal); int Skein1024_Final_Pad(Skein1024_Ctxt_t *ctx, u8 * hashVal); int Skein_256_Final_Pad(struct skein_256_ctx *ctx, u8 * hashVal); int Skein_512_Final_Pad(struct skein_512_ctx *ctx, u8 * hashVal); int Skein1024_Final_Pad(struct skein1024_ctx *ctx, u8 * hashVal); #ifndef SKEIN_TREE_HASH #define SKEIN_TREE_HASH (1) #endif #if SKEIN_TREE_HASH int Skein_256_Output (Skein_256_Ctxt_t *ctx, u8 * hashVal); int Skein_512_Output (Skein_512_Ctxt_t *ctx, u8 * hashVal); int Skein1024_Output (Skein1024_Ctxt_t *ctx, u8 * hashVal); int Skein_256_Output (struct skein_256_ctx *ctx, u8 * hashVal); int Skein_512_Output (struct skein_512_ctx *ctx, u8 * hashVal); int Skein1024_Output (struct skein1024_ctx *ctx, u8 * hashVal); #endif /***************************************************************** Loading drivers/staging/skein/include/skeinApi.h +16 −16 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ OTHER DEALINGS IN THE SOFTWARE. * #include <skeinApi.h> * * ... * SkeinCtx_t ctx; // a Skein hash or MAC context * struct skein_ctx ctx; // a Skein hash or MAC context * * // prepare context, here for a Skein with a state size of 512 bits. * skeinCtxPrepare(&ctx, Skein512); Loading Loading @@ -84,11 +84,11 @@ OTHER DEALINGS IN THE SOFTWARE. /** * Which Skein size to use */ typedef enum SkeinSize { enum skein_size { Skein256 = 256, /*!< Skein with 256 bit state */ Skein512 = 512, /*!< Skein with 512 bit state */ Skein1024 = 1024 /*!< Skein with 1024 bit state */ } SkeinSize_t; }; /** * Context for Skein. Loading @@ -98,16 +98,16 @@ OTHER DEALINGS IN THE SOFTWARE. * variables. If Skein implementation changes this, then adapt these * structures as well. */ typedef struct SkeinCtx { struct skein_ctx { u64 skeinSize; u64 XSave[SKEIN_MAX_STATE_WORDS]; /* save area for state variables */ union { Skein_Ctxt_Hdr_t h; Skein_256_Ctxt_t s256; Skein_512_Ctxt_t s512; Skein1024_Ctxt_t s1024; struct skein_ctx_hdr h; struct skein_256_ctx s256; struct skein_512_ctx s512; struct skein1024_ctx s1024; } m; } SkeinCtx_t; }; /** * Prepare a Skein context. Loading @@ -123,7 +123,7 @@ OTHER DEALINGS IN THE SOFTWARE. * @return * SKEIN_SUCESS of SKEIN_FAIL */ int skeinCtxPrepare(SkeinCtx_t* ctx, SkeinSize_t size); int skeinCtxPrepare(struct skein_ctx* ctx, enum skein_size size); /** * Initialize a Skein context. Loading @@ -139,7 +139,7 @@ OTHER DEALINGS IN THE SOFTWARE. * SKEIN_SUCESS of SKEIN_FAIL * @see skeinReset */ int skeinInit(SkeinCtx_t* ctx, size_t hashBitLen); int skeinInit(struct skein_ctx* ctx, size_t hashBitLen); /** * Resets a Skein context for further use. Loading @@ -151,7 +151,7 @@ OTHER DEALINGS IN THE SOFTWARE. * @param ctx * Pointer to a pre-initialized Skein MAC context */ void skeinReset(SkeinCtx_t* ctx); void skeinReset(struct skein_ctx* ctx); /** * Initializes a Skein context for MAC usage. Loading @@ -173,7 +173,7 @@ OTHER DEALINGS IN THE SOFTWARE. * @return * SKEIN_SUCESS of SKEIN_FAIL */ int skeinMacInit(SkeinCtx_t* ctx, const uint8_t *key, size_t keyLen, int skeinMacInit(struct skein_ctx* ctx, const uint8_t *key, size_t keyLen, size_t hashBitLen); /** Loading @@ -188,7 +188,7 @@ OTHER DEALINGS IN THE SOFTWARE. * @return * Success or error code. */ int skeinUpdate(SkeinCtx_t *ctx, const uint8_t *msg, int skeinUpdate(struct skein_ctx *ctx, const uint8_t *msg, size_t msgByteCnt); /** Loading @@ -204,7 +204,7 @@ OTHER DEALINGS IN THE SOFTWARE. * @param msgBitCnt * Length of the message in @b bits. */ int skeinUpdateBits(SkeinCtx_t *ctx, const uint8_t *msg, int skeinUpdateBits(struct skein_ctx *ctx, const uint8_t *msg, size_t msgBitCnt); /** Loading @@ -222,7 +222,7 @@ OTHER DEALINGS IN THE SOFTWARE. * Success or error code. * @see skeinReset */ int skeinFinal(SkeinCtx_t* ctx, uint8_t* hash); int skeinFinal(struct skein_ctx* ctx, uint8_t* hash); /** * @} Loading drivers/staging/skein/include/threefishApi.h +16 −16 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ * @code // Threefish cipher context data ThreefishKey_t keyCtx; struct threefish_key keyCtx; // Initialize the context threefishSetKey(&keyCtx, Threefish512, key, tweak); Loading @@ -36,11 +36,11 @@ /** * Which Threefish size to use */ typedef enum ThreefishSize { enum threefish_size { Threefish256 = 256, /*!< Skein with 256 bit state */ Threefish512 = 512, /*!< Skein with 512 bit state */ Threefish1024 = 1024 /*!< Skein with 1024 bit state */ } ThreefishSize_t; }; /** * Context for Threefish key and tweak words. Loading @@ -50,11 +50,11 @@ * variables. If Skein implementation changes this, the adapt these * structures as well. */ typedef struct ThreefishKey { struct threefish_key { u64 stateSize; u64 key[SKEIN_MAX_STATE_WORDS+1]; /* max number of key words*/ u64 tweak[3]; } ThreefishKey_t; }; /** * Set Threefish key and tweak data. Loading @@ -72,7 +72,7 @@ * @param tweak * Pointer to the two tweak words (word has 64 bits). */ void threefishSetKey(ThreefishKey_t* keyCtx, ThreefishSize_t stateSize, uint64_t* keyData, uint64_t* tweak); void threefishSetKey(struct threefish_key* keyCtx, enum threefish_size stateSize, uint64_t* keyData, uint64_t* tweak); /** * Encrypt Threefisch block (bytes). Loading @@ -89,7 +89,7 @@ * @param out * Pointer to cipher buffer. */ void threefishEncryptBlockBytes(ThreefishKey_t* keyCtx, uint8_t* in, uint8_t* out); void threefishEncryptBlockBytes(struct threefish_key* keyCtx, uint8_t* in, uint8_t* out); /** * Encrypt Threefisch block (words). Loading @@ -108,7 +108,7 @@ * @param out * Pointer to cipher buffer. */ void threefishEncryptBlockWords(ThreefishKey_t* keyCtx, uint64_t* in, uint64_t* out); void threefishEncryptBlockWords(struct threefish_key* keyCtx, uint64_t* in, uint64_t* out); /** * Decrypt Threefisch block (bytes). Loading @@ -125,7 +125,7 @@ * @param out * Pointer to plaintext buffer. */ void threefishDecryptBlockBytes(ThreefishKey_t* keyCtx, uint8_t* in, uint8_t* out); void threefishDecryptBlockBytes(struct threefish_key* keyCtx, uint8_t* in, uint8_t* out); /** * Decrypt Threefisch block (words). Loading @@ -144,14 +144,14 @@ * @param out * Pointer to plaintext buffer. */ void threefishDecryptBlockWords(ThreefishKey_t* keyCtx, uint64_t* in, uint64_t* out); void threefishDecryptBlockWords(struct threefish_key* keyCtx, uint64_t* in, uint64_t* out); void threefishEncrypt256(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output); void threefishEncrypt512(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output); void threefishEncrypt1024(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output); void threefishDecrypt256(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output); void threefishDecrypt512(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output); void threefishDecrypt1024(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output); void threefishEncrypt256(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output); void threefishEncrypt512(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output); void threefishEncrypt1024(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output); void threefishDecrypt256(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output); void threefishDecrypt512(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output); void threefishDecrypt1024(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output); /** * @} */ Loading drivers/staging/skein/skein.c +21 −21 Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ /*****************************************************************/ /* External function to process blkCnt (nonzero) full block(s) of data. */ void Skein_256_Process_Block(Skein_256_Ctxt_t *ctx,const u8 *blkPtr,size_t blkCnt,size_t byteCntAdd); void Skein_512_Process_Block(Skein_512_Ctxt_t *ctx,const u8 *blkPtr,size_t blkCnt,size_t byteCntAdd); void Skein1024_Process_Block(Skein1024_Ctxt_t *ctx,const u8 *blkPtr,size_t blkCnt,size_t byteCntAdd); void Skein_256_Process_Block(struct skein_256_ctx *ctx,const u8 *blkPtr,size_t blkCnt,size_t byteCntAdd); void Skein_512_Process_Block(struct skein_512_ctx *ctx,const u8 *blkPtr,size_t blkCnt,size_t byteCntAdd); void Skein1024_Process_Block(struct skein1024_ctx *ctx,const u8 *blkPtr,size_t blkCnt,size_t byteCntAdd); /*****************************************************************/ /* 256-bit Skein */ Loading @@ -26,7 +26,7 @@ void Skein1024_Process_Block(Skein1024_Ctxt_t *ctx,const u8 *blkPtr,size_t bl /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a straight hashing operation */ int Skein_256_Init(Skein_256_Ctxt_t *ctx, size_t hashBitLen) int Skein_256_Init(struct skein_256_ctx *ctx, size_t hashBitLen) { union { Loading Loading @@ -76,7 +76,7 @@ int Skein_256_Init(Skein_256_Ctxt_t *ctx, size_t hashBitLen) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a MAC and/or tree hash operation */ /* [identical to Skein_256_Init() when keyBytes == 0 && treeInfo == SKEIN_CFG_TREE_INFO_SEQUENTIAL] */ int Skein_256_InitExt(Skein_256_Ctxt_t *ctx,size_t hashBitLen,u64 treeInfo, const u8 *key, size_t keyBytes) int Skein_256_InitExt(struct skein_256_ctx *ctx,size_t hashBitLen,u64 treeInfo, const u8 *key, size_t keyBytes) { union { Loading Loading @@ -126,7 +126,7 @@ int Skein_256_InitExt(Skein_256_Ctxt_t *ctx,size_t hashBitLen,u64 treeInfo, cons /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* process the input bytes */ int Skein_256_Update(Skein_256_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt) int Skein_256_Update(struct skein_256_ctx *ctx, const u8 *msg, size_t msgByteCnt) { size_t n; Loading Loading @@ -174,7 +174,7 @@ int Skein_256_Update(Skein_256_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the result */ int Skein_256_Final(Skein_256_Ctxt_t *ctx, u8 *hashVal) int Skein_256_Final(struct skein_256_ctx *ctx, u8 *hashVal) { size_t i,n,byteCnt; u64 X[SKEIN_256_STATE_WORDS]; Loading Loading @@ -213,7 +213,7 @@ int Skein_256_Final(Skein_256_Ctxt_t *ctx, u8 *hashVal) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a straight hashing operation */ int Skein_512_Init(Skein_512_Ctxt_t *ctx, size_t hashBitLen) int Skein_512_Init(struct skein_512_ctx *ctx, size_t hashBitLen) { union { Loading Loading @@ -264,7 +264,7 @@ int Skein_512_Init(Skein_512_Ctxt_t *ctx, size_t hashBitLen) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a MAC and/or tree hash operation */ /* [identical to Skein_512_Init() when keyBytes == 0 && treeInfo == SKEIN_CFG_TREE_INFO_SEQUENTIAL] */ int Skein_512_InitExt(Skein_512_Ctxt_t *ctx,size_t hashBitLen,u64 treeInfo, const u8 *key, size_t keyBytes) int Skein_512_InitExt(struct skein_512_ctx *ctx,size_t hashBitLen,u64 treeInfo, const u8 *key, size_t keyBytes) { union { Loading Loading @@ -314,7 +314,7 @@ int Skein_512_InitExt(Skein_512_Ctxt_t *ctx,size_t hashBitLen,u64 treeInfo, cons /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* process the input bytes */ int Skein_512_Update(Skein_512_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt) int Skein_512_Update(struct skein_512_ctx *ctx, const u8 *msg, size_t msgByteCnt) { size_t n; Loading Loading @@ -362,7 +362,7 @@ int Skein_512_Update(Skein_512_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the result */ int Skein_512_Final(Skein_512_Ctxt_t *ctx, u8 *hashVal) int Skein_512_Final(struct skein_512_ctx *ctx, u8 *hashVal) { size_t i,n,byteCnt; u64 X[SKEIN_512_STATE_WORDS]; Loading Loading @@ -401,7 +401,7 @@ int Skein_512_Final(Skein_512_Ctxt_t *ctx, u8 *hashVal) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a straight hashing operation */ int Skein1024_Init(Skein1024_Ctxt_t *ctx, size_t hashBitLen) int Skein1024_Init(struct skein1024_ctx *ctx, size_t hashBitLen) { union { Loading Loading @@ -449,7 +449,7 @@ int Skein1024_Init(Skein1024_Ctxt_t *ctx, size_t hashBitLen) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a MAC and/or tree hash operation */ /* [identical to Skein1024_Init() when keyBytes == 0 && treeInfo == SKEIN_CFG_TREE_INFO_SEQUENTIAL] */ int Skein1024_InitExt(Skein1024_Ctxt_t *ctx,size_t hashBitLen,u64 treeInfo, const u8 *key, size_t keyBytes) int Skein1024_InitExt(struct skein1024_ctx *ctx,size_t hashBitLen,u64 treeInfo, const u8 *key, size_t keyBytes) { union { Loading Loading @@ -499,7 +499,7 @@ int Skein1024_InitExt(Skein1024_Ctxt_t *ctx,size_t hashBitLen,u64 treeInfo, cons /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* process the input bytes */ int Skein1024_Update(Skein1024_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt) int Skein1024_Update(struct skein1024_ctx *ctx, const u8 *msg, size_t msgByteCnt) { size_t n; Loading Loading @@ -547,7 +547,7 @@ int Skein1024_Update(Skein1024_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the result */ int Skein1024_Final(Skein1024_Ctxt_t *ctx, u8 *hashVal) int Skein1024_Final(struct skein1024_ctx *ctx, u8 *hashVal) { size_t i,n,byteCnt; u64 X[SKEIN1024_STATE_WORDS]; Loading Loading @@ -585,7 +585,7 @@ int Skein1024_Final(Skein1024_Ctxt_t *ctx, u8 *hashVal) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the block, no OUTPUT stage */ int Skein_256_Final_Pad(Skein_256_Ctxt_t *ctx, u8 *hashVal) int Skein_256_Final_Pad(struct skein_256_ctx *ctx, u8 *hashVal) { Skein_Assert(ctx->h.bCnt <= SKEIN_256_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ Loading @@ -601,7 +601,7 @@ int Skein_256_Final_Pad(Skein_256_Ctxt_t *ctx, u8 *hashVal) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the block, no OUTPUT stage */ int Skein_512_Final_Pad(Skein_512_Ctxt_t *ctx, u8 *hashVal) int Skein_512_Final_Pad(struct skein_512_ctx *ctx, u8 *hashVal) { Skein_Assert(ctx->h.bCnt <= SKEIN_512_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ Loading @@ -617,7 +617,7 @@ int Skein_512_Final_Pad(Skein_512_Ctxt_t *ctx, u8 *hashVal) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the block, no OUTPUT stage */ int Skein1024_Final_Pad(Skein1024_Ctxt_t *ctx, u8 *hashVal) int Skein1024_Final_Pad(struct skein1024_ctx *ctx, u8 *hashVal) { Skein_Assert(ctx->h.bCnt <= SKEIN1024_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ Loading @@ -634,7 +634,7 @@ int Skein1024_Final_Pad(Skein1024_Ctxt_t *ctx, u8 *hashVal) #if SKEIN_TREE_HASH /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* just do the OUTPUT stage */ int Skein_256_Output(Skein_256_Ctxt_t *ctx, u8 *hashVal) int Skein_256_Output(struct skein_256_ctx *ctx, u8 *hashVal) { size_t i,n,byteCnt; u64 X[SKEIN_256_STATE_WORDS]; Loading Loading @@ -663,7 +663,7 @@ int Skein_256_Output(Skein_256_Ctxt_t *ctx, u8 *hashVal) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* just do the OUTPUT stage */ int Skein_512_Output(Skein_512_Ctxt_t *ctx, u8 *hashVal) int Skein_512_Output(struct skein_512_ctx *ctx, u8 *hashVal) { size_t i,n,byteCnt; u64 X[SKEIN_512_STATE_WORDS]; Loading Loading @@ -692,7 +692,7 @@ int Skein_512_Output(Skein_512_Ctxt_t *ctx, u8 *hashVal) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* just do the OUTPUT stage */ int Skein1024_Output(Skein1024_Ctxt_t *ctx, u8 *hashVal) int Skein1024_Output(struct skein1024_ctx *ctx, u8 *hashVal) { size_t i,n,byteCnt; u64 X[SKEIN1024_STATE_WORDS]; Loading drivers/staging/skein/skeinApi.c +8 −8 Original line number Diff line number Diff line Loading @@ -27,17 +27,17 @@ OTHER DEALINGS IN THE SOFTWARE. #include <linux/string.h> #include <skeinApi.h> int skeinCtxPrepare(SkeinCtx_t* ctx, SkeinSize_t size) int skeinCtxPrepare(struct skein_ctx* ctx, enum skein_size size) { Skein_Assert(ctx && size, SKEIN_FAIL); memset(ctx ,0, sizeof(SkeinCtx_t)); memset(ctx ,0, sizeof(struct skein_ctx)); ctx->skeinSize = size; return SKEIN_SUCCESS; } int skeinInit(SkeinCtx_t* ctx, size_t hashBitLen) int skeinInit(struct skein_ctx* ctx, size_t hashBitLen) { int ret = SKEIN_FAIL; size_t Xlen = 0; Loading Loading @@ -78,7 +78,7 @@ int skeinInit(SkeinCtx_t* ctx, size_t hashBitLen) return ret; } int skeinMacInit(SkeinCtx_t* ctx, const uint8_t *key, size_t keyLen, int skeinMacInit(struct skein_ctx* ctx, const uint8_t *key, size_t keyLen, size_t hashBitLen) { int ret = SKEIN_FAIL; Loading Loading @@ -119,7 +119,7 @@ int skeinMacInit(SkeinCtx_t* ctx, const uint8_t *key, size_t keyLen, return ret; } void skeinReset(SkeinCtx_t* ctx) void skeinReset(struct skein_ctx* ctx) { size_t Xlen = 0; u64* X = NULL; Loading @@ -138,7 +138,7 @@ void skeinReset(SkeinCtx_t* ctx) Skein_Start_New_Type(&ctx->m, MSG); } int skeinUpdate(SkeinCtx_t *ctx, const uint8_t *msg, int skeinUpdate(struct skein_ctx *ctx, const uint8_t *msg, size_t msgByteCnt) { int ret = SKEIN_FAIL; Loading @@ -159,7 +159,7 @@ int skeinUpdate(SkeinCtx_t *ctx, const uint8_t *msg, } int skeinUpdateBits(SkeinCtx_t *ctx, const uint8_t *msg, int skeinUpdateBits(struct skein_ctx *ctx, const uint8_t *msg, size_t msgBitCnt) { /* Loading Loading @@ -199,7 +199,7 @@ int skeinUpdateBits(SkeinCtx_t *ctx, const uint8_t *msg, return SKEIN_SUCCESS; } int skeinFinal(SkeinCtx_t* ctx, uint8_t* hash) int skeinFinal(struct skein_ctx* ctx, uint8_t* hash) { int ret = SKEIN_FAIL; Skein_Assert(ctx, SKEIN_FAIL); Loading Loading
drivers/staging/skein/include/skein.h +29 −29 Original line number Diff line number Diff line Loading @@ -63,46 +63,46 @@ enum #define SKEIN_512_BLOCK_BYTES ( 8*SKEIN_512_STATE_WORDS) #define SKEIN1024_BLOCK_BYTES ( 8*SKEIN1024_STATE_WORDS) typedef struct struct skein_ctx_hdr { size_t hashBitLen; /* size of hash result, in bits */ size_t bCnt; /* current byte count in buffer b[] */ u64 T[SKEIN_MODIFIER_WORDS]; /* tweak words: T[0]=byte cnt, T[1]=flags */ } Skein_Ctxt_Hdr_t; }; typedef struct /* 256-bit Skein hash context structure */ struct skein_256_ctx /* 256-bit Skein hash context structure */ { Skein_Ctxt_Hdr_t h; /* common header context variables */ struct skein_ctx_hdr h; /* common header context variables */ u64 X[SKEIN_256_STATE_WORDS]; /* chaining variables */ u8 b[SKEIN_256_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ } Skein_256_Ctxt_t; }; typedef struct /* 512-bit Skein hash context structure */ struct skein_512_ctx /* 512-bit Skein hash context structure */ { Skein_Ctxt_Hdr_t h; /* common header context variables */ struct skein_ctx_hdr h; /* common header context variables */ u64 X[SKEIN_512_STATE_WORDS]; /* chaining variables */ u8 b[SKEIN_512_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ } Skein_512_Ctxt_t; }; typedef struct /* 1024-bit Skein hash context structure */ struct skein1024_ctx /* 1024-bit Skein hash context structure */ { Skein_Ctxt_Hdr_t h; /* common header context variables */ struct skein_ctx_hdr h; /* common header context variables */ u64 X[SKEIN1024_STATE_WORDS]; /* chaining variables */ u8 b[SKEIN1024_BLOCK_BYTES]; /* partial block buffer (8-byte aligned) */ } Skein1024_Ctxt_t; }; /* Skein APIs for (incremental) "straight hashing" */ 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 Skein1024_Init (Skein1024_Ctxt_t *ctx, size_t hashBitLen); int Skein_256_Init (struct skein_256_ctx *ctx, size_t hashBitLen); int Skein_512_Init (struct skein_512_ctx *ctx, size_t hashBitLen); int Skein1024_Init (struct skein1024_ctx *ctx, size_t hashBitLen); int Skein_256_Update(Skein_256_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt); int Skein_512_Update(Skein_512_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt); int Skein1024_Update(Skein1024_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt); int Skein_256_Update(struct skein_256_ctx *ctx, const u8 *msg, size_t msgByteCnt); int Skein_512_Update(struct skein_512_ctx *ctx, const u8 *msg, size_t msgByteCnt); int Skein1024_Update(struct skein1024_ctx *ctx, const u8 *msg, size_t msgByteCnt); int Skein_256_Final (Skein_256_Ctxt_t *ctx, u8 * hashVal); int Skein_512_Final (Skein_512_Ctxt_t *ctx, u8 * hashVal); int Skein1024_Final (Skein1024_Ctxt_t *ctx, u8 * hashVal); int Skein_256_Final (struct skein_256_ctx *ctx, u8 * hashVal); int Skein_512_Final (struct skein_512_ctx *ctx, u8 * hashVal); int Skein1024_Final (struct skein1024_ctx *ctx, u8 * hashVal); /* ** Skein APIs for "extended" initialization: MAC keys, tree hashing. Loading @@ -118,26 +118,26 @@ int Skein1024_Final (Skein1024_Ctxt_t *ctx, u8 * hashVal); ** to precompute the MAC IV, then a copy of the context saved and ** reused for each new MAC computation. **/ int Skein_256_InitExt(Skein_256_Ctxt_t *ctx, size_t hashBitLen, u64 treeInfo, const u8 *key, size_t keyBytes); int Skein_512_InitExt(Skein_512_Ctxt_t *ctx, size_t hashBitLen, u64 treeInfo, const u8 *key, size_t keyBytes); int Skein1024_InitExt(Skein1024_Ctxt_t *ctx, size_t hashBitLen, u64 treeInfo, const u8 *key, size_t keyBytes); int Skein_256_InitExt(struct skein_256_ctx *ctx, size_t hashBitLen, u64 treeInfo, const u8 *key, size_t keyBytes); int Skein_512_InitExt(struct skein_512_ctx *ctx, size_t hashBitLen, u64 treeInfo, const u8 *key, size_t keyBytes); int Skein1024_InitExt(struct skein1024_ctx *ctx, size_t hashBitLen, u64 treeInfo, const u8 *key, size_t keyBytes); /* ** Skein APIs for MAC and tree hash: ** Final_Pad: pad, do final block, but no OUTPUT type ** Output: do just the output stage */ int Skein_256_Final_Pad(Skein_256_Ctxt_t *ctx, u8 * hashVal); int Skein_512_Final_Pad(Skein_512_Ctxt_t *ctx, u8 * hashVal); int Skein1024_Final_Pad(Skein1024_Ctxt_t *ctx, u8 * hashVal); int Skein_256_Final_Pad(struct skein_256_ctx *ctx, u8 * hashVal); int Skein_512_Final_Pad(struct skein_512_ctx *ctx, u8 * hashVal); int Skein1024_Final_Pad(struct skein1024_ctx *ctx, u8 * hashVal); #ifndef SKEIN_TREE_HASH #define SKEIN_TREE_HASH (1) #endif #if SKEIN_TREE_HASH int Skein_256_Output (Skein_256_Ctxt_t *ctx, u8 * hashVal); int Skein_512_Output (Skein_512_Ctxt_t *ctx, u8 * hashVal); int Skein1024_Output (Skein1024_Ctxt_t *ctx, u8 * hashVal); int Skein_256_Output (struct skein_256_ctx *ctx, u8 * hashVal); int Skein_512_Output (struct skein_512_ctx *ctx, u8 * hashVal); int Skein1024_Output (struct skein1024_ctx *ctx, u8 * hashVal); #endif /***************************************************************** Loading
drivers/staging/skein/include/skeinApi.h +16 −16 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ OTHER DEALINGS IN THE SOFTWARE. * #include <skeinApi.h> * * ... * SkeinCtx_t ctx; // a Skein hash or MAC context * struct skein_ctx ctx; // a Skein hash or MAC context * * // prepare context, here for a Skein with a state size of 512 bits. * skeinCtxPrepare(&ctx, Skein512); Loading Loading @@ -84,11 +84,11 @@ OTHER DEALINGS IN THE SOFTWARE. /** * Which Skein size to use */ typedef enum SkeinSize { enum skein_size { Skein256 = 256, /*!< Skein with 256 bit state */ Skein512 = 512, /*!< Skein with 512 bit state */ Skein1024 = 1024 /*!< Skein with 1024 bit state */ } SkeinSize_t; }; /** * Context for Skein. Loading @@ -98,16 +98,16 @@ OTHER DEALINGS IN THE SOFTWARE. * variables. If Skein implementation changes this, then adapt these * structures as well. */ typedef struct SkeinCtx { struct skein_ctx { u64 skeinSize; u64 XSave[SKEIN_MAX_STATE_WORDS]; /* save area for state variables */ union { Skein_Ctxt_Hdr_t h; Skein_256_Ctxt_t s256; Skein_512_Ctxt_t s512; Skein1024_Ctxt_t s1024; struct skein_ctx_hdr h; struct skein_256_ctx s256; struct skein_512_ctx s512; struct skein1024_ctx s1024; } m; } SkeinCtx_t; }; /** * Prepare a Skein context. Loading @@ -123,7 +123,7 @@ OTHER DEALINGS IN THE SOFTWARE. * @return * SKEIN_SUCESS of SKEIN_FAIL */ int skeinCtxPrepare(SkeinCtx_t* ctx, SkeinSize_t size); int skeinCtxPrepare(struct skein_ctx* ctx, enum skein_size size); /** * Initialize a Skein context. Loading @@ -139,7 +139,7 @@ OTHER DEALINGS IN THE SOFTWARE. * SKEIN_SUCESS of SKEIN_FAIL * @see skeinReset */ int skeinInit(SkeinCtx_t* ctx, size_t hashBitLen); int skeinInit(struct skein_ctx* ctx, size_t hashBitLen); /** * Resets a Skein context for further use. Loading @@ -151,7 +151,7 @@ OTHER DEALINGS IN THE SOFTWARE. * @param ctx * Pointer to a pre-initialized Skein MAC context */ void skeinReset(SkeinCtx_t* ctx); void skeinReset(struct skein_ctx* ctx); /** * Initializes a Skein context for MAC usage. Loading @@ -173,7 +173,7 @@ OTHER DEALINGS IN THE SOFTWARE. * @return * SKEIN_SUCESS of SKEIN_FAIL */ int skeinMacInit(SkeinCtx_t* ctx, const uint8_t *key, size_t keyLen, int skeinMacInit(struct skein_ctx* ctx, const uint8_t *key, size_t keyLen, size_t hashBitLen); /** Loading @@ -188,7 +188,7 @@ OTHER DEALINGS IN THE SOFTWARE. * @return * Success or error code. */ int skeinUpdate(SkeinCtx_t *ctx, const uint8_t *msg, int skeinUpdate(struct skein_ctx *ctx, const uint8_t *msg, size_t msgByteCnt); /** Loading @@ -204,7 +204,7 @@ OTHER DEALINGS IN THE SOFTWARE. * @param msgBitCnt * Length of the message in @b bits. */ int skeinUpdateBits(SkeinCtx_t *ctx, const uint8_t *msg, int skeinUpdateBits(struct skein_ctx *ctx, const uint8_t *msg, size_t msgBitCnt); /** Loading @@ -222,7 +222,7 @@ OTHER DEALINGS IN THE SOFTWARE. * Success or error code. * @see skeinReset */ int skeinFinal(SkeinCtx_t* ctx, uint8_t* hash); int skeinFinal(struct skein_ctx* ctx, uint8_t* hash); /** * @} Loading
drivers/staging/skein/include/threefishApi.h +16 −16 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ * @code // Threefish cipher context data ThreefishKey_t keyCtx; struct threefish_key keyCtx; // Initialize the context threefishSetKey(&keyCtx, Threefish512, key, tweak); Loading @@ -36,11 +36,11 @@ /** * Which Threefish size to use */ typedef enum ThreefishSize { enum threefish_size { Threefish256 = 256, /*!< Skein with 256 bit state */ Threefish512 = 512, /*!< Skein with 512 bit state */ Threefish1024 = 1024 /*!< Skein with 1024 bit state */ } ThreefishSize_t; }; /** * Context for Threefish key and tweak words. Loading @@ -50,11 +50,11 @@ * variables. If Skein implementation changes this, the adapt these * structures as well. */ typedef struct ThreefishKey { struct threefish_key { u64 stateSize; u64 key[SKEIN_MAX_STATE_WORDS+1]; /* max number of key words*/ u64 tweak[3]; } ThreefishKey_t; }; /** * Set Threefish key and tweak data. Loading @@ -72,7 +72,7 @@ * @param tweak * Pointer to the two tweak words (word has 64 bits). */ void threefishSetKey(ThreefishKey_t* keyCtx, ThreefishSize_t stateSize, uint64_t* keyData, uint64_t* tweak); void threefishSetKey(struct threefish_key* keyCtx, enum threefish_size stateSize, uint64_t* keyData, uint64_t* tweak); /** * Encrypt Threefisch block (bytes). Loading @@ -89,7 +89,7 @@ * @param out * Pointer to cipher buffer. */ void threefishEncryptBlockBytes(ThreefishKey_t* keyCtx, uint8_t* in, uint8_t* out); void threefishEncryptBlockBytes(struct threefish_key* keyCtx, uint8_t* in, uint8_t* out); /** * Encrypt Threefisch block (words). Loading @@ -108,7 +108,7 @@ * @param out * Pointer to cipher buffer. */ void threefishEncryptBlockWords(ThreefishKey_t* keyCtx, uint64_t* in, uint64_t* out); void threefishEncryptBlockWords(struct threefish_key* keyCtx, uint64_t* in, uint64_t* out); /** * Decrypt Threefisch block (bytes). Loading @@ -125,7 +125,7 @@ * @param out * Pointer to plaintext buffer. */ void threefishDecryptBlockBytes(ThreefishKey_t* keyCtx, uint8_t* in, uint8_t* out); void threefishDecryptBlockBytes(struct threefish_key* keyCtx, uint8_t* in, uint8_t* out); /** * Decrypt Threefisch block (words). Loading @@ -144,14 +144,14 @@ * @param out * Pointer to plaintext buffer. */ void threefishDecryptBlockWords(ThreefishKey_t* keyCtx, uint64_t* in, uint64_t* out); void threefishDecryptBlockWords(struct threefish_key* keyCtx, uint64_t* in, uint64_t* out); void threefishEncrypt256(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output); void threefishEncrypt512(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output); void threefishEncrypt1024(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output); void threefishDecrypt256(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output); void threefishDecrypt512(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output); void threefishDecrypt1024(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output); void threefishEncrypt256(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output); void threefishEncrypt512(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output); void threefishEncrypt1024(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output); void threefishDecrypt256(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output); void threefishDecrypt512(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output); void threefishDecrypt1024(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output); /** * @} */ Loading
drivers/staging/skein/skein.c +21 −21 Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ /*****************************************************************/ /* External function to process blkCnt (nonzero) full block(s) of data. */ void Skein_256_Process_Block(Skein_256_Ctxt_t *ctx,const u8 *blkPtr,size_t blkCnt,size_t byteCntAdd); void Skein_512_Process_Block(Skein_512_Ctxt_t *ctx,const u8 *blkPtr,size_t blkCnt,size_t byteCntAdd); void Skein1024_Process_Block(Skein1024_Ctxt_t *ctx,const u8 *blkPtr,size_t blkCnt,size_t byteCntAdd); void Skein_256_Process_Block(struct skein_256_ctx *ctx,const u8 *blkPtr,size_t blkCnt,size_t byteCntAdd); void Skein_512_Process_Block(struct skein_512_ctx *ctx,const u8 *blkPtr,size_t blkCnt,size_t byteCntAdd); void Skein1024_Process_Block(struct skein1024_ctx *ctx,const u8 *blkPtr,size_t blkCnt,size_t byteCntAdd); /*****************************************************************/ /* 256-bit Skein */ Loading @@ -26,7 +26,7 @@ void Skein1024_Process_Block(Skein1024_Ctxt_t *ctx,const u8 *blkPtr,size_t bl /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a straight hashing operation */ int Skein_256_Init(Skein_256_Ctxt_t *ctx, size_t hashBitLen) int Skein_256_Init(struct skein_256_ctx *ctx, size_t hashBitLen) { union { Loading Loading @@ -76,7 +76,7 @@ int Skein_256_Init(Skein_256_Ctxt_t *ctx, size_t hashBitLen) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a MAC and/or tree hash operation */ /* [identical to Skein_256_Init() when keyBytes == 0 && treeInfo == SKEIN_CFG_TREE_INFO_SEQUENTIAL] */ int Skein_256_InitExt(Skein_256_Ctxt_t *ctx,size_t hashBitLen,u64 treeInfo, const u8 *key, size_t keyBytes) int Skein_256_InitExt(struct skein_256_ctx *ctx,size_t hashBitLen,u64 treeInfo, const u8 *key, size_t keyBytes) { union { Loading Loading @@ -126,7 +126,7 @@ int Skein_256_InitExt(Skein_256_Ctxt_t *ctx,size_t hashBitLen,u64 treeInfo, cons /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* process the input bytes */ int Skein_256_Update(Skein_256_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt) int Skein_256_Update(struct skein_256_ctx *ctx, const u8 *msg, size_t msgByteCnt) { size_t n; Loading Loading @@ -174,7 +174,7 @@ int Skein_256_Update(Skein_256_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the result */ int Skein_256_Final(Skein_256_Ctxt_t *ctx, u8 *hashVal) int Skein_256_Final(struct skein_256_ctx *ctx, u8 *hashVal) { size_t i,n,byteCnt; u64 X[SKEIN_256_STATE_WORDS]; Loading Loading @@ -213,7 +213,7 @@ int Skein_256_Final(Skein_256_Ctxt_t *ctx, u8 *hashVal) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a straight hashing operation */ int Skein_512_Init(Skein_512_Ctxt_t *ctx, size_t hashBitLen) int Skein_512_Init(struct skein_512_ctx *ctx, size_t hashBitLen) { union { Loading Loading @@ -264,7 +264,7 @@ int Skein_512_Init(Skein_512_Ctxt_t *ctx, size_t hashBitLen) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a MAC and/or tree hash operation */ /* [identical to Skein_512_Init() when keyBytes == 0 && treeInfo == SKEIN_CFG_TREE_INFO_SEQUENTIAL] */ int Skein_512_InitExt(Skein_512_Ctxt_t *ctx,size_t hashBitLen,u64 treeInfo, const u8 *key, size_t keyBytes) int Skein_512_InitExt(struct skein_512_ctx *ctx,size_t hashBitLen,u64 treeInfo, const u8 *key, size_t keyBytes) { union { Loading Loading @@ -314,7 +314,7 @@ int Skein_512_InitExt(Skein_512_Ctxt_t *ctx,size_t hashBitLen,u64 treeInfo, cons /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* process the input bytes */ int Skein_512_Update(Skein_512_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt) int Skein_512_Update(struct skein_512_ctx *ctx, const u8 *msg, size_t msgByteCnt) { size_t n; Loading Loading @@ -362,7 +362,7 @@ int Skein_512_Update(Skein_512_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the result */ int Skein_512_Final(Skein_512_Ctxt_t *ctx, u8 *hashVal) int Skein_512_Final(struct skein_512_ctx *ctx, u8 *hashVal) { size_t i,n,byteCnt; u64 X[SKEIN_512_STATE_WORDS]; Loading Loading @@ -401,7 +401,7 @@ int Skein_512_Final(Skein_512_Ctxt_t *ctx, u8 *hashVal) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a straight hashing operation */ int Skein1024_Init(Skein1024_Ctxt_t *ctx, size_t hashBitLen) int Skein1024_Init(struct skein1024_ctx *ctx, size_t hashBitLen) { union { Loading Loading @@ -449,7 +449,7 @@ int Skein1024_Init(Skein1024_Ctxt_t *ctx, size_t hashBitLen) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a MAC and/or tree hash operation */ /* [identical to Skein1024_Init() when keyBytes == 0 && treeInfo == SKEIN_CFG_TREE_INFO_SEQUENTIAL] */ int Skein1024_InitExt(Skein1024_Ctxt_t *ctx,size_t hashBitLen,u64 treeInfo, const u8 *key, size_t keyBytes) int Skein1024_InitExt(struct skein1024_ctx *ctx,size_t hashBitLen,u64 treeInfo, const u8 *key, size_t keyBytes) { union { Loading Loading @@ -499,7 +499,7 @@ int Skein1024_InitExt(Skein1024_Ctxt_t *ctx,size_t hashBitLen,u64 treeInfo, cons /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* process the input bytes */ int Skein1024_Update(Skein1024_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt) int Skein1024_Update(struct skein1024_ctx *ctx, const u8 *msg, size_t msgByteCnt) { size_t n; Loading Loading @@ -547,7 +547,7 @@ int Skein1024_Update(Skein1024_Ctxt_t *ctx, const u8 *msg, size_t msgByteCnt) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the result */ int Skein1024_Final(Skein1024_Ctxt_t *ctx, u8 *hashVal) int Skein1024_Final(struct skein1024_ctx *ctx, u8 *hashVal) { size_t i,n,byteCnt; u64 X[SKEIN1024_STATE_WORDS]; Loading Loading @@ -585,7 +585,7 @@ int Skein1024_Final(Skein1024_Ctxt_t *ctx, u8 *hashVal) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the block, no OUTPUT stage */ int Skein_256_Final_Pad(Skein_256_Ctxt_t *ctx, u8 *hashVal) int Skein_256_Final_Pad(struct skein_256_ctx *ctx, u8 *hashVal) { Skein_Assert(ctx->h.bCnt <= SKEIN_256_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ Loading @@ -601,7 +601,7 @@ int Skein_256_Final_Pad(Skein_256_Ctxt_t *ctx, u8 *hashVal) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the block, no OUTPUT stage */ int Skein_512_Final_Pad(Skein_512_Ctxt_t *ctx, u8 *hashVal) int Skein_512_Final_Pad(struct skein_512_ctx *ctx, u8 *hashVal) { Skein_Assert(ctx->h.bCnt <= SKEIN_512_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ Loading @@ -617,7 +617,7 @@ int Skein_512_Final_Pad(Skein_512_Ctxt_t *ctx, u8 *hashVal) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the block, no OUTPUT stage */ int Skein1024_Final_Pad(Skein1024_Ctxt_t *ctx, u8 *hashVal) int Skein1024_Final_Pad(struct skein1024_ctx *ctx, u8 *hashVal) { Skein_Assert(ctx->h.bCnt <= SKEIN1024_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ Loading @@ -634,7 +634,7 @@ int Skein1024_Final_Pad(Skein1024_Ctxt_t *ctx, u8 *hashVal) #if SKEIN_TREE_HASH /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* just do the OUTPUT stage */ int Skein_256_Output(Skein_256_Ctxt_t *ctx, u8 *hashVal) int Skein_256_Output(struct skein_256_ctx *ctx, u8 *hashVal) { size_t i,n,byteCnt; u64 X[SKEIN_256_STATE_WORDS]; Loading Loading @@ -663,7 +663,7 @@ int Skein_256_Output(Skein_256_Ctxt_t *ctx, u8 *hashVal) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* just do the OUTPUT stage */ int Skein_512_Output(Skein_512_Ctxt_t *ctx, u8 *hashVal) int Skein_512_Output(struct skein_512_ctx *ctx, u8 *hashVal) { size_t i,n,byteCnt; u64 X[SKEIN_512_STATE_WORDS]; Loading Loading @@ -692,7 +692,7 @@ int Skein_512_Output(Skein_512_Ctxt_t *ctx, u8 *hashVal) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* just do the OUTPUT stage */ int Skein1024_Output(Skein1024_Ctxt_t *ctx, u8 *hashVal) int Skein1024_Output(struct skein1024_ctx *ctx, u8 *hashVal) { size_t i,n,byteCnt; u64 X[SKEIN1024_STATE_WORDS]; Loading
drivers/staging/skein/skeinApi.c +8 −8 Original line number Diff line number Diff line Loading @@ -27,17 +27,17 @@ OTHER DEALINGS IN THE SOFTWARE. #include <linux/string.h> #include <skeinApi.h> int skeinCtxPrepare(SkeinCtx_t* ctx, SkeinSize_t size) int skeinCtxPrepare(struct skein_ctx* ctx, enum skein_size size) { Skein_Assert(ctx && size, SKEIN_FAIL); memset(ctx ,0, sizeof(SkeinCtx_t)); memset(ctx ,0, sizeof(struct skein_ctx)); ctx->skeinSize = size; return SKEIN_SUCCESS; } int skeinInit(SkeinCtx_t* ctx, size_t hashBitLen) int skeinInit(struct skein_ctx* ctx, size_t hashBitLen) { int ret = SKEIN_FAIL; size_t Xlen = 0; Loading Loading @@ -78,7 +78,7 @@ int skeinInit(SkeinCtx_t* ctx, size_t hashBitLen) return ret; } int skeinMacInit(SkeinCtx_t* ctx, const uint8_t *key, size_t keyLen, int skeinMacInit(struct skein_ctx* ctx, const uint8_t *key, size_t keyLen, size_t hashBitLen) { int ret = SKEIN_FAIL; Loading Loading @@ -119,7 +119,7 @@ int skeinMacInit(SkeinCtx_t* ctx, const uint8_t *key, size_t keyLen, return ret; } void skeinReset(SkeinCtx_t* ctx) void skeinReset(struct skein_ctx* ctx) { size_t Xlen = 0; u64* X = NULL; Loading @@ -138,7 +138,7 @@ void skeinReset(SkeinCtx_t* ctx) Skein_Start_New_Type(&ctx->m, MSG); } int skeinUpdate(SkeinCtx_t *ctx, const uint8_t *msg, int skeinUpdate(struct skein_ctx *ctx, const uint8_t *msg, size_t msgByteCnt) { int ret = SKEIN_FAIL; Loading @@ -159,7 +159,7 @@ int skeinUpdate(SkeinCtx_t *ctx, const uint8_t *msg, } int skeinUpdateBits(SkeinCtx_t *ctx, const uint8_t *msg, int skeinUpdateBits(struct skein_ctx *ctx, const uint8_t *msg, size_t msgBitCnt) { /* Loading Loading @@ -199,7 +199,7 @@ int skeinUpdateBits(SkeinCtx_t *ctx, const uint8_t *msg, return SKEIN_SUCCESS; } int skeinFinal(SkeinCtx_t* ctx, uint8_t* hash) int skeinFinal(struct skein_ctx* ctx, uint8_t* hash) { int ret = SKEIN_FAIL; Skein_Assert(ctx, SKEIN_FAIL); Loading