staging: skein: Loadable Module Support
PATCH 1/1 staging: skein: Loadable Module Support
Adds loadable module support for Skein256, Skein512, and Skein1024
NOTE: skein1024_generic does not load, sending patch for feedback! I don't understand why skein256_generic and skein512_generic load no problem but skein1024_generic gives ERROR: Invalid argument from modprobe.
Signed-off-by Eric Rost <[email protected]>
--- drivers/staging/skein/Kconfig | 12 +++++ drivers/staging/skein/Makefile | 6 +++ drivers/staging/skein/skein.c | 11 +++- drivers/staging/skein/skein.h | 6 +++ drivers/staging/skein/skein1024_generic.c | 88 +++++++++++++++++++++++++++++++ drivers/staging/skein/skein256_generic.c | 88 +++++++++++++++++++++++++++++++ drivers/staging/skein/skein512_generic.c | 88 +++++++++++++++++++++++++++++++ 7 files changed, 298 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/skein/skein1024_generic.c create mode 100644 drivers/staging/skein/skein256_generic.c create mode 100644 drivers/staging/skein/skein512_generic.c
drivers/staging/skein/Kconfig +12 -0
@@ -15,6 +15,18 @@ config CRYPTO_SKEIN for more information. This module depends on the threefish block cipher module. +config CRYPTO_SKEIN_256 + tristate "Skein256 driver" + select CRYPTO_SKEIN + +config CRYPTO_SKEIN_512 + tristate "Skein512 driver" + select CRYPTO_SKEIN + +config CRYPTO_SKEIN_1024 + tristate "Skein1024 driver" + select CRYPTO_SKEIN + config CRYPTO_THREEFISH bool "Threefish tweakable block cipher" depends on (X86 || UML_X86) && 64BIT && CRYPTO
drivers/staging/skein/Makefile +6 -0
@@ -5,5 +5,11 @@ obj-$(CONFIG_CRYPTO_SKEIN) += skein.o \ skein_api.o \ skein_block.o +obj-$(CONFIG_CRYPTO_SKEIN_256) += skein256_generic.o + +obj-$(CONFIG_CRYPTO_SKEIN_512) += skein512_generic.o + +obj-$(CONFIG_CRYPTO_SKEIN_1024) += skein1024_generic.o + obj-$(CONFIG_CRYPTO_THREEFISH) += threefish_block.o \ threefish_api.o
drivers/staging/skein/skein.c +10 -1
@@ -11,6 +11,7 @@#define SKEIN_PORT_CODE /* instantiate any code in skein_port.h */ #include <linux/string.h> /* get the memcpy/memset functions */ +#include <linux/export.h> #include "skein.h" /* get the Skein API definitions */ #include "skein_iv.h" /* get precomputed IVs */ #include "skein_block.h"
@@ -73,6 +74,7 @@ int skein_256_init(struct skein_256_ctx *ctx, size_t hash_bit_len)return SKEIN_SUCCESS ; } +EXPORT_SYMBOL (skein_256_init);/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a MAC and/or tree hash operation */
@@ -191,7 +193,7 @@ int skein_256_update(struct skein_256_ctx *ctx, const u8 *msg,return SKEIN_SUCCESS ; } - +EXPORT_SYMBOL (skein_256_update);/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the result */ int skein_256_final (struct skein_256_ctx *ctx,u8 *hash_val)
@@ -240,6 +242,7 @@ int skein_256_final(struct skein_256_ctx *ctx, u8 *hash_val) }return SKEIN_SUCCESS ; } +EXPORT_SYMBOL (skein_256_final);/*****************************************************************/ /* 512-bit Skein */
@@ -303,6 +306,7 @@ int skein_512_init(struct skein_512_ctx *ctx, size_t hash_bit_len)return SKEIN_SUCCESS ; } +EXPORT_SYMBOL (skein_512_init);/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a MAC and/or tree hash operation */
@@ -420,6 +424,7 @@ int skein_512_update(struct skein_512_ctx *ctx, const u8 *msg,return SKEIN_SUCCESS ; } +EXPORT_SYMBOL (skein_512_update);/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the result */
@@ -469,6 +474,7 @@ int skein_512_final(struct skein_512_ctx *ctx, u8 *hash_val) }return SKEIN_SUCCESS ; } +EXPORT_SYMBOL (skein_512_final);/*****************************************************************/ /* 1024-bit Skein */
@@ -526,6 +532,7 @@ int skein_1024_init(struct skein_1024_ctx *ctx, size_t hash_bit_len)return SKEIN_SUCCESS ; } +EXPORT_SYMBOL (skein_1024_init);/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* init the context for a MAC and/or tree hash operation */
@@ -644,6 +651,7 @@ int skein_1024_update(struct skein_1024_ctx *ctx, const u8 *msg,return SKEIN_SUCCESS ; } +EXPORT_SYMBOL (skein_1024_update);/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* finalize the hash computation and output the result */
@@ -693,6 +701,7 @@ int skein_1024_final(struct skein_1024_ctx *ctx, u8 *hash_val) }return SKEIN_SUCCESS ; } +EXPORT_SYMBOL (skein_1024_final);/**************** Functions to support MAC/tree hashing ***************/ /* (this code is identical for Optimized and Reference versions) */
drivers/staging/skein/skein.h +6 -0
@@ -26,8 +26,14 @@** 0: use assert() to flag errors ** 1: return SKEIN_FAIL to flag errors ** +** ***************************************************************************/ +/*Skein digest sizes for crypto api*/ +#define SKEIN256_DIGEST_SIZE (256) +#define SKEIN512_DIGEST_SIZE (512) +#define SKEIN1024_DIGEST_SIZE (1024) +#ifndef rotl_64#define rotl_64 (x,N ) (((x) << (N)) | ((x) >> (64-(N))))#endif
drivers/staging/skein/skein1024_generic.c new file +88 -0
88 lines not on this page · raw message
drivers/staging/skein/skein256_generic.c new file +88 -0
88 lines not on this page · raw message
drivers/staging/skein/skein512_generic.c new file +88 -0
88 lines not on this page · raw message
Signature · 1 line
2.1.1