Просмотр исходного кода

staging/skein: rename files and clean up directory structure

Clean up file names and locations.  Get rid of include/ directory and move
those up to the top-level.  Rename files to get rid of upper case.  Remove
skeinBlockNo3F.c as it was unused (temporary file or something?).

Signed-off-by: Jake Edge <jake@lwn.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jake Edge 11 лет назад
Родитель
Сommit
85dfd522f8

+ 5 - 7
drivers/staging/skein/Makefile

@@ -1,13 +1,11 @@
 #
 #
 # Makefile for the skein secure hash algorithm
 # Makefile for the skein secure hash algorithm
 #
 #
-subdir-ccflags-y := -I$(src)/include/
-
 obj-$(CONFIG_CRYPTO_SKEIN) +=   skein.o \
 obj-$(CONFIG_CRYPTO_SKEIN) +=   skein.o \
-				skeinApi.o \
+				skein_api.o \
 				skein_block.o
 				skein_block.o
 
 
-obj-$(CONFIG_CRYPTO_THREEFISH) += threefish1024Block.o \
-				  threefish256Block.o \
-				  threefish512Block.o \
-				  threefishApi.o
+obj-$(CONFIG_CRYPTO_THREEFISH) += threefish_1024_block.o \
+				  threefish_256_block.o \
+				  threefish_512_block.o \
+				  threefish_api.o

+ 0 - 1
drivers/staging/skein/TODO

@@ -1,6 +1,5 @@
 skein/threefish TODO
 skein/threefish TODO
 
 
- - rename files
  - move macros into appropriate header files
  - move macros into appropriate header files
  - add / pass test vectors
  - add / pass test vectors
  - module support
  - module support

+ 3 - 3
drivers/staging/skein/skein.c

@@ -11,9 +11,9 @@
 #define  SKEIN_PORT_CODE /* instantiate any code in skein_port.h */
 #define  SKEIN_PORT_CODE /* instantiate any code in skein_port.h */
 
 
 #include <linux/string.h>       /* get the memcpy/memset functions */
 #include <linux/string.h>       /* get the memcpy/memset functions */
-#include <skein.h> /* get the Skein API definitions   */
-#include <skein_iv.h>    /* get precomputed IVs */
-#include <skein_block.h>
+#include "skein.h" /* get the Skein API definitions   */
+#include "skein_iv.h"    /* get precomputed IVs */
+#include "skein_block.h"
 
 
 /*****************************************************************/
 /*****************************************************************/
 /*     256-bit Skein                                             */
 /*     256-bit Skein                                             */

+ 0 - 0
drivers/staging/skein/include/skein.h → drivers/staging/skein/skein.h


+ 0 - 175
drivers/staging/skein/skeinBlockNo3F.c

@@ -1,175 +0,0 @@
-
-#include <linux/string.h>
-#include <skein.h>
-#include <threefishApi.h>
-
-
-/*****************************  Skein_256 ******************************/
-void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blk_ptr,
-			     size_t blk_cnt, size_t byte_cnt_add)
-{
-	struct threefish_key key;
-	u64 tweak[2];
-	int i;
-	u64 w[SKEIN_256_STATE_WORDS]; /* local copy of input block */
-	u64 words[3];
-
-	skein_assert(blk_cnt != 0); /* never call with blk_cnt == 0! */
-	tweak[0] = ctx->h.T[0];
-	tweak[1] = ctx->h.T[1];
-
-	do  {
-		u64 carry = byte_cnt_add;
-
-		words[0] = tweak[0] & 0xffffffffL;
-		words[1] = ((tweak[0] >> 32) & 0xffffffffL);
-		words[2] = (tweak[1] & 0xffffffffL);
-
-		for (i = 0; i < 3; i++) {
-			carry += words[i];
-			words[i] = carry;
-			carry >>= 32;
-		}
-		tweak[0] = words[0] & 0xffffffffL;
-		tweak[0] |= (words[1] & 0xffffffffL) << 32;
-		tweak[1] |= words[2] & 0xffffffffL;
-
-		threefish_set_key(&key, THREEFISH_256, ctx->X, tweak);
-
-		/* get input block in little-endian format */
-		skein_get64_lsb_first(w, blk_ptr, SKEIN_256_STATE_WORDS);
-
-		threefish_encrypt_block_words(&key, w, ctx->X);
-
-		blk_ptr += SKEIN_256_BLOCK_BYTES;
-
-		/* do the final "feedforward" xor, update ctx chaining vars */
-		ctx->X[0] = ctx->X[0] ^ w[0];
-		ctx->X[1] = ctx->X[1] ^ w[1];
-		ctx->X[2] = ctx->X[2] ^ w[2];
-		ctx->X[3] = ctx->X[3] ^ w[3];
-
-		tweak[1] &= ~SKEIN_T1_FLAG_FIRST;
-	} while (--blk_cnt);
-
-	ctx->h.T[0] = tweak[0];
-	ctx->h.T[1] = tweak[1];
-}
-
-void skein_512_process_block(struct skein_512_ctx *ctx, const u8 *blk_ptr,
-			     size_t blk_cnt, size_t byte_cnt_add)
-{
-	struct threefish_key key;
-	u64 tweak[2];
-	int i;
-	u64 words[3];
-	u64 w[SKEIN_512_STATE_WORDS]; /* local copy of input block */
-
-	skein_assert(blk_cnt != 0); /* never call with blk_cnt == 0! */
-	tweak[0] = ctx->h.T[0];
-	tweak[1] = ctx->h.T[1];
-
-	do  {
-		u64 carry = byte_cnt_add;
-
-		words[0] = tweak[0] & 0xffffffffL;
-		words[1] = ((tweak[0] >> 32) & 0xffffffffL);
-		words[2] = (tweak[1] & 0xffffffffL);
-
-		for (i = 0; i < 3; i++) {
-			carry += words[i];
-			words[i] = carry;
-			carry >>= 32;
-		}
-		tweak[0] = words[0] & 0xffffffffL;
-		tweak[0] |= (words[1] & 0xffffffffL) << 32;
-		tweak[1] |= words[2] & 0xffffffffL;
-
-		threefish_set_key(&key, THREEFISH_512, ctx->X, tweak);
-
-		/* get input block in little-endian format */
-		skein_get64_lsb_first(w, blk_ptr, SKEIN_512_STATE_WORDS);
-
-		threefish_encrypt_block_words(&key, w, ctx->X);
-
-		blk_ptr += SKEIN_512_BLOCK_BYTES;
-
-		/* do the final "feedforward" xor, update ctx chaining vars */
-		ctx->X[0] = ctx->X[0] ^ w[0];
-		ctx->X[1] = ctx->X[1] ^ w[1];
-		ctx->X[2] = ctx->X[2] ^ w[2];
-		ctx->X[3] = ctx->X[3] ^ w[3];
-		ctx->X[4] = ctx->X[4] ^ w[4];
-		ctx->X[5] = ctx->X[5] ^ w[5];
-		ctx->X[6] = ctx->X[6] ^ w[6];
-		ctx->X[7] = ctx->X[7] ^ w[7];
-
-		tweak[1] &= ~SKEIN_T1_FLAG_FIRST;
-	} while (--blk_cnt);
-
-	ctx->h.T[0] = tweak[0];
-	ctx->h.T[1] = tweak[1];
-}
-
-void skein_1024_process_block(struct skein_1024_ctx *ctx, const u8 *blk_ptr,
-			      size_t blk_cnt, size_t byte_cnt_add)
-{
-	struct threefish_key key;
-	u64 tweak[2];
-	int i;
-	u64 words[3];
-	u64 w[SKEIN_1024_STATE_WORDS]; /* local copy of input block */
-
-	skein_assert(blk_cnt != 0); /* never call with blk_cnt == 0! */
-	tweak[0] = ctx->h.T[0];
-	tweak[1] = ctx->h.T[1];
-
-	do  {
-		u64 carry = byte_cnt_add;
-
-		words[0] = tweak[0] & 0xffffffffL;
-		words[1] = ((tweak[0] >> 32) & 0xffffffffL);
-		words[2] = (tweak[1] & 0xffffffffL);
-
-		for (i = 0; i < 3; i++) {
-			carry += words[i];
-			words[i] = carry;
-			carry >>= 32;
-		}
-		tweak[0] = words[0] & 0xffffffffL;
-		tweak[0] |= (words[1] & 0xffffffffL) << 32;
-		tweak[1] |= words[2] & 0xffffffffL;
-
-		threefish_set_key(&key, THREEFISH_1024, ctx->X, tweak);
-
-		/* get input block in little-endian format */
-		skein_get64_lsb_first(w, blk_ptr, SKEIN_1024_STATE_WORDS);
-
-		threefish_encrypt_block_words(&key, w, ctx->X);
-
-		blk_ptr += SKEIN_1024_BLOCK_BYTES;
-
-		/* do the final "feedforward" xor, update ctx chaining vars */
-		ctx->X[0]  = ctx->X[0]  ^ w[0];
-		ctx->X[1]  = ctx->X[1]  ^ w[1];
-		ctx->X[2]  = ctx->X[2]  ^ w[2];
-		ctx->X[3]  = ctx->X[3]  ^ w[3];
-		ctx->X[4]  = ctx->X[4]  ^ w[4];
-		ctx->X[5]  = ctx->X[5]  ^ w[5];
-		ctx->X[6]  = ctx->X[6]  ^ w[6];
-		ctx->X[7]  = ctx->X[7]  ^ w[7];
-		ctx->X[8]  = ctx->X[8]  ^ w[8];
-		ctx->X[9]  = ctx->X[9]  ^ w[9];
-		ctx->X[10] = ctx->X[10] ^ w[10];
-		ctx->X[11] = ctx->X[11] ^ w[11];
-		ctx->X[12] = ctx->X[12] ^ w[12];
-		ctx->X[13] = ctx->X[13] ^ w[13];
-		ctx->X[14] = ctx->X[14] ^ w[14];
-		ctx->X[15] = ctx->X[15] ^ w[15];
-
-		tweak[1] &= ~SKEIN_T1_FLAG_FIRST;
-	} while (--blk_cnt);
-
-	ctx->h.T[0] = tweak[0];
-	ctx->h.T[1] = tweak[1];
-}

+ 1 - 1
drivers/staging/skein/skeinApi.c → drivers/staging/skein/skein_api.c

@@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 */
 
 
 #include <linux/string.h>
 #include <linux/string.h>
-#include <skeinApi.h>
+#include "skein_api.h"
 
 
 int skein_ctx_prepare(struct skein_ctx *ctx, enum skein_size size)
 int skein_ctx_prepare(struct skein_ctx *ctx, enum skein_size size)
 {
 {

+ 3 - 3
drivers/staging/skein/include/skeinApi.h → drivers/staging/skein/skein_api.h

@@ -28,7 +28,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #define SKEINAPI_H
 #define SKEINAPI_H
 
 
 /**
 /**
- * @file skeinApi.h
+ * @file skein_api.h
  * @brief A Skein API and its functions.
  * @brief A Skein API and its functions.
  * @{
  * @{
  *
  *
@@ -44,7 +44,7 @@ OTHER DEALINGS IN THE SOFTWARE.
  *
  *
  * @code
  * @code
  *
  *
- * #include <skeinApi.h>
+ * #include "skein_api.h"
  *
  *
  * ...
  * ...
  * struct skein_ctx ctx;             // a Skein hash or MAC context
  * struct skein_ctx ctx;             // a Skein hash or MAC context
@@ -79,7 +79,7 @@ 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

+ 1 - 1
drivers/staging/skein/skein_block.c

@@ -15,7 +15,7 @@
 ************************************************************************/
 ************************************************************************/
 
 
 #include <linux/string.h>
 #include <linux/string.h>
-#include <skein.h>
+#include "skein.h"
 
 
 #ifndef SKEIN_USE_ASM
 #ifndef SKEIN_USE_ASM
 #define SKEIN_USE_ASM   (0) /* default is all C code (no ASM) */
 #define SKEIN_USE_ASM   (0) /* default is all C code (no ASM) */

+ 1 - 1
drivers/staging/skein/include/skein_block.h → drivers/staging/skein/skein_block.h

@@ -10,7 +10,7 @@
 #ifndef _SKEIN_BLOCK_H_
 #ifndef _SKEIN_BLOCK_H_
 #define _SKEIN_BLOCK_H_
 #define _SKEIN_BLOCK_H_
 
 
-#include <skein.h> /* get the Skein API definitions   */
+#include "skein.h" /* get the Skein API definitions   */
 
 
 void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blk_ptr,
 void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blk_ptr,
 			     size_t blk_cnt, size_t byte_cnt_add);
 			     size_t blk_cnt, size_t byte_cnt_add);

+ 1 - 1
drivers/staging/skein/include/skein_iv.h → drivers/staging/skein/skein_iv.h

@@ -1,7 +1,7 @@
 #ifndef _SKEIN_IV_H_
 #ifndef _SKEIN_IV_H_
 #define _SKEIN_IV_H_
 #define _SKEIN_IV_H_
 
 
-#include <skein.h>    /* get Skein macros and types */
+#include "skein.h"    /* get Skein macros and types */
 
 
 /*
 /*
 ***************** Pre-computed Skein IVs *******************
 ***************** Pre-computed Skein IVs *******************

+ 1 - 1
drivers/staging/skein/threefish1024Block.c → drivers/staging/skein/threefish_1024_block.c

@@ -1,5 +1,5 @@
 #include <linux/string.h>
 #include <linux/string.h>
-#include <threefishApi.h>
+#include "threefish_api.h"
 
 
 
 
 void threefish_encrypt_1024(struct threefish_key *key_ctx, u64 *input,
 void threefish_encrypt_1024(struct threefish_key *key_ctx, u64 *input,

+ 1 - 1
drivers/staging/skein/threefish256Block.c → drivers/staging/skein/threefish_256_block.c

@@ -1,5 +1,5 @@
 #include <linux/string.h>
 #include <linux/string.h>
-#include <threefishApi.h>
+#include "threefish_api.h"
 
 
 
 
 void threefish_encrypt_256(struct threefish_key *key_ctx, u64 *input,
 void threefish_encrypt_256(struct threefish_key *key_ctx, u64 *input,

+ 1 - 1
drivers/staging/skein/threefish512Block.c → drivers/staging/skein/threefish_512_block.c

@@ -1,5 +1,5 @@
 #include <linux/string.h>
 #include <linux/string.h>
-#include <threefishApi.h>
+#include "threefish_api.h"
 
 
 
 
 void threefish_encrypt_512(struct threefish_key *key_ctx, u64 *input,
 void threefish_encrypt_512(struct threefish_key *key_ctx, u64 *input,

+ 1 - 3
drivers/staging/skein/threefishApi.c → drivers/staging/skein/threefish_api.c

@@ -1,7 +1,5 @@
-
-
 #include <linux/string.h>
 #include <linux/string.h>
-#include <threefishApi.h>
+#include "threefish_api.h"
 
 
 void threefish_set_key(struct threefish_key *key_ctx,
 void threefish_set_key(struct threefish_key *key_ctx,
 		       enum threefish_size state_size,
 		       enum threefish_size state_size,

+ 2 - 2
drivers/staging/skein/include/threefishApi.h → drivers/staging/skein/threefish_api.h

@@ -3,7 +3,7 @@
 #define THREEFISHAPI_H
 #define THREEFISHAPI_H
 
 
 /**
 /**
- * @file threefishApi.h
+ * @file threefish_api.h
  * @brief A Threefish cipher API and its functions.
  * @brief A Threefish cipher API and its functions.
  * @{
  * @{
  *
  *
@@ -29,7 +29,7 @@
  */
  */
 
 
 #include <linux/types.h>
 #include <linux/types.h>
-#include <skein.h>
+#include "skein.h"
 
 
 #define KEY_SCHEDULE_CONST 0x1BD11BDAA9FC1A22L
 #define KEY_SCHEDULE_CONST 0x1BD11BDAA9FC1A22L