staging: skein: Loadable Module Support
PATCH v2 1/1 staging: skein: Loadable Module Support
Adds loadable module support for Skein256, Skein512, and Skein1024 Hash Algorithms.
--- 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
Eric,
Awesome! You must have been reading my TODO list :)
Quoted 2 lines · Eric Rost
Adds loadable module support for Skein256, Skein512, and Skein1024 Hash Algorithms.
This description is accurate, but incomplete. You're also integrating skein into the crypto API. If you don't mind, could you split this patch in two? The first integrating into the crypto API (such that userspace could call into it), and the second enabling loadable module support?
More thoughts below.
Quoted 42 lines
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.cdrivers/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 && CRYPTOdrivers/staging/skein/Makefile +0
-0
drivers/staging/skein/Makefile obj-$(CONFIG_CRYPTO_SKEIN) += skein.o \ · line 13
Quoted 9 lines
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 +
This isn't really doing what we want. You'll have loadable modules, but the actual code will still be built into the kernel.
Quoted 15 lines
drivers/staging/skein/Makefile +0
-0obj-$(CONFIG_CRYPTO_THREEFISH) += threefish_block.o \ threefish_api.odrivers/staging/skein/skein.c +1
-0@@ -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"
drivers/staging/skein/skein.c int skein_256_init(struct skein_256_ctx *ctx, size_t hash_bit_len) · line 77
Quoted 4 lines
drivers/staging/skein/skein.c +1
-0@@ -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);
Once the above is corrected, these shouldn't be necessary.
Quoted 73 lines
drivers/staging/skein/skein.c +8
-1/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* 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 +0
-0
drivers/staging/skein/skein.h line 30
Quoted 5 lines
drivers/staging/skein/skein.h +1
-0@@ -26,8 +26,14 @@** 0: use assert() to flag errors ** 1: return SKEIN_FAIL to flag errors ** +** ***************************************************************************/
superfluous whitespace addition?
Quoted 64 lines
drivers/staging/skein/skein.h +5
-0+/*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 +49
-0@@ -0,0 +1,88 @@ +/* +* Cryptographic API. +* +* Skein1024 Hash Algorithm. +* +* Derived from cryptoapi implementation, adapted for in-place +* scatterlist interface. +* +* Copyright (c) Eric Rost <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the Free +* Software Foundation; either version 2 of the License, or (at your option) +* any later version. +* +*/ +#include <crypto/internal/hash.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/mm.h> +#include <linux/cryptohash.h> +#include <linux/types.h> +#include "skein.h" +#include <asm/byteorder.h> + +static int skein1024_init (struct shash_desc *desc) +{ +struct skein_1024_ctx *sctx =shash_desc_ctx (desc); + +int ret =skein_1024_init (sctx,SKEIN1024_DIGEST_SIZE ); + +return ret; +} + +int crypto_skein1024_update (struct shash_desc *desc,const u8 *data, +unsigned int len) +{ +struct skein_1024_ctx *sctx =shash_desc_ctx (desc); +size_t hbl = (size_t ) len; +int ret =skein_1024_update (sctx, data, hbl); + +return ret; +} +EXPORT_SYMBOL (crypto_skein1024_update); + + +/* Add padding and return the message digest. */ +static int skein1024_final (struct shash_desc *desc,u8 *out) +{
drivers/staging/skein/skein1024_generic.c line 59
Quoted 10 lines
drivers/staging/skein/skein1024_generic.c new file +10
-0+struct skein_1024_ctx *sctx =shash_desc_ctx (desc); +int ret =skein_1024_final (sctx, out); +return ret; +} + + +static struct shash_alg alg = { + .digestsize = (SKEIN1024_DIGEST_SIZE /8 ), + .init = skein1024_init, + .update = crypto_skein1024_update,
why is this function name different from the other two?
Quoted 19 lines
drivers/staging/skein/skein1024_generic.c new file +19
-0+ .final = skein1024_final, + .descsize = sizeof(struct skein_1024_ctx), + .statesize = sizeof(struct skein_1024_ctx), + .base = { + .cra_name = "skein1024", + .cra_driver_name = "skein1024-generic", + .cra_flags = CRYPTO_ALG_TYPE_SHASH, + .cra_blocksize = SKEIN_1024_BLOCK_BYTES, + .cra_module = THIS_MODULE, + } +}; + +static int __init skein1024_generic_mod_init (void ) +{ +return crypto_register_shash (&alg); +} + +static void __exit skein1024_generic_mod_fini(void) +{
drivers/staging/skein/skein1024_generic.c line 88
Quoted 10 lines
drivers/staging/skein/skein1024_generic.c new file +10
-0+crypto_unregister_shash (&alg); +} + +module_init (skein1024_generic_mod_init); +module_exit (skein1024_generic_mod_fini); + +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Skein1024 Hash Algorithm" ); + +MODULE_ALIAS ("skein1024" );
I think it might be best to have two loadable modules. One for threefish, and one for skein. Adding threefish to the crypto API is a bit more difficult than adding skein, as the crypto API doesn't currently support tweakable block ciphers.
To keep things moving, it'd probably be best to do one module for now, skein. Have all the object files for skein and threefish in it, and register the three hash algos with the API.
After that, we can go back and split out threefish into a separate module with it's own registration into the crypto API.
Does that sound sensible?
thx,
Jason.
Quoted 191 lines
drivers/staging/skein/skein256_generic.c new file +88
-0@@ -0,0 +1,88 @@ +/* +* Cryptographic API. +* +* Skein256 Hash Algorithm. +* +* Derived from cryptoapi implementation, adapted for in-place +* scatterlist interface. +* +* Copyright (c) Eric Rost <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the Free +* Software Foundation; either version 2 of the License, or (at your option) +* any later version. +* +*/ +#include <crypto/internal/hash.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/mm.h> +#include <linux/cryptohash.h> +#include <linux/types.h> +#include "skein.h" +#include <asm/byteorder.h> + +static int skein256_init (struct shash_desc *desc) +{ +struct skein_256_ctx *sctx =shash_desc_ctx (desc); + +int ret =skein_256_init (sctx,SKEIN256_DIGEST_SIZE ); + +return ret; +} + +int crypto_skein256_update (struct shash_desc *desc,const u8 *data, +unsigned int len) +{ +struct skein_256_ctx *sctx =shash_desc_ctx (desc); +size_t hbl = (size_t ) len; +int ret =skein_256_update (sctx, data, hbl); + +return ret; +} +EXPORT_SYMBOL (crypto_skein256_update); + + +/* Add padding and return the message digest. */ +static int skein256_final (struct shash_desc *desc,u8 *out) +{ +struct skein_256_ctx *sctx =shash_desc_ctx (desc); +int ret =skein_256_final (sctx, out); +return ret; +} + + +static struct shash_alg alg = { + .digestsize = (SKEIN256_DIGEST_SIZE /8 ), + .init = skein256_init, + .update = crypto_skein256_update, + .final = skein256_final, + .descsize =sizeof (struct skein_256_ctx ), + .statesize =sizeof (struct skein_256_ctx ), + .base = { + .cra_name ="skein256" , + .cra_driver_name ="skein256-generic" , + .cra_flags =CRYPTO_ALG_TYPE_SHASH , + .cra_blocksize =SKEIN_256_BLOCK_BYTES , + .cra_module =THIS_MODULE , + } +}; + +static int __init skein256_generic_mod_init (void ) +{ +return crypto_register_shash (&alg); +} + +static void __exit skein256_generic_mod_fini(void) +{ +crypto_unregister_shash (&alg); +} + +module_init (skein256_generic_mod_init); +module_exit (skein256_generic_mod_fini); + +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Skein256 Hash Algorithm" ); + +MODULE_ALIAS ("skein256" );drivers/staging/skein/skein512_generic.c new file +88
-0@@ -0,0 +1,88 @@ +/* +* Cryptographic API. +* +* Skein512 Hash Algorithm. +* +* Derived from cryptoapi implementation, adapted for in-place +* scatterlist interface. +* +* Copyright (c) Eric Rost <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the Free +* Software Foundation; either version 2 of the License, or (at your option) +* any later version. +* +*/ +#include <crypto/internal/hash.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/mm.h> +#include <linux/cryptohash.h> +#include <linux/types.h> +#include "skein.h" +#include <asm/byteorder.h> + +static int skein512_init (struct shash_desc *desc) +{ +struct skein_512_ctx *sctx =shash_desc_ctx (desc); + +int ret =skein_512_init (sctx,SKEIN512_DIGEST_SIZE ); + +return ret; +} + +int crypto_skein512_update (struct shash_desc *desc,const u8 *data, +unsigned int len) +{ +struct skein_512_ctx *sctx =shash_desc_ctx (desc); +size_t hbl = (size_t ) len; +int ret =skein_512_update (sctx, data, hbl); + +return ret; +} +EXPORT_SYMBOL (crypto_skein512_update); + + +/* Add padding and return the message digest. */ +static int skein512_final (struct shash_desc *desc,u8 *out) +{ +struct skein_512_ctx *sctx =shash_desc_ctx (desc); +int ret =skein_512_final (sctx, out); +return ret; +} + + +static struct shash_alg alg = { + .digestsize = (SKEIN512_DIGEST_SIZE /8 ), + .init = skein512_init, + .update = crypto_skein512_update, + .final = skein512_final, + .descsize =sizeof (struct skein_512_ctx ), + .statesize =sizeof (struct skein_512_ctx ), + .base = { + .cra_name ="skein512" , + .cra_driver_name ="skein512-generic" , + .cra_flags =CRYPTO_ALG_TYPE_SHASH , + .cra_blocksize =SKEIN_512_BLOCK_BYTES , + .cra_module =THIS_MODULE , + } +}; + +static int __init skein512_generic_mod_init (void ) +{ +return crypto_register_shash (&alg); +} + +static void __exit skein512_generic_mod_fini(void) +{ +crypto_unregister_shash (&alg); +} + +module_init (skein512_generic_mod_init); +module_exit (skein512_generic_mod_fini); + +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Skein512 Hash Algorithm" ); + +MODULE_ALIAS ("skein512" );Signature · 1 line
2.1.1
Quoted 6 lines · Jason Cooper
If you don't mind, could you split this
patch in two? The first integrating into the crypto API (such that userspace could call into it), and the second enabling loadable module support?
Will do!
Quoted 71 lines
Quoted 42 lines
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.cdrivers/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 && CRYPTOdrivers/staging/skein/Makefile +0
-0drivers/staging/skein/Makefile obj-$(CONFIG_CRYPTO_SKEIN) += skein.o \ · line 13
Quoted 9 lines
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 +This isn't really doing what we want. You'll have loadable modules, but the actual code will still be built into the kernel.
Quoted 16 lines
drivers/staging/skein/Makefile +0
-0obj-$(CONFIG_CRYPTO_THREEFISH) += threefish_block.o \ threefish_api.odrivers/staging/skein/skein.c +1
-0@@ -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)
Quoted 6 lines
drivers/staging/skein/skein.c int skein_256_init(struct skein_256_ctx *ctx, size_t hash_bit_len) · line 77
Quoted 3 lines
drivers/staging/skein/skein.c +1
-0return SKEIN_SUCCESS ; } +EXPORT_SYMBOL (skein_256_init);Once the above is corrected, these shouldn't be necessary.
Will give it a whirl, I was having problems with undefined symbols at linking even when I was building it as one module, but it may have been something else
Quoted 11 lines
drivers/staging/skein/skein.h line 30
Quoted 8 lines
drivers/staging/skein/skein.h +1
-0@@ -26,8 +26,14 @@** 0: use assert() to flag errors ** 1: return SKEIN_FAIL to flag errors ** +** ***************************************************************************/ superfluous whitespace addition?
Remnants of a backed out change... will fix.
Quoted 7 lines
drivers/staging/skein/skein.h line 35
Quoted 5 lines
drivers/staging/skein/skein.h +5
-0+ +static struct shash_alg alg = { + .digestsize = (SKEIN1024_DIGEST_SIZE /8 ), + .init = skein1024_init, + .update = crypto_skein1024_update,why is this function name different from the other two?
It was inherited from the sha1 file I based this off of, I can make them the same.
Quoted 9 lines
I think it might be best to have two loadable modules. One for threefish, and one for skein. Adding threefish to the crypto API is a bit more difficult than adding skein, as the crypto API doesn't currently support tweakable block ciphers.
To keep things moving, it'd probably be best to do one module for now, skein. Have all the object files for skein and threefish in it, and register the three hash algos with the API.
Quoted 8 lines
After that, we can go back and split out threefish into a separate module with it's own registration into the crypto API.
Does that sound sensible?
thx,
Jason.
Sounds fine to me, I will build it that way and resubmit.
Quoted 2 lines · Eric Rost
Quoted 1 line · Jason Cooper
At some point, Eric Rost wrote:
...
Quoted 40 lines
Quoted 34 lines
Quoted 5 lines
drivers/staging/skein/Makefile +0
-0drivers/staging/skein/Makefile obj-$(CONFIG_CRYPTO_SKEIN) += skein.o \ · line 13
Quoted 9 lines
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 +This isn't really doing what we want. You'll have loadable modules, but the actual code will still be built into the kernel.
Quoted 16 lines
drivers/staging/skein/Makefile +0
-0obj-$(CONFIG_CRYPTO_THREEFISH) += threefish_block.o \ threefish_api.odrivers/staging/skein/skein.c +1
-0@@ -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)Quoted 6 lines
drivers/staging/skein/skein.c int skein_256_init(struct skein_256_ctx *ctx, size_t hash_bit_len) · line 77
Quoted 3 lines
drivers/staging/skein/skein.c +1
-0return SKEIN_SUCCESS ; } +EXPORT_SYMBOL (skein_256_init);Once the above is corrected, these shouldn't be necessary.
Quoted 3 lines
Will give it a whirl, I was having problems with undefined symbols at linking even when I was building it as one module, but it may have been something else
Try just changing CRYPTO_SKEIN to a tri-state, and adding your skein_generic.o to the obj-$(CONFIG_CRYPTO_SKEIN) list.
You'll probably have to collapse CRYPTO_THREEFISH into CRYPTO_SKEIN for now. Let's get the crypto API registration proper first, them we can focus on the loadable module bit.
thx,
Jason.