summaryrefslogtreecommitdiffstats
path: root/drivers/staging/skein
diff options
context:
space:
mode:
authorJason Cooper <jason@lakedaemon.net>2014-03-24 01:49:01 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-04-18 15:47:40 -0700
commitda13dfd7e6e792497228cf650289a0d4d5690d38 (patch)
tree903a46b6fdc6e35f826f70f60e24038b699897c5 /drivers/staging/skein
parent5057bbbe74a08d0f2bab5c6b7213fea67279f3a2 (diff)
downloadlinux-da13dfd7e6e792497228cf650289a0d4d5690d38.tar.bz2
staging: crypto: skein: remove skein_port.h
Signed-off-by: Jason Cooper <jason@lakedaemon.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/skein')
-rw-r--r--drivers/staging/skein/include/skein.h14
-rw-r--r--drivers/staging/skein/include/skein_port.h108
-rw-r--r--drivers/staging/skein/skein.c21
3 files changed, 13 insertions, 130 deletions
diff --git a/drivers/staging/skein/include/skein.h b/drivers/staging/skein/include/skein.h
index fc9d0a0a9c0a..f924a688e20a 100644
--- a/drivers/staging/skein/include/skein.h
+++ b/drivers/staging/skein/include/skein.h
@@ -33,7 +33,19 @@ extern "C"
#endif
#include <stddef.h> /* get size_t definition */
-#include <skein_port.h> /* get platform-specific definitions */
+
+typedef unsigned int uint_t; /* native unsigned integer */
+typedef uint8_t u08b_t; /* 8-bit unsigned integer */
+typedef uint64_t u64b_t; /* 64-bit unsigned integer */
+
+#ifndef RotL_64
+#define RotL_64(x,N) (((x) << (N)) | ((x) >> (64-(N))))
+#endif
+
+/* below two prototype assume we are handed aligned data */
+#define Skein_Put64_LSB_First(dst08,src64,bCnt) memcpy(dst08,src64,bCnt)
+#define Skein_Get64_LSB_First(dst64,src08,wCnt) memcpy(dst64,src08,8*(wCnt))
+#define Skein_Swap64(w64) (w64)
enum
{
diff --git a/drivers/staging/skein/include/skein_port.h b/drivers/staging/skein/include/skein_port.h
deleted file mode 100644
index d963813ea125..000000000000
--- a/drivers/staging/skein/include/skein_port.h
+++ /dev/null
@@ -1,108 +0,0 @@
-#ifndef _SKEIN_PORT_H_
-#define _SKEIN_PORT_H_
-/*******************************************************************
-**
-** Platform-specific definitions for Skein hash function.
-**
-** Source code author: Doug Whiting, 2008.
-**
-** This algorithm and source code is released to the public domain.
-**
-** Many thanks to Brian Gladman for his portable header files.
-**
-** To port Skein to an "unsupported" platform, change the definitions
-** in this file appropriately.
-**
-********************************************************************/
-
-typedef unsigned int uint_t; /* native unsigned integer */
-typedef uint8_t u08b_t; /* 8-bit unsigned integer */
-typedef uint64_t u64b_t; /* 64-bit unsigned integer */
-
-#ifndef RotL_64
-#define RotL_64(x,N) (((x) << (N)) | ((x) >> (64-(N))))
-#endif
-
-/*
- * Skein is "natively" little-endian (unlike SHA-xxx), for optimal
- * performance on x86 CPUs. The Skein code requires the following
- * definitions for dealing with endianness:
- *
- * SKEIN_NEED_SWAP: 0 for little-endian, 1 for big-endian
- * Skein_Put64_LSB_First
- * Skein_Get64_LSB_First
- * Skein_Swap64
- *
- * If SKEIN_NEED_SWAP is defined at compile time, it is used here
- * along with the portable versions of Put64/Get64/Swap64, which
- * are slow in general.
- *
- * Otherwise, an "auto-detect" of endianness is attempted below.
- * If the default handling doesn't work well, the user may insert
- * platform-specific code instead (e.g., for big-endian CPUs).
- *
- */
-#define SKEIN_NEED_SWAP (0)
-/* below two prototype assume we are handed aligned data */
-#define Skein_Put64_LSB_First(dst08,src64,bCnt) memcpy(dst08,src64,bCnt)
-#define Skein_Get64_LSB_First(dst64,src08,wCnt) memcpy(dst64,src08,8*(wCnt))
-
-/*
- ******************************************************************
- * Provide any definitions still needed.
- ******************************************************************
- */
-#ifndef Skein_Swap64 /* swap for big-endian, nop for little-endian */
-#if SKEIN_NEED_SWAP
-#define Skein_Swap64(w64) \
- ( (( ((u64b_t)(w64)) & 0xFF) << 56) | \
- (((((u64b_t)(w64)) >> 8) & 0xFF) << 48) | \
- (((((u64b_t)(w64)) >>16) & 0xFF) << 40) | \
- (((((u64b_t)(w64)) >>24) & 0xFF) << 32) | \
- (((((u64b_t)(w64)) >>32) & 0xFF) << 24) | \
- (((((u64b_t)(w64)) >>40) & 0xFF) << 16) | \
- (((((u64b_t)(w64)) >>48) & 0xFF) << 8) | \
- (((((u64b_t)(w64)) >>56) & 0xFF) ) )
-#else
-#define Skein_Swap64(w64) (w64)
-#endif
-#endif /* ifndef Skein_Swap64 */
-
-
-#ifndef Skein_Put64_LSB_First
-void Skein_Put64_LSB_First(u08b_t *dst,const u64b_t *src,size_t bCnt)
-#ifdef SKEIN_PORT_CODE /* instantiate the function code here? */
- { /* this version is fully portable (big-endian or little-endian), but slow */
- size_t n;
-
- for (n=0;n<bCnt;n++)
- dst[n] = (u08b_t) (src[n>>3] >> (8*(n&7)));
- }
-#else
- ; /* output only the function prototype */
-#endif
-#endif /* ifndef Skein_Put64_LSB_First */
-
-
-#ifndef Skein_Get64_LSB_First
-void Skein_Get64_LSB_First(u64b_t *dst,const u08b_t *src,size_t wCnt)
-#ifdef SKEIN_PORT_CODE /* instantiate the function code here? */
- { /* this version is fully portable (big-endian or little-endian), but slow */
- size_t n;
-
- for (n=0;n<8*wCnt;n+=8)
- dst[n/8] = (((u64b_t) src[n ]) ) +
- (((u64b_t) src[n+1]) << 8) +
- (((u64b_t) src[n+2]) << 16) +
- (((u64b_t) src[n+3]) << 24) +
- (((u64b_t) src[n+4]) << 32) +
- (((u64b_t) src[n+5]) << 40) +
- (((u64b_t) src[n+6]) << 48) +
- (((u64b_t) src[n+7]) << 56) ;
- }
-#else
- ; /* output only the function prototype */
-#endif
-#endif /* ifndef Skein_Get64_LSB_First */
-
-#endif /* ifndef _SKEIN_PORT_H_ */
diff --git a/drivers/staging/skein/skein.c b/drivers/staging/skein/skein.c
index 670c5b138c2b..93a102b16e64 100644
--- a/drivers/staging/skein/skein.c
+++ b/drivers/staging/skein/skein.c
@@ -102,13 +102,6 @@ int Skein_256_InitExt(Skein_256_Ctxt_t *ctx,size_t hashBitLen,u64b_t treeInfo, c
Skein_256_Update(ctx,key,keyBytes); /* hash the key */
Skein_256_Final_Pad(ctx,cfg.b); /* put result into cfg.b[] */
memcpy(ctx->X,cfg.b,sizeof(cfg.b)); /* copy over into ctx->X[] */
-#if SKEIN_NEED_SWAP
- {
- uint_t i;
- for (i=0;i<SKEIN_256_STATE_WORDS;i++) /* convert key bytes to context words */
- ctx->X[i] = Skein_Swap64(ctx->X[i]);
- }
-#endif
}
/* build/process the config block, type == CONFIG (could be precomputed for each key) */
ctx->h.hashBitLen = hashBitLen; /* output hash bit count */
@@ -297,13 +290,6 @@ int Skein_512_InitExt(Skein_512_Ctxt_t *ctx,size_t hashBitLen,u64b_t treeInfo, c
Skein_512_Update(ctx,key,keyBytes); /* hash the key */
Skein_512_Final_Pad(ctx,cfg.b); /* put result into cfg.b[] */
memcpy(ctx->X,cfg.b,sizeof(cfg.b)); /* copy over into ctx->X[] */
-#if SKEIN_NEED_SWAP
- {
- uint_t i;
- for (i=0;i<SKEIN_512_STATE_WORDS;i++) /* convert key bytes to context words */
- ctx->X[i] = Skein_Swap64(ctx->X[i]);
- }
-#endif
}
/* build/process the config block, type == CONFIG (could be precomputed for each key) */
ctx->h.hashBitLen = hashBitLen; /* output hash bit count */
@@ -489,13 +475,6 @@ int Skein1024_InitExt(Skein1024_Ctxt_t *ctx,size_t hashBitLen,u64b_t treeInfo, c
Skein1024_Update(ctx,key,keyBytes); /* hash the key */
Skein1024_Final_Pad(ctx,cfg.b); /* put result into cfg.b[] */
memcpy(ctx->X,cfg.b,sizeof(cfg.b)); /* copy over into ctx->X[] */
-#if SKEIN_NEED_SWAP
- {
- uint_t i;
- for (i=0;i<SKEIN1024_STATE_WORDS;i++) /* convert key bytes to context words */
- ctx->X[i] = Skein_Swap64(ctx->X[i]);
- }
-#endif
}
/* build/process the config block, type == CONFIG (could be precomputed for each key) */
ctx->h.hashBitLen = hashBitLen; /* output hash bit count */