Commit 39bd42b0 authored by Jason Cooper's avatar Jason Cooper Committed by Greg Kroah-Hartman

staging: crypto: skein: fix leading whitespace

Signed-off-by: default avatarJason Cooper <jason@lakedaemon.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e6d336f5
...@@ -81,16 +81,16 @@ OTHER DEALINGS IN THE SOFTWARE. ...@@ -81,16 +81,16 @@ OTHER DEALINGS IN THE SOFTWARE.
#include <linux/types.h> #include <linux/types.h>
#include <skein.h> #include <skein.h>
/** /**
* Which Skein size to use * Which Skein size to use
*/ */
enum skein_size { enum skein_size {
Skein256 = 256, /*!< Skein with 256 bit state */ Skein256 = 256, /*!< Skein with 256 bit state */
Skein512 = 512, /*!< Skein with 512 bit state */ Skein512 = 512, /*!< Skein with 512 bit state */
Skein1024 = 1024 /*!< Skein with 1024 bit state */ Skein1024 = 1024 /*!< Skein with 1024 bit state */
}; };
/** /**
* Context for Skein. * Context for Skein.
* *
* This structure was setup with some know-how of the internal * This structure was setup with some know-how of the internal
...@@ -98,7 +98,7 @@ OTHER DEALINGS IN THE SOFTWARE. ...@@ -98,7 +98,7 @@ OTHER DEALINGS IN THE SOFTWARE.
* variables. If Skein implementation changes this, then adapt these * variables. If Skein implementation changes this, then adapt these
* structures as well. * structures as well.
*/ */
struct skein_ctx { struct skein_ctx {
u64 skeinSize; u64 skeinSize;
u64 XSave[SKEIN_MAX_STATE_WORDS]; /* save area for state variables */ u64 XSave[SKEIN_MAX_STATE_WORDS]; /* save area for state variables */
union { union {
...@@ -107,9 +107,9 @@ OTHER DEALINGS IN THE SOFTWARE. ...@@ -107,9 +107,9 @@ OTHER DEALINGS IN THE SOFTWARE.
struct skein_512_ctx s512; struct skein_512_ctx s512;
struct skein1024_ctx s1024; struct skein1024_ctx s1024;
} m; } m;
}; };
/** /**
* Prepare a Skein context. * Prepare a Skein context.
* *
* An application must call this function before it can use the Skein * An application must call this function before it can use the Skein
...@@ -123,9 +123,9 @@ OTHER DEALINGS IN THE SOFTWARE. ...@@ -123,9 +123,9 @@ OTHER DEALINGS IN THE SOFTWARE.
* @return * @return
* SKEIN_SUCESS of SKEIN_FAIL * SKEIN_SUCESS of SKEIN_FAIL
*/ */
int skeinCtxPrepare(struct skein_ctx *ctx, enum skein_size size); int skeinCtxPrepare(struct skein_ctx *ctx, enum skein_size size);
/** /**
* Initialize a Skein context. * Initialize a Skein context.
* *
* Initializes the context with this data and saves the resulting Skein * Initializes the context with this data and saves the resulting Skein
...@@ -139,9 +139,9 @@ OTHER DEALINGS IN THE SOFTWARE. ...@@ -139,9 +139,9 @@ OTHER DEALINGS IN THE SOFTWARE.
* SKEIN_SUCESS of SKEIN_FAIL * SKEIN_SUCESS of SKEIN_FAIL
* @see skeinReset * @see skeinReset
*/ */
int skeinInit(struct skein_ctx *ctx, size_t hashBitLen); int skeinInit(struct skein_ctx *ctx, size_t hashBitLen);
/** /**
* Resets a Skein context for further use. * Resets a Skein context for further use.
* *
* Restores the saved chaining variables to reset the Skein context. * Restores the saved chaining variables to reset the Skein context.
...@@ -151,9 +151,9 @@ OTHER DEALINGS IN THE SOFTWARE. ...@@ -151,9 +151,9 @@ OTHER DEALINGS IN THE SOFTWARE.
* @param ctx * @param ctx
* Pointer to a pre-initialized Skein MAC context * Pointer to a pre-initialized Skein MAC context
*/ */
void skeinReset(struct skein_ctx *ctx); void skeinReset(struct skein_ctx *ctx);
/** /**
* Initializes a Skein context for MAC usage. * Initializes a Skein context for MAC usage.
* *
* Initializes the context with this data and saves the resulting Skein * Initializes the context with this data and saves the resulting Skein
...@@ -173,10 +173,10 @@ OTHER DEALINGS IN THE SOFTWARE. ...@@ -173,10 +173,10 @@ OTHER DEALINGS IN THE SOFTWARE.
* @return * @return
* SKEIN_SUCESS of SKEIN_FAIL * SKEIN_SUCESS of SKEIN_FAIL
*/ */
int skeinMacInit(struct skein_ctx *ctx, const u8 *key, size_t keyLen, int skeinMacInit(struct skein_ctx *ctx, const u8 *key, size_t keyLen,
size_t hashBitLen); size_t hashBitLen);
/** /**
* Update Skein with the next part of the message. * Update Skein with the next part of the message.
* *
* @param ctx * @param ctx
...@@ -188,10 +188,10 @@ OTHER DEALINGS IN THE SOFTWARE. ...@@ -188,10 +188,10 @@ OTHER DEALINGS IN THE SOFTWARE.
* @return * @return
* Success or error code. * Success or error code.
*/ */
int skeinUpdate(struct skein_ctx *ctx, const u8 *msg, int skeinUpdate(struct skein_ctx *ctx, const u8 *msg,
size_t msgByteCnt); size_t msgByteCnt);
/** /**
* Update the hash with a message bit string. * Update the hash with a message bit string.
* *
* Skein can handle data not only as bytes but also as bit strings of * Skein can handle data not only as bytes but also as bit strings of
...@@ -204,10 +204,10 @@ OTHER DEALINGS IN THE SOFTWARE. ...@@ -204,10 +204,10 @@ OTHER DEALINGS IN THE SOFTWARE.
* @param msgBitCnt * @param msgBitCnt
* Length of the message in @b bits. * Length of the message in @b bits.
*/ */
int skeinUpdateBits(struct skein_ctx *ctx, const u8 *msg, int skeinUpdateBits(struct skein_ctx *ctx, const u8 *msg,
size_t msgBitCnt); size_t msgBitCnt);
/** /**
* Finalize Skein and return the hash. * Finalize Skein and return the hash.
* *
* Before an application can reuse a Skein setup the application must * Before an application can reuse a Skein setup the application must
...@@ -222,7 +222,7 @@ OTHER DEALINGS IN THE SOFTWARE. ...@@ -222,7 +222,7 @@ OTHER DEALINGS IN THE SOFTWARE.
* Success or error code. * Success or error code.
* @see skeinReset * @see skeinReset
*/ */
int skeinFinal(struct skein_ctx *ctx, u8 *hash); int skeinFinal(struct skein_ctx *ctx, u8 *hash);
/** /**
* @} * @}
......
...@@ -33,16 +33,16 @@ ...@@ -33,16 +33,16 @@
#define KeyScheduleConst 0x1BD11BDAA9FC1A22L #define KeyScheduleConst 0x1BD11BDAA9FC1A22L
/** /**
* Which Threefish size to use * Which Threefish size to use
*/ */
enum threefish_size { enum threefish_size {
Threefish256 = 256, /*!< Skein with 256 bit state */ Threefish256 = 256, /*!< Skein with 256 bit state */
Threefish512 = 512, /*!< Skein with 512 bit state */ Threefish512 = 512, /*!< Skein with 512 bit state */
Threefish1024 = 1024 /*!< Skein with 1024 bit state */ Threefish1024 = 1024 /*!< Skein with 1024 bit state */
}; };
/** /**
* Context for Threefish key and tweak words. * Context for Threefish key and tweak words.
* *
* This structure was setup with some know-how of the internal * This structure was setup with some know-how of the internal
...@@ -50,13 +50,13 @@ ...@@ -50,13 +50,13 @@
* variables. If Skein implementation changes this, the adapt these * variables. If Skein implementation changes this, the adapt these
* structures as well. * structures as well.
*/ */
struct threefish_key { struct threefish_key {
u64 stateSize; u64 stateSize;
u64 key[SKEIN_MAX_STATE_WORDS+1]; /* max number of key words*/ u64 key[SKEIN_MAX_STATE_WORDS+1]; /* max number of key words*/
u64 tweak[3]; u64 tweak[3];
}; };
/** /**
* Set Threefish key and tweak data. * Set Threefish key and tweak data.
* *
* This function sets the key and tweak data for the Threefish cipher of * This function sets the key and tweak data for the Threefish cipher of
...@@ -72,9 +72,9 @@ ...@@ -72,9 +72,9 @@
* @param tweak * @param tweak
* Pointer to the two tweak words (word has 64 bits). * Pointer to the two tweak words (word has 64 bits).
*/ */
void threefishSetKey(struct threefish_key *keyCtx, enum threefish_size stateSize, u64 *keyData, u64 *tweak); void threefishSetKey(struct threefish_key *keyCtx, enum threefish_size stateSize, u64 *keyData, u64 *tweak);
/** /**
* Encrypt Threefisch block (bytes). * Encrypt Threefisch block (bytes).
* *
* The buffer must have at least the same length (number of bits) aas the * The buffer must have at least the same length (number of bits) aas the
...@@ -89,9 +89,9 @@ ...@@ -89,9 +89,9 @@
* @param out * @param out
* Pointer to cipher buffer. * Pointer to cipher buffer.
*/ */
void threefishEncryptBlockBytes(struct threefish_key *keyCtx, u8 *in, u8 *out); void threefishEncryptBlockBytes(struct threefish_key *keyCtx, u8 *in, u8 *out);
/** /**
* Encrypt Threefisch block (words). * Encrypt Threefisch block (words).
* *
* The buffer must have at least the same length (number of bits) aas the * The buffer must have at least the same length (number of bits) aas the
...@@ -108,9 +108,9 @@ ...@@ -108,9 +108,9 @@
* @param out * @param out
* Pointer to cipher buffer. * Pointer to cipher buffer.
*/ */
void threefishEncryptBlockWords(struct threefish_key *keyCtx, u64 *in, u64 *out); void threefishEncryptBlockWords(struct threefish_key *keyCtx, u64 *in, u64 *out);
/** /**
* Decrypt Threefisch block (bytes). * Decrypt Threefisch block (bytes).
* *
* The buffer must have at least the same length (number of bits) aas the * The buffer must have at least the same length (number of bits) aas the
...@@ -125,9 +125,9 @@ ...@@ -125,9 +125,9 @@
* @param out * @param out
* Pointer to plaintext buffer. * Pointer to plaintext buffer.
*/ */
void threefishDecryptBlockBytes(struct threefish_key *keyCtx, u8 *in, u8 *out); void threefishDecryptBlockBytes(struct threefish_key *keyCtx, u8 *in, u8 *out);
/** /**
* Decrypt Threefisch block (words). * Decrypt Threefisch block (words).
* *
* The buffer must have at least the same length (number of bits) aas the * The buffer must have at least the same length (number of bits) aas the
...@@ -144,14 +144,14 @@ ...@@ -144,14 +144,14 @@
* @param out * @param out
* Pointer to plaintext buffer. * Pointer to plaintext buffer.
*/ */
void threefishDecryptBlockWords(struct threefish_key *keyCtx, u64 *in, u64 *out); void threefishDecryptBlockWords(struct threefish_key *keyCtx, u64 *in, u64 *out);
void threefishEncrypt256(struct threefish_key *keyCtx, u64 *input, u64 *output); void threefishEncrypt256(struct threefish_key *keyCtx, u64 *input, u64 *output);
void threefishEncrypt512(struct threefish_key *keyCtx, u64 *input, u64 *output); void threefishEncrypt512(struct threefish_key *keyCtx, u64 *input, u64 *output);
void threefishEncrypt1024(struct threefish_key *keyCtx, u64 *input, u64 *output); void threefishEncrypt1024(struct threefish_key *keyCtx, u64 *input, u64 *output);
void threefishDecrypt256(struct threefish_key *keyCtx, u64 *input, u64 *output); void threefishDecrypt256(struct threefish_key *keyCtx, u64 *input, u64 *output);
void threefishDecrypt512(struct threefish_key *keyCtx, u64 *input, u64 *output); void threefishDecrypt512(struct threefish_key *keyCtx, u64 *input, u64 *output);
void threefishDecrypt1024(struct threefish_key *keyCtx, u64 *input, u64 *output); void threefishDecrypt1024(struct threefish_key *keyCtx, u64 *input, u64 *output);
/** /**
* @} * @}
*/ */
......
...@@ -206,25 +206,25 @@ void Skein_256_Process_Block(struct skein_256_ctx *ctx, const u8 *blkPtr, size_t ...@@ -206,25 +206,25 @@ void Skein_256_Process_Block(struct skein_256_ctx *ctx, const u8 *blkPtr, size_t
while (--blkCnt); while (--blkCnt);
ctx->h.T[0] = ts[0]; ctx->h.T[0] = ts[0];
ctx->h.T[1] = ts[1]; ctx->h.T[1] = ts[1];
} }
#if defined(SKEIN_CODE_SIZE) || defined(SKEIN_PERF) #if defined(SKEIN_CODE_SIZE) || defined(SKEIN_PERF)
size_t Skein_256_Process_Block_CodeSize(void) size_t Skein_256_Process_Block_CodeSize(void)
{ {
return ((u8 *) Skein_256_Process_Block_CodeSize) - return ((u8 *) Skein_256_Process_Block_CodeSize) -
((u8 *) Skein_256_Process_Block); ((u8 *) Skein_256_Process_Block);
} }
unsigned int Skein_256_Unroll_Cnt(void) unsigned int Skein_256_Unroll_Cnt(void)
{ {
return SKEIN_UNROLL_256; return SKEIN_UNROLL_256;
} }
#endif #endif
#endif #endif
/***************************** Skein_512 ******************************/ /***************************** Skein_512 ******************************/
#if !(SKEIN_USE_ASM & 512) #if !(SKEIN_USE_ASM & 512)
void Skein_512_Process_Block(struct skein_512_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)
{ /* do it in C */ { /* do it in C */
enum { enum {
WCNT = SKEIN_512_STATE_WORDS WCNT = SKEIN_512_STATE_WORDS
}; };
...@@ -413,25 +413,25 @@ void Skein_512_Process_Block(struct skein_512_ctx *ctx, const u8 *blkPtr, size_t ...@@ -413,25 +413,25 @@ void Skein_512_Process_Block(struct skein_512_ctx *ctx, const u8 *blkPtr, size_t
while (--blkCnt); while (--blkCnt);
ctx->h.T[0] = ts[0]; ctx->h.T[0] = ts[0];
ctx->h.T[1] = ts[1]; ctx->h.T[1] = ts[1];
} }
#if defined(SKEIN_CODE_SIZE) || defined(SKEIN_PERF) #if defined(SKEIN_CODE_SIZE) || defined(SKEIN_PERF)
size_t Skein_512_Process_Block_CodeSize(void) size_t Skein_512_Process_Block_CodeSize(void)
{ {
return ((u8 *) Skein_512_Process_Block_CodeSize) - return ((u8 *) Skein_512_Process_Block_CodeSize) -
((u8 *) Skein_512_Process_Block); ((u8 *) Skein_512_Process_Block);
} }
unsigned int Skein_512_Unroll_Cnt(void) unsigned int Skein_512_Unroll_Cnt(void)
{ {
return SKEIN_UNROLL_512; return SKEIN_UNROLL_512;
} }
#endif #endif
#endif #endif
/***************************** Skein1024 ******************************/ /***************************** Skein1024 ******************************/
#if !(SKEIN_USE_ASM & 1024) #if !(SKEIN_USE_ASM & 1024)
void Skein1024_Process_Block(struct skein1024_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)
{ /* do it in C, always looping (unrolled is bigger AND slower!) */ { /* do it in C, always looping (unrolled is bigger AND slower!) */
enum { enum {
WCNT = SKEIN1024_STATE_WORDS WCNT = SKEIN1024_STATE_WORDS
}; };
...@@ -639,7 +639,7 @@ void Skein1024_Process_Block(struct skein1024_ctx *ctx, const u8 *blkPtr, size_t ...@@ -639,7 +639,7 @@ void Skein1024_Process_Block(struct skein1024_ctx *ctx, const u8 *blkPtr, size_t
#if R1024_Unroll_R(14) #if R1024_Unroll_R(14)
R1024_8_rounds(14); R1024_8_rounds(14);
#endif #endif
#if (SKEIN_UNROLL_1024 > 14) #if (SKEIN_UNROLL_1024 > 14)
#error "need more unrolling in Skein_1024_Process_Block" #error "need more unrolling in Skein_1024_Process_Block"
#endif #endif
} }
...@@ -670,17 +670,17 @@ void Skein1024_Process_Block(struct skein1024_ctx *ctx, const u8 *blkPtr, size_t ...@@ -670,17 +670,17 @@ void Skein1024_Process_Block(struct skein1024_ctx *ctx, const u8 *blkPtr, size_t
while (--blkCnt); while (--blkCnt);
ctx->h.T[0] = ts[0]; ctx->h.T[0] = ts[0];
ctx->h.T[1] = ts[1]; ctx->h.T[1] = ts[1];
} }
#if defined(SKEIN_CODE_SIZE) || defined(SKEIN_PERF) #if defined(SKEIN_CODE_SIZE) || defined(SKEIN_PERF)
size_t Skein1024_Process_Block_CodeSize(void) size_t Skein1024_Process_Block_CodeSize(void)
{ {
return ((u8 *) Skein1024_Process_Block_CodeSize) - return ((u8 *) Skein1024_Process_Block_CodeSize) -
((u8 *) Skein1024_Process_Block); ((u8 *) Skein1024_Process_Block);
} }
unsigned int Skein1024_Unroll_Cnt(void) unsigned int Skein1024_Unroll_Cnt(void)
{ {
return SKEIN_UNROLL_1024; return SKEIN_UNROLL_1024;
} }
#endif #endif
#endif #endif
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
void threefishEncrypt1024(struct threefish_key *keyCtx, u64 *input, u64 *output) void threefishEncrypt1024(struct threefish_key *keyCtx, u64 *input, u64 *output)
{ {
u64 b0 = input[0], b1 = input[1], u64 b0 = input[0], b1 = input[1],
b2 = input[2], b3 = input[3], b2 = input[2], b3 = input[3],
b4 = input[4], b5 = input[5], b4 = input[4], b5 = input[5],
...@@ -682,11 +681,10 @@ void threefishEncrypt1024(struct threefish_key *keyCtx, u64 *input, u64 *output) ...@@ -682,11 +681,10 @@ void threefishEncrypt1024(struct threefish_key *keyCtx, u64 *input, u64 *output)
output[13] = b13 + k16 + t2; output[13] = b13 + k16 + t2;
output[14] = b14 + k0 + t0; output[14] = b14 + k0 + t0;
output[15] = b15 + k1 + 20; output[15] = b15 + k1 + 20;
} }
void threefishDecrypt1024(struct threefish_key *keyCtx, u64 *input, u64 *output) void threefishDecrypt1024(struct threefish_key *keyCtx, u64 *input, u64 *output)
{ {
u64 b0 = input[0], b1 = input[1], u64 b0 = input[0], b1 = input[1],
b2 = input[2], b3 = input[3], b2 = input[2], b3 = input[3],
b4 = input[4], b5 = input[5], b4 = input[4], b5 = input[5],
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
void threefishEncrypt256(struct threefish_key *keyCtx, u64 *input, u64 *output) void threefishEncrypt256(struct threefish_key *keyCtx, u64 *input, u64 *output)
{ {
u64 b0 = input[0], b1 = input[1], u64 b0 = input[0], b1 = input[1],
b2 = input[2], b3 = input[3]; b2 = input[2], b3 = input[3];
u64 k0 = keyCtx->key[0], k1 = keyCtx->key[1], u64 k0 = keyCtx->key[0], k1 = keyCtx->key[1],
...@@ -170,10 +169,10 @@ void threefishEncrypt256(struct threefish_key *keyCtx, u64 *input, u64 *output) ...@@ -170,10 +169,10 @@ void threefishEncrypt256(struct threefish_key *keyCtx, u64 *input, u64 *output)
output[1] = b1 + k4 + t0; output[1] = b1 + k4 + t0;
output[2] = b2 + k0 + t1; output[2] = b2 + k0 + t1;
output[3] = b3 + k1 + 18; output[3] = b3 + k1 + 18;
} }
void threefishDecrypt256(struct threefish_key *keyCtx, u64 *input, u64 *output) void threefishDecrypt256(struct threefish_key *keyCtx, u64 *input, u64 *output)
{ {
u64 b0 = input[0], b1 = input[1], u64 b0 = input[0], b1 = input[1],
b2 = input[2], b3 = input[3]; b2 = input[2], b3 = input[3];
u64 k0 = keyCtx->key[0], k1 = keyCtx->key[1], u64 k0 = keyCtx->key[0], k1 = keyCtx->key[1],
...@@ -345,4 +344,4 @@ void threefishDecrypt256(struct threefish_key *keyCtx, u64 *input, u64 *output) ...@@ -345,4 +344,4 @@ void threefishDecrypt256(struct threefish_key *keyCtx, u64 *input, u64 *output)
output[1] = b1; output[1] = b1;
output[2] = b2; output[2] = b2;
output[3] = b3; output[3] = b3;
} }
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
void threefishEncrypt512(struct threefish_key *keyCtx, u64 *input, u64 *output) void threefishEncrypt512(struct threefish_key *keyCtx, u64 *input, u64 *output)
{ {
u64 b0 = input[0], b1 = input[1], u64 b0 = input[0], b1 = input[1],
b2 = input[2], b3 = input[3], b2 = input[2], b3 = input[3],
b4 = input[4], b5 = input[5], b4 = input[4], b5 = input[5],
...@@ -314,11 +313,10 @@ void threefishEncrypt512(struct threefish_key *keyCtx, u64 *input, u64 *output) ...@@ -314,11 +313,10 @@ void threefishEncrypt512(struct threefish_key *keyCtx, u64 *input, u64 *output)
output[5] = b5 + k5 + t0; output[5] = b5 + k5 + t0;
output[6] = b6 + k6 + t1; output[6] = b6 + k6 + t1;
output[7] = b7 + k7 + 18; output[7] = b7 + k7 + 18;
} }
void threefishDecrypt512(struct threefish_key *keyCtx, u64 *input, u64 *output) void threefishDecrypt512(struct threefish_key *keyCtx, u64 *input, u64 *output)
{ {
u64 b0 = input[0], b1 = input[1], u64 b0 = input[0], b1 = input[1],
b2 = input[2], b3 = input[3], b2 = input[2], b3 = input[3],
b4 = input[4], b5 = input[5], b4 = input[4], b5 = input[5],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment