#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.
** 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
/*****************************************************************
* #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);
/**
* 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.
* 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.
* @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.
* 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.
* @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.
* @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);
/**
* @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);
/**
* @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);
/**
* Success or error code.
* @see skeinReset
*/
- int skeinFinal(SkeinCtx_t* ctx, uint8_t* hash);
+ int skeinFinal(struct skein_ctx* ctx, uint8_t* hash);
/**
* @}
*
@code
// Threefish cipher context data
- ThreefishKey_t keyCtx;
+ struct threefish_key keyCtx;
// Initialize the context
threefishSetKey(&keyCtx, Threefish512, key, tweak);
/**
* 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.
* 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.
* @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).
* @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).
* @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).
* @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).
* @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);
/**
* @}
*/
/*****************************************************************/
/* 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 */
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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
{
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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
{
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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;
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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];
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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
{
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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
{
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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;
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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];
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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
{
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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
{
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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;
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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];
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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 */
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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 */
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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 */
#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];
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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];
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* 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];
#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;
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;
return ret;
}
-void skeinReset(SkeinCtx_t* ctx)
+void skeinReset(struct skein_ctx* ctx)
{
size_t Xlen = 0;
u64* X = NULL;
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;
}
-int skeinUpdateBits(SkeinCtx_t *ctx, const uint8_t *msg,
+int skeinUpdateBits(struct skein_ctx *ctx, const uint8_t *msg,
size_t msgBitCnt)
{
/*
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);
/***************************** Skein_256 ******************************/
-void Skein_256_Process_Block(Skein_256_Ctxt_t *ctx, const u8 *blkPtr,
+void Skein_256_Process_Block(struct skein_256_ctx *ctx, const u8 *blkPtr,
size_t blkCnt, size_t byteCntAdd)
{
- ThreefishKey_t key;
+ struct threefish_key key;
u64 tweak[2];
int i;
u64 w[SKEIN_256_STATE_WORDS]; /* local copy of input block */
ctx->h.T[1] = tweak[1];
}
-void Skein_512_Process_Block(Skein_512_Ctxt_t *ctx, const u8 *blkPtr,
+void Skein_512_Process_Block(struct skein_512_ctx *ctx, const u8 *blkPtr,
size_t blkCnt, size_t byteCntAdd)
{
- ThreefishKey_t key;
+ struct threefish_key key;
u64 tweak[2];
int i;
u64 words[3];
ctx->h.T[1] = tweak[1];
}
-void Skein1024_Process_Block(Skein1024_Ctxt_t *ctx, const u8 *blkPtr,
+void Skein1024_Process_Block(struct skein1024_ctx *ctx, const u8 *blkPtr,
size_t blkCnt, size_t byteCntAdd)
{
- ThreefishKey_t key;
+ struct threefish_key key;
u64 tweak[2];
int i;
u64 words[3];
/***************************** Skein_256 ******************************/
#if !(SKEIN_USE_ASM & 256)
-void Skein_256_Process_Block(Skein_256_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)
{ /* do it in C */
enum
{
/***************************** Skein_512 ******************************/
#if !(SKEIN_USE_ASM & 512)
-void Skein_512_Process_Block(Skein_512_Ctxt_t *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)
{ /* do it in C */
enum
{
/***************************** Skein1024 ******************************/
#if !(SKEIN_USE_ASM & 1024)
-void Skein1024_Process_Block(Skein1024_Ctxt_t *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)
{ /* do it in C, always looping (unrolled is bigger AND slower!) */
enum
{
#include <threefishApi.h>
-void threefishEncrypt1024(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output)
+void threefishEncrypt1024(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output)
{
uint64_t b0 = input[0], b1 = input[1],
output[15] = b15 + k1 + 20;
}
-void threefishDecrypt1024(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output)
+void threefishDecrypt1024(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output)
{
uint64_t b0 = input[0], b1 = input[1],
#include <threefishApi.h>
-void threefishEncrypt256(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output)
+void threefishEncrypt256(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output)
{
uint64_t b0 = input[0], b1 = input[1],
output[3] = b3 + k1 + 18;
}
-void threefishDecrypt256(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output)
+void threefishDecrypt256(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output)
{
uint64_t b0 = input[0], b1 = input[1],
b2 = input[2], b3 = input[3];
#include <threefishApi.h>
-void threefishEncrypt512(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output)
+void threefishEncrypt512(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output)
{
uint64_t b0 = input[0], b1 = input[1],
output[7] = b7 + k7 + 18;
}
-void threefishDecrypt512(ThreefishKey_t* keyCtx, uint64_t* input, uint64_t* output)
+void threefishDecrypt512(struct threefish_key* keyCtx, uint64_t* input, uint64_t* output)
{
uint64_t b0 = input[0], b1 = input[1],
#include <linux/string.h>
#include <threefishApi.h>
-void threefishSetKey(ThreefishKey_t* keyCtx, ThreefishSize_t stateSize,
+void threefishSetKey(struct threefish_key* keyCtx, enum threefish_size stateSize,
uint64_t* keyData, uint64_t* tweak)
{
int keyWords = stateSize / 64;
keyCtx->stateSize = stateSize;
}
-void threefishEncryptBlockBytes(ThreefishKey_t* keyCtx, uint8_t* in,
+void threefishEncryptBlockBytes(struct threefish_key* keyCtx, uint8_t* in,
uint8_t* out)
{
u64 plain[SKEIN_MAX_STATE_WORDS]; /* max number of words*/
Skein_Put64_LSB_First(out, cipher, keyCtx->stateSize / 8); /* words to bytes */
}
-void threefishEncryptBlockWords(ThreefishKey_t* keyCtx, uint64_t* in,
+void threefishEncryptBlockWords(struct threefish_key* keyCtx, uint64_t* in,
uint64_t* out)
{
switch (keyCtx->stateSize) {
}
}
-void threefishDecryptBlockBytes(ThreefishKey_t* keyCtx, uint8_t* in,
+void threefishDecryptBlockBytes(struct threefish_key* keyCtx, uint8_t* in,
uint8_t* out)
{
u64 plain[SKEIN_MAX_STATE_WORDS]; /* max number of words*/
Skein_Put64_LSB_First(out, plain, keyCtx->stateSize / 8); /* words to bytes */
}
-void threefishDecryptBlockWords(ThreefishKey_t* keyCtx, uint64_t* in,
+void threefishDecryptBlockWords(struct threefish_key* keyCtx, uint64_t* in,
uint64_t* out)
{
switch (keyCtx->stateSize) {