Commit 161a2afd authored by Jason Cooper's avatar Jason Cooper Committed by Greg Kroah-Hartman

staging: crypto: skein: fix brace placement errors

Signed-off-by: default avatarJason Cooper <jason@lakedaemon.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 51cc00fd
...@@ -37,12 +37,11 @@ ...@@ -37,12 +37,11 @@
#define Skein_Get64_LSB_First(dst64, src08, wCnt) memcpy(dst64, src08, 8*(wCnt)) #define Skein_Get64_LSB_First(dst64, src08, wCnt) memcpy(dst64, src08, 8*(wCnt))
#define Skein_Swap64(w64) (w64) #define Skein_Swap64(w64) (w64)
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
}; };
#define SKEIN_MODIFIER_WORDS (2) /* number of modifier (tweak) words */ #define SKEIN_MODIFIER_WORDS (2) /* number of modifier (tweak) words */
...@@ -63,33 +62,29 @@ enum ...@@ -63,33 +62,29 @@ enum
#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)
struct skein_ctx_hdr struct skein_ctx_hdr {
{
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[] */
u64 T[SKEIN_MODIFIER_WORDS]; /* tweak: T[0]=byte cnt, T[1]=flags */ u64 T[SKEIN_MODIFIER_WORDS]; /* tweak: T[0]=byte cnt, T[1]=flags */
}; };
struct skein_256_ctx /* 256-bit Skein hash context structure */ struct skein_256_ctx { /* 256-bit Skein hash context structure */
{
struct skein_ctx_hdr h; /* common header context variables */ struct skein_ctx_hdr h; /* common header context variables */
u64 X[SKEIN_256_STATE_WORDS]; /* chaining variables */ u64 X[SKEIN_256_STATE_WORDS]; /* chaining variables */
u8 b[SKEIN_256_BLOCK_BYTES]; /* partial block buf (8-byte aligned) */ u8 b[SKEIN_256_BLOCK_BYTES]; /* partial block buf (8-byte aligned) */
}; };
struct skein_512_ctx /* 512-bit Skein hash context structure */ struct skein_512_ctx { /* 512-bit Skein hash context structure */
{
struct skein_ctx_hdr h; /* common header context variables */ struct skein_ctx_hdr h; /* common header context variables */
u64 X[SKEIN_512_STATE_WORDS]; /* chaining variables */ u64 X[SKEIN_512_STATE_WORDS]; /* chaining variables */
u8 b[SKEIN_512_BLOCK_BYTES]; /* partial block buf (8-byte aligned) */ u8 b[SKEIN_512_BLOCK_BYTES]; /* partial block buf (8-byte aligned) */
}; };
struct skein1024_ctx /* 1024-bit Skein hash context structure */ struct skein1024_ctx { /* 1024-bit Skein hash context structure */
{
struct skein_ctx_hdr h; /* common header context variables */ struct skein_ctx_hdr h; /* common header context variables */
u64 X[SKEIN1024_STATE_WORDS]; /* chaining variables */ u64 X[SKEIN1024_STATE_WORDS]; /* chaining variables */
u8 b[SKEIN1024_BLOCK_BYTES]; /* partial block buf (8-byte aligned) */ u8 b[SKEIN1024_BLOCK_BYTES]; /* partial block buf (8-byte aligned) */
}; };
/* Skein APIs for (incremental) "straight hashing" */ /* Skein APIs for (incremental) "straight hashing" */
int Skein_256_Init(struct skein_256_ctx *ctx, size_t hashBitLen); int Skein_256_Init(struct skein_256_ctx *ctx, size_t hashBitLen);
...@@ -296,8 +291,7 @@ int Skein1024_Output(struct skein1024_ctx *ctx, u8 *hashVal); ...@@ -296,8 +291,7 @@ int Skein1024_Output(struct skein1024_ctx *ctx, u8 *hashVal);
/***************************************************************** /*****************************************************************
** Skein block function constants (shared across Ref and Opt code) ** Skein block function constants (shared across Ref and Opt code)
******************************************************************/ ******************************************************************/
enum enum {
{
/* Skein_256 round rotation constants */ /* Skein_256 round rotation constants */
R_256_0_0 = 14, R_256_0_1 = 16, R_256_0_0 = 14, R_256_0_1 = 16,
R_256_1_0 = 52, R_256_1_1 = 57, R_256_1_0 = 52, R_256_1_1 = 57,
...@@ -335,7 +329,7 @@ enum ...@@ -335,7 +329,7 @@ enum
R1024_6_4 = 19, R1024_6_5 = 42, R1024_6_6 = 44, R1024_6_7 = 25, R1024_6_4 = 19, R1024_6_5 = 42, R1024_6_6 = 44, R1024_6_7 = 25,
R1024_7_0 = 9, R1024_7_1 = 48, R1024_7_2 = 35, R1024_7_3 = 52, R1024_7_0 = 9, R1024_7_1 = 48, R1024_7_2 = 35, R1024_7_3 = 52,
R1024_7_4 = 23, R1024_7_5 = 31, R1024_7_6 = 37, R1024_7_7 = 20 R1024_7_4 = 23, R1024_7_5 = 31, R1024_7_6 = 37, R1024_7_7 = 20
}; };
#ifndef SKEIN_ROUNDS #ifndef SKEIN_ROUNDS
#define SKEIN_256_ROUNDS_TOTAL (72) /* # rounds for diff block sizes */ #define SKEIN_256_ROUNDS_TOTAL (72) /* # rounds for diff block sizes */
......
...@@ -20,44 +20,39 @@ ...@@ -20,44 +20,39 @@
#define MK_64 SKEIN_MK_64 #define MK_64 SKEIN_MK_64
/* blkSize = 256 bits. hashSize = 128 bits */ /* blkSize = 256 bits. hashSize = 128 bits */
const u64 SKEIN_256_IV_128[] = const u64 SKEIN_256_IV_128[] = {
{
MK_64(0xE1111906, 0x964D7260), MK_64(0xE1111906, 0x964D7260),
MK_64(0x883DAAA7, 0x7C8D811C), MK_64(0x883DAAA7, 0x7C8D811C),
MK_64(0x10080DF4, 0x91960F7A), MK_64(0x10080DF4, 0x91960F7A),
MK_64(0xCCF7DDE5, 0xB45BC1C2) MK_64(0xCCF7DDE5, 0xB45BC1C2)
}; };
/* blkSize = 256 bits. hashSize = 160 bits */ /* blkSize = 256 bits. hashSize = 160 bits */
const u64 SKEIN_256_IV_160[] = const u64 SKEIN_256_IV_160[] = {
{
MK_64(0x14202314, 0x72825E98), MK_64(0x14202314, 0x72825E98),
MK_64(0x2AC4E9A2, 0x5A77E590), MK_64(0x2AC4E9A2, 0x5A77E590),
MK_64(0xD47A5856, 0x8838D63E), MK_64(0xD47A5856, 0x8838D63E),
MK_64(0x2DD2E496, 0x8586AB7D) MK_64(0x2DD2E496, 0x8586AB7D)
}; };
/* blkSize = 256 bits. hashSize = 224 bits */ /* blkSize = 256 bits. hashSize = 224 bits */
const u64 SKEIN_256_IV_224[] = const u64 SKEIN_256_IV_224[] = {
{
MK_64(0xC6098A8C, 0x9AE5EA0B), MK_64(0xC6098A8C, 0x9AE5EA0B),
MK_64(0x876D5686, 0x08C5191C), MK_64(0x876D5686, 0x08C5191C),
MK_64(0x99CB88D7, 0xD7F53884), MK_64(0x99CB88D7, 0xD7F53884),
MK_64(0x384BDDB1, 0xAEDDB5DE) MK_64(0x384BDDB1, 0xAEDDB5DE)
}; };
/* blkSize = 256 bits. hashSize = 256 bits */ /* blkSize = 256 bits. hashSize = 256 bits */
const u64 SKEIN_256_IV_256[] = const u64 SKEIN_256_IV_256[] = {
{
MK_64(0xFC9DA860, 0xD048B449), MK_64(0xFC9DA860, 0xD048B449),
MK_64(0x2FCA6647, 0x9FA7D833), MK_64(0x2FCA6647, 0x9FA7D833),
MK_64(0xB33BC389, 0x6656840F), MK_64(0xB33BC389, 0x6656840F),
MK_64(0x6A54E920, 0xFDE8DA69) MK_64(0x6A54E920, 0xFDE8DA69)
}; };
/* blkSize = 512 bits. hashSize = 128 bits */ /* blkSize = 512 bits. hashSize = 128 bits */
const u64 SKEIN_512_IV_128[] = const u64 SKEIN_512_IV_128[] = {
{
MK_64(0xA8BC7BF3, 0x6FBF9F52), MK_64(0xA8BC7BF3, 0x6FBF9F52),
MK_64(0x1E9872CE, 0xBD1AF0AA), MK_64(0x1E9872CE, 0xBD1AF0AA),
MK_64(0x309B1790, 0xB32190D3), MK_64(0x309B1790, 0xB32190D3),
...@@ -66,11 +61,10 @@ const u64 SKEIN_512_IV_128[] = ...@@ -66,11 +61,10 @@ const u64 SKEIN_512_IV_128[] =
MK_64(0x1A18EBEA, 0xD46A32E3), MK_64(0x1A18EBEA, 0xD46A32E3),
MK_64(0xA2CC5B18, 0xCE84AA82), MK_64(0xA2CC5B18, 0xCE84AA82),
MK_64(0x6982AB28, 0x9D46982D) MK_64(0x6982AB28, 0x9D46982D)
}; };
/* blkSize = 512 bits. hashSize = 160 bits */ /* blkSize = 512 bits. hashSize = 160 bits */
const u64 SKEIN_512_IV_160[] = const u64 SKEIN_512_IV_160[] = {
{
MK_64(0x28B81A2A, 0xE013BD91), MK_64(0x28B81A2A, 0xE013BD91),
MK_64(0xC2F11668, 0xB5BDF78F), MK_64(0xC2F11668, 0xB5BDF78F),
MK_64(0x1760D8F3, 0xF6A56F12), MK_64(0x1760D8F3, 0xF6A56F12),
...@@ -79,11 +73,10 @@ const u64 SKEIN_512_IV_160[] = ...@@ -79,11 +73,10 @@ const u64 SKEIN_512_IV_160[] =
MK_64(0xD908922E, 0x63ED70B8), MK_64(0xD908922E, 0x63ED70B8),
MK_64(0xB8EC76FF, 0xECCB52FA), MK_64(0xB8EC76FF, 0xECCB52FA),
MK_64(0x01A47BB8, 0xA3F27A6E) MK_64(0x01A47BB8, 0xA3F27A6E)
}; };
/* blkSize = 512 bits. hashSize = 224 bits */ /* blkSize = 512 bits. hashSize = 224 bits */
const u64 SKEIN_512_IV_224[] = const u64 SKEIN_512_IV_224[] = {
{
MK_64(0xCCD06162, 0x48677224), MK_64(0xCCD06162, 0x48677224),
MK_64(0xCBA65CF3, 0xA92339EF), MK_64(0xCBA65CF3, 0xA92339EF),
MK_64(0x8CCD69D6, 0x52FF4B64), MK_64(0x8CCD69D6, 0x52FF4B64),
...@@ -92,11 +85,10 @@ const u64 SKEIN_512_IV_224[] = ...@@ -92,11 +85,10 @@ const u64 SKEIN_512_IV_224[] =
MK_64(0x6776FE65, 0x75D4EB3D), MK_64(0x6776FE65, 0x75D4EB3D),
MK_64(0x99FBC70E, 0x997413E9), MK_64(0x99FBC70E, 0x997413E9),
MK_64(0x9E2CFCCF, 0xE1C41EF7) MK_64(0x9E2CFCCF, 0xE1C41EF7)
}; };
/* blkSize = 512 bits. hashSize = 256 bits */ /* blkSize = 512 bits. hashSize = 256 bits */
const u64 SKEIN_512_IV_256[] = const u64 SKEIN_512_IV_256[] = {
{
MK_64(0xCCD044A1, 0x2FDB3E13), MK_64(0xCCD044A1, 0x2FDB3E13),
MK_64(0xE8359030, 0x1A79A9EB), MK_64(0xE8359030, 0x1A79A9EB),
MK_64(0x55AEA061, 0x4F816E6F), MK_64(0x55AEA061, 0x4F816E6F),
...@@ -105,11 +97,10 @@ const u64 SKEIN_512_IV_256[] = ...@@ -105,11 +97,10 @@ const u64 SKEIN_512_IV_256[] =
MK_64(0xE7A436CD, 0xC4746251), MK_64(0xE7A436CD, 0xC4746251),
MK_64(0xC36FBAF9, 0x393AD185), MK_64(0xC36FBAF9, 0x393AD185),
MK_64(0x3EEDBA18, 0x33EDFC13) MK_64(0x3EEDBA18, 0x33EDFC13)
}; };
/* blkSize = 512 bits. hashSize = 384 bits */ /* blkSize = 512 bits. hashSize = 384 bits */
const u64 SKEIN_512_IV_384[] = const u64 SKEIN_512_IV_384[] = {
{
MK_64(0xA3F6C6BF, 0x3A75EF5F), MK_64(0xA3F6C6BF, 0x3A75EF5F),
MK_64(0xB0FEF9CC, 0xFD84FAA4), MK_64(0xB0FEF9CC, 0xFD84FAA4),
MK_64(0x9D77DD66, 0x3D770CFE), MK_64(0x9D77DD66, 0x3D770CFE),
...@@ -118,11 +109,10 @@ const u64 SKEIN_512_IV_384[] = ...@@ -118,11 +109,10 @@ const u64 SKEIN_512_IV_384[] =
MK_64(0x7ED7D434, 0xE5807407), MK_64(0x7ED7D434, 0xE5807407),
MK_64(0x548FC1AC, 0xD4EC44D6), MK_64(0x548FC1AC, 0xD4EC44D6),
MK_64(0x266E1754, 0x6AA18FF8) MK_64(0x266E1754, 0x6AA18FF8)
}; };
/* blkSize = 512 bits. hashSize = 512 bits */ /* blkSize = 512 bits. hashSize = 512 bits */
const u64 SKEIN_512_IV_512[] = const u64 SKEIN_512_IV_512[] = {
{
MK_64(0x4903ADFF, 0x749C51CE), MK_64(0x4903ADFF, 0x749C51CE),
MK_64(0x0D95DE39, 0x9746DF03), MK_64(0x0D95DE39, 0x9746DF03),
MK_64(0x8FD19341, 0x27C79BCE), MK_64(0x8FD19341, 0x27C79BCE),
...@@ -131,11 +121,10 @@ const u64 SKEIN_512_IV_512[] = ...@@ -131,11 +121,10 @@ const u64 SKEIN_512_IV_512[] =
MK_64(0xEABE394C, 0xA9D5C3F4), MK_64(0xEABE394C, 0xA9D5C3F4),
MK_64(0x991112C7, 0x1A75B523), MK_64(0x991112C7, 0x1A75B523),
MK_64(0xAE18A40B, 0x660FCC33) MK_64(0xAE18A40B, 0x660FCC33)
}; };
/* blkSize = 1024 bits. hashSize = 384 bits */ /* blkSize = 1024 bits. hashSize = 384 bits */
const u64 SKEIN1024_IV_384[] = const u64 SKEIN1024_IV_384[] = {
{
MK_64(0x5102B6B8, 0xC1894A35), MK_64(0x5102B6B8, 0xC1894A35),
MK_64(0xFEEBC9E3, 0xFE8AF11A), MK_64(0xFEEBC9E3, 0xFE8AF11A),
MK_64(0x0C807F06, 0xE32BED71), MK_64(0x0C807F06, 0xE32BED71),
...@@ -152,11 +141,10 @@ const u64 SKEIN1024_IV_384[] = ...@@ -152,11 +141,10 @@ const u64 SKEIN1024_IV_384[] =
MK_64(0x3B5A6530, 0x0DBC6516), MK_64(0x3B5A6530, 0x0DBC6516),
MK_64(0x484B9CD2, 0x167BBCE1), MK_64(0x484B9CD2, 0x167BBCE1),
MK_64(0x2D136947, 0xD4CBAFEA) MK_64(0x2D136947, 0xD4CBAFEA)
}; };
/* blkSize = 1024 bits. hashSize = 512 bits */ /* blkSize = 1024 bits. hashSize = 512 bits */
const u64 SKEIN1024_IV_512[] = const u64 SKEIN1024_IV_512[] = {
{
MK_64(0xCAEC0E5D, 0x7C1B1B18), MK_64(0xCAEC0E5D, 0x7C1B1B18),
MK_64(0xA01B0E04, 0x5F03E802), MK_64(0xA01B0E04, 0x5F03E802),
MK_64(0x33840451, 0xED912885), MK_64(0x33840451, 0xED912885),
...@@ -173,11 +161,10 @@ const u64 SKEIN1024_IV_512[] = ...@@ -173,11 +161,10 @@ const u64 SKEIN1024_IV_512[] =
MK_64(0x67070872, 0x5B749816), MK_64(0x67070872, 0x5B749816),
MK_64(0xB9CD28FB, 0xF0581BD1), MK_64(0xB9CD28FB, 0xF0581BD1),
MK_64(0x0E2940B8, 0x15804974) MK_64(0x0E2940B8, 0x15804974)
}; };
/* blkSize = 1024 bits. hashSize = 1024 bits */ /* blkSize = 1024 bits. hashSize = 1024 bits */
const u64 SKEIN1024_IV_1024[] = const u64 SKEIN1024_IV_1024[] = {
{
MK_64(0xD593DA07, 0x41E72355), MK_64(0xD593DA07, 0x41E72355),
MK_64(0x15B5E511, 0xAC73E00C), MK_64(0x15B5E511, 0xAC73E00C),
MK_64(0x5180E5AE, 0xBAF2C4F0), MK_64(0x5180E5AE, 0xBAF2C4F0),
...@@ -194,6 +181,6 @@ const u64 SKEIN1024_IV_1024[] = ...@@ -194,6 +181,6 @@ const u64 SKEIN1024_IV_1024[] =
MK_64(0x6572DD22, 0xF2B4969A), MK_64(0x6572DD22, 0xF2B4969A),
MK_64(0x61FD3062, 0xD00A579A), MK_64(0x61FD3062, 0xD00A579A),
MK_64(0x1DE0536E, 0x8682E539) MK_64(0x1DE0536E, 0x8682E539)
}; };
#endif /* _SKEIN_IV_H_ */ #endif /* _SKEIN_IV_H_ */
This diff is collapsed.
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