[PATCH v4 2/7] staging: skein: Renames skein to skein_base
Renames skein.c to skein_base.c and skein.h to skein_base.h Signed-off-by: Eric Rost --- drivers/staging/skein/Makefile| 2 +- drivers/staging/skein/skein.c | 883 - drivers/staging/skein/skein.h | 346 - drivers/staging/skein/skein_api.h | 2 +- drivers/staging/skein/skein_base.c| 884 ++ drivers/staging/skein/skein_base.h| 351 ++ drivers/staging/skein/skein_block.c | 2 +- drivers/staging/skein/skein_block.h | 2 +- drivers/staging/skein/skein_iv.h | 2 +- drivers/staging/skein/threefish_api.h | 2 +- 10 files changed, 1241 insertions(+), 1235 deletions(-) delete mode 100644 drivers/staging/skein/skein.c delete mode 100644 drivers/staging/skein/skein.h create mode 100644 drivers/staging/skein/skein_base.c create mode 100644 drivers/staging/skein/skein_base.h diff --git a/drivers/staging/skein/Makefile b/drivers/staging/skein/Makefile index 4b60171..ca746a9 100644 --- a/drivers/staging/skein/Makefile +++ b/drivers/staging/skein/Makefile @@ -1,7 +1,7 @@ # # Makefile for the skein secure hash algorithm # -obj-$(CONFIG_CRYPTO_SKEIN) += skein.o \ +obj-$(CONFIG_CRYPTO_SKEIN) += skein_base.o \ skein_api.o \ skein_block.o \ threefish_block.o \ diff --git a/drivers/staging/skein/skein.c b/drivers/staging/skein/skein.c deleted file mode 100644 index 8cc8358..000 --- a/drivers/staging/skein/skein.c +++ /dev/null @@ -1,883 +0,0 @@ -/*** -** -** Implementation of the Skein hash function. -** -** Source code author: Doug Whiting, 2008. -** -** This algorithm and source code is released to the public domain. -** -/ - -#define SKEIN_PORT_CODE /* instantiate any code in skein_port.h */ - -#include/* get the memcpy/memset functions */ -#include "skein.h" /* get the Skein API definitions */ -#include "skein_iv.h"/* get precomputed IVs */ -#include "skein_block.h" - -/*/ -/* 256-bit Skein */ -/*/ - -/**/ -/* init the context for a straight hashing operation */ -int skein_256_init(struct skein_256_ctx *ctx, size_t hash_bit_len) -{ - union { - u8 b[SKEIN_256_STATE_BYTES]; - u64 w[SKEIN_256_STATE_WORDS]; - } cfg; /* config block */ - - skein_assert_ret(hash_bit_len > 0, SKEIN_BAD_HASHLEN); - ctx->h.hash_bit_len = hash_bit_len; /* output hash bit count */ - - switch (hash_bit_len) { /* use pre-computed values, where available */ - case 256: - memcpy(ctx->x, SKEIN_256_IV_256, sizeof(ctx->x)); - break; - case 224: - memcpy(ctx->x, SKEIN_256_IV_224, sizeof(ctx->x)); - break; - case 160: - memcpy(ctx->x, SKEIN_256_IV_160, sizeof(ctx->x)); - break; - case 128: - memcpy(ctx->x, SKEIN_256_IV_128, sizeof(ctx->x)); - break; - default: - /* here if there is no precomputed IV value available */ - /* -* build/process the config block, type == CONFIG (could be -* precomputed) -*/ - /* set tweaks: T0=0; T1=CFG | FINAL */ - skein_start_new_type(ctx, CFG_FINAL); - - /* set the schema, version */ - cfg.w[0] = skein_swap64(SKEIN_SCHEMA_VER); - /* hash result length in bits */ - cfg.w[1] = skein_swap64(hash_bit_len); - cfg.w[2] = skein_swap64(SKEIN_CFG_TREE_INFO_SEQUENTIAL); - /* zero pad config block */ - memset([3], 0, sizeof(cfg) - 3*sizeof(cfg.w[0])); - - /* compute the initial chaining values from config block */ - /* zero the chaining variables */ - memset(ctx->x, 0, sizeof(ctx->x)); - skein_256_process_block(ctx, cfg.b, 1, SKEIN_CFG_STR_LEN); - break; - } - /* The chaining vars ctx->x are now initialized for hash_bit_len. */ - /* Set up to process the data message portion of the hash (default) */ - skein_start_new_type(ctx, MSG); /* T0=0, T1= MSG type */ - - return SKEIN_SUCCESS; -} - -/**/ -/* init the context for a MAC and/or tree hash operation */ -/* [identical to skein_256_init() when key_bytes == 0 && \ - * tree_info == SKEIN_CFG_TREE_INFO_SEQUENTIAL] */ -int skein_256_init_ext(struct
[PATCH v4 2/7] staging: skein: Renames skein to skein_base
Renames skein.c to skein_base.c and skein.h to skein_base.h Signed-off-by: Eric Rost eric.r...@mybabylon.net --- drivers/staging/skein/Makefile| 2 +- drivers/staging/skein/skein.c | 883 - drivers/staging/skein/skein.h | 346 - drivers/staging/skein/skein_api.h | 2 +- drivers/staging/skein/skein_base.c| 884 ++ drivers/staging/skein/skein_base.h| 351 ++ drivers/staging/skein/skein_block.c | 2 +- drivers/staging/skein/skein_block.h | 2 +- drivers/staging/skein/skein_iv.h | 2 +- drivers/staging/skein/threefish_api.h | 2 +- 10 files changed, 1241 insertions(+), 1235 deletions(-) delete mode 100644 drivers/staging/skein/skein.c delete mode 100644 drivers/staging/skein/skein.h create mode 100644 drivers/staging/skein/skein_base.c create mode 100644 drivers/staging/skein/skein_base.h diff --git a/drivers/staging/skein/Makefile b/drivers/staging/skein/Makefile index 4b60171..ca746a9 100644 --- a/drivers/staging/skein/Makefile +++ b/drivers/staging/skein/Makefile @@ -1,7 +1,7 @@ # # Makefile for the skein secure hash algorithm # -obj-$(CONFIG_CRYPTO_SKEIN) += skein.o \ +obj-$(CONFIG_CRYPTO_SKEIN) += skein_base.o \ skein_api.o \ skein_block.o \ threefish_block.o \ diff --git a/drivers/staging/skein/skein.c b/drivers/staging/skein/skein.c deleted file mode 100644 index 8cc8358..000 --- a/drivers/staging/skein/skein.c +++ /dev/null @@ -1,883 +0,0 @@ -/*** -** -** Implementation of the Skein hash function. -** -** Source code author: Doug Whiting, 2008. -** -** This algorithm and source code is released to the public domain. -** -/ - -#define SKEIN_PORT_CODE /* instantiate any code in skein_port.h */ - -#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 - -/*/ -/* 256-bit Skein */ -/*/ - -/**/ -/* init the context for a straight hashing operation */ -int skein_256_init(struct skein_256_ctx *ctx, size_t hash_bit_len) -{ - union { - u8 b[SKEIN_256_STATE_BYTES]; - u64 w[SKEIN_256_STATE_WORDS]; - } cfg; /* config block */ - - skein_assert_ret(hash_bit_len 0, SKEIN_BAD_HASHLEN); - ctx-h.hash_bit_len = hash_bit_len; /* output hash bit count */ - - switch (hash_bit_len) { /* use pre-computed values, where available */ - case 256: - memcpy(ctx-x, SKEIN_256_IV_256, sizeof(ctx-x)); - break; - case 224: - memcpy(ctx-x, SKEIN_256_IV_224, sizeof(ctx-x)); - break; - case 160: - memcpy(ctx-x, SKEIN_256_IV_160, sizeof(ctx-x)); - break; - case 128: - memcpy(ctx-x, SKEIN_256_IV_128, sizeof(ctx-x)); - break; - default: - /* here if there is no precomputed IV value available */ - /* -* build/process the config block, type == CONFIG (could be -* precomputed) -*/ - /* set tweaks: T0=0; T1=CFG | FINAL */ - skein_start_new_type(ctx, CFG_FINAL); - - /* set the schema, version */ - cfg.w[0] = skein_swap64(SKEIN_SCHEMA_VER); - /* hash result length in bits */ - cfg.w[1] = skein_swap64(hash_bit_len); - cfg.w[2] = skein_swap64(SKEIN_CFG_TREE_INFO_SEQUENTIAL); - /* zero pad config block */ - memset(cfg.w[3], 0, sizeof(cfg) - 3*sizeof(cfg.w[0])); - - /* compute the initial chaining values from config block */ - /* zero the chaining variables */ - memset(ctx-x, 0, sizeof(ctx-x)); - skein_256_process_block(ctx, cfg.b, 1, SKEIN_CFG_STR_LEN); - break; - } - /* The chaining vars ctx-x are now initialized for hash_bit_len. */ - /* Set up to process the data message portion of the hash (default) */ - skein_start_new_type(ctx, MSG); /* T0=0, T1= MSG type */ - - return SKEIN_SUCCESS; -} - -/**/ -/* init the context for a MAC and/or tree hash operation */ -/* [identical to skein_256_init() when key_bytes == 0 \ - * tree_info == SKEIN_CFG_TREE_INFO_SEQUENTIAL] */ -int