* [PATCH v6 1/7] staging: skein: Collapses threefish module
2014-10-24 22:29 [PATCH v6 0/7] staging: skein: CryptoAPI and Module Support Eric Rost
@ 2014-10-24 22:29 ` Eric Rost
2014-10-24 22:32 ` [PATCH v6 2/7] staging: skein: Renames skein to skein_base Eric Rost
` (6 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Eric Rost @ 2014-10-24 22:29 UTC (permalink / raw)
To: gregkh, jason, jake, antonysaraev; +Cc: devel, linux-kernel
Collapses threefish module into skein module.
Signed-off-by: Eric Rost <eric.rost@mybabylon.net>
---
drivers/staging/skein/Kconfig | 22 +++-------------------
drivers/staging/skein/Makefile | 11 +++++------
2 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/drivers/staging/skein/Kconfig b/drivers/staging/skein/Kconfig
index b9172bf..de8bdd7 100644
--- a/drivers/staging/skein/Kconfig
+++ b/drivers/staging/skein/Kconfig
@@ -1,8 +1,8 @@
config CRYPTO_SKEIN
bool "Skein digest algorithm"
depends on (X86 || UML_X86) && 64BIT && CRYPTO
- select CRYPTO_THREEFISH
select CRYPTO_HASH
+ select CRYPTO_ALGAPI
help
Skein secure hash algorithm is one of 5 finalists from the NIST SHA3
competition.
@@ -12,21 +12,5 @@ config CRYPTO_SKEIN
http://www.skein-hash.info/sites/default/files/skein1.3.pdf
- for more information. This module depends on the threefish block
- cipher module.
-
-config CRYPTO_THREEFISH
- bool "Threefish tweakable block cipher"
- depends on (X86 || UML_X86) && 64BIT && CRYPTO
- select CRYPTO_ALGAPI
- help
- Threefish cipher algorithm is the tweakable block cipher underneath
- the Skein family of secure hash algorithms. Skein is one of 5
- finalists from the NIST SHA3 competition.
-
- Skein is optimized for modern, 64bit processors and is highly
- customizable. See:
-
- http://www.skein-hash.info/sites/default/files/skein1.3.pdf
-
- for more information.
+ for more information. This module also contains the threefish block
+ cipher algorithm.
diff --git a/drivers/staging/skein/Makefile b/drivers/staging/skein/Makefile
index a14aadd..4b60171 100644
--- a/drivers/staging/skein/Makefile
+++ b/drivers/staging/skein/Makefile
@@ -1,9 +1,8 @@
#
# Makefile for the skein secure hash algorithm
#
-obj-$(CONFIG_CRYPTO_SKEIN) += skein.o \
- skein_api.o \
- skein_block.o
-
-obj-$(CONFIG_CRYPTO_THREEFISH) += threefish_block.o \
- threefish_api.o
+obj-$(CONFIG_CRYPTO_SKEIN) += skein.o \
+ skein_api.o \
+ skein_block.o \
+ threefish_block.o \
+ threefish_api.o
--
2.1.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v6 2/7] staging: skein: Renames skein to skein_base
2014-10-24 22:29 [PATCH v6 0/7] staging: skein: CryptoAPI and Module Support Eric Rost
2014-10-24 22:29 ` [PATCH v6 1/7] staging: skein: Collapses threefish module Eric Rost
@ 2014-10-24 22:32 ` Eric Rost
2014-10-24 22:33 ` [PATCH v6 3/7] staging: skein: Adds CryptoAPI Support Eric Rost
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Eric Rost @ 2014-10-24 22:32 UTC (permalink / raw)
To: gregkh, jason, jake, antonysaraev; +Cc: devel, linux-kernel
Renames skein.c to skein_base.c and skein.h to skein_base.h in
preparation for naming loadable module skein.ko
Signed-off-by: Eric Rost <eric.rost@mybabylon.net>
---
drivers/staging/skein/Makefile | 2 +-
drivers/staging/skein/skein_api.h | 2 +-
drivers/staging/skein/{skein.c => skein_base.c} | 3 ++-
drivers/staging/skein/{skein.h => skein_base.h} | 0
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 +-
8 files changed, 8 insertions(+), 7 deletions(-)
rename drivers/staging/skein/{skein.c => skein_base.c} (99%)
rename drivers/staging/skein/{skein.h => skein_base.h} (100%)
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_api.h b/drivers/staging/skein/skein_api.h
index e02fa19..171b875 100644
--- a/drivers/staging/skein/skein_api.h
+++ b/drivers/staging/skein/skein_api.h
@@ -79,7 +79,7 @@ OTHER DEALINGS IN THE SOFTWARE.
*/
#include <linux/types.h>
-#include "skein.h"
+#include "skein_base.h"
/**
* Which Skein size to use
diff --git a/drivers/staging/skein/skein.c b/drivers/staging/skein/skein_base.c
similarity index 99%
rename from drivers/staging/skein/skein.c
rename to drivers/staging/skein/skein_base.c
index 8cc8358..e0994ea 100644
--- a/drivers/staging/skein/skein.c
+++ b/drivers/staging/skein/skein_base.c
@@ -11,7 +11,8 @@
#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 <linux/export.h>
+#include "skein_base.h" /* get the Skein API definitions */
#include "skein_iv.h" /* get precomputed IVs */
#include "skein_block.h"
diff --git a/drivers/staging/skein/skein.h b/drivers/staging/skein/skein_base.h
similarity index 100%
rename from drivers/staging/skein/skein.h
rename to drivers/staging/skein/skein_base.h
diff --git a/drivers/staging/skein/skein_block.c b/drivers/staging/skein/skein_block.c
index 88bc718..36b0b40 100644
--- a/drivers/staging/skein/skein_block.c
+++ b/drivers/staging/skein/skein_block.c
@@ -15,7 +15,7 @@
************************************************************************/
#include <linux/string.h>
-#include "skein.h"
+#include "skein_base.h"
#include "skein_block.h"
#ifndef SKEIN_USE_ASM
diff --git a/drivers/staging/skein/skein_block.h b/drivers/staging/skein/skein_block.h
index bd7bdc3..9d40f4a 100644
--- a/drivers/staging/skein/skein_block.h
+++ b/drivers/staging/skein/skein_block.h
@@ -10,7 +10,7 @@
#ifndef _SKEIN_BLOCK_H_
#define _SKEIN_BLOCK_H_
-#include "skein.h" /* get the Skein API definitions */
+#include "skein_base.h" /* get the Skein API definitions */
void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blk_ptr,
size_t blk_cnt, size_t byte_cnt_add);
diff --git a/drivers/staging/skein/skein_iv.h b/drivers/staging/skein/skein_iv.h
index d9dc1d5..8a06314 100644
--- a/drivers/staging/skein/skein_iv.h
+++ b/drivers/staging/skein/skein_iv.h
@@ -1,7 +1,7 @@
#ifndef _SKEIN_IV_H_
#define _SKEIN_IV_H_
-#include "skein.h" /* get Skein macros and types */
+#include "skein_base.h" /* get Skein macros and types */
/*
***************** Pre-computed Skein IVs *******************
diff --git a/drivers/staging/skein/threefish_api.h b/drivers/staging/skein/threefish_api.h
index 8d5ddf8..8e0a0b7 100644
--- a/drivers/staging/skein/threefish_api.h
+++ b/drivers/staging/skein/threefish_api.h
@@ -29,7 +29,7 @@
*/
#include <linux/types.h>
-#include "skein.h"
+#include "skein_base.h"
#define KEY_SCHEDULE_CONST 0x1BD11BDAA9FC1A22L
--
2.1.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v6 3/7] staging: skein: Adds CryptoAPI Support
2014-10-24 22:29 [PATCH v6 0/7] staging: skein: CryptoAPI and Module Support Eric Rost
2014-10-24 22:29 ` [PATCH v6 1/7] staging: skein: Collapses threefish module Eric Rost
2014-10-24 22:32 ` [PATCH v6 2/7] staging: skein: Renames skein to skein_base Eric Rost
@ 2014-10-24 22:33 ` Eric Rost
2014-10-24 22:33 ` [PATCH v6 4/7] staging: skein: Adds Loadable Module Support Eric Rost
` (4 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Eric Rost @ 2014-10-24 22:33 UTC (permalink / raw)
To: gregkh, jason, jake, antonysaraev; +Cc: devel, linux-kernel
Adds CryptoAPI support to the Skein Hashing Algorithm driver.
Signed-off-by: Eric Rost <eric.rost@mybabylon.net>
---
drivers/staging/skein/Makefile | 3 +-
drivers/staging/skein/skein_base.h | 5 +
drivers/staging/skein/skein_generic.c | 199 ++++++++++++++++++++++++++++++++++
3 files changed, 206 insertions(+), 1 deletion(-)
create mode 100644 drivers/staging/skein/skein_generic.c
diff --git a/drivers/staging/skein/Makefile b/drivers/staging/skein/Makefile
index ca746a9..d8177cc 100644
--- a/drivers/staging/skein/Makefile
+++ b/drivers/staging/skein/Makefile
@@ -5,4 +5,5 @@ obj-$(CONFIG_CRYPTO_SKEIN) += skein_base.o \
skein_api.o \
skein_block.o \
threefish_block.o \
- threefish_api.o
+ threefish_api.o \
+ skein_generic.o
diff --git a/drivers/staging/skein/skein_base.h b/drivers/staging/skein/skein_base.h
index e6669f1..9f10af9 100644
--- a/drivers/staging/skein/skein_base.h
+++ b/drivers/staging/skein/skein_base.h
@@ -28,6 +28,11 @@
**
***************************************************************************/
+/*Skein digest sizes for crypto api*/
+#define SKEIN256_DIGEST_BIT_SIZE 256
+#define SKEIN512_DIGEST_BIT_SIZE 512
+#define SKEIN1024_DIGEST_BIT_SIZE 1024
+
#ifndef rotl_64
#define rotl_64(x, N) (((x) << (N)) | ((x) >> (64-(N))))
#endif
diff --git a/drivers/staging/skein/skein_generic.c b/drivers/staging/skein/skein_generic.c
new file mode 100644
index 0000000..f2d6dfb
--- /dev/null
+++ b/drivers/staging/skein/skein_generic.c
@@ -0,0 +1,199 @@
+/*
+ * Cryptographic API.
+ *
+ * Skein256 Hash Algorithm.
+ *
+ * Derived from cryptoapi implementation, adapted for in-place
+ * scatterlist interface.
+ *
+ * Copyright (c) Eric Rost <eric.rost@mybabylon.net>
+ *
+ * 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 <linux/types.h>
+#include <linux/init.h>
+#include <crypto/internal/hash.h>
+#include "skein_base.h"
+
+
+static int skein256_init(struct shash_desc *desc)
+{
+ return skein_256_init((struct skein_256_ctx *) shash_desc_ctx(desc),
+ SKEIN256_DIGEST_BIT_SIZE);
+}
+
+int skein256_update(struct shash_desc *desc, const u8 *data,
+ unsigned int len)
+{
+ return skein_256_update((struct skein_256_ctx *)shash_desc_ctx(desc),
+ data, len);
+}
+
+static int skein256_final(struct shash_desc *desc, u8 *out)
+{
+ return skein_256_final((struct skein_256_ctx *)shash_desc_ctx(desc),
+ out);
+}
+
+static int skein256_export(struct shash_desc *desc, void *out)
+{
+ struct skein_256_ctx *sctx = shash_desc_ctx(desc);
+
+ memcpy(out, sctx, sizeof(*sctx));
+ return 0;
+}
+
+static int skein256_import(struct shash_desc *desc, const void *in)
+{
+ struct skein_256_ctx *sctx = shash_desc_ctx(desc);
+
+ memcpy(sctx, in, sizeof(*sctx));
+ return 0;
+}
+
+static int skein512_init(struct shash_desc *desc)
+{
+ return skein_512_init((struct skein_512_ctx *)shash_desc_ctx(desc),
+ SKEIN512_DIGEST_BIT_SIZE);
+}
+
+int skein512_update(struct shash_desc *desc, const u8 *data,
+ unsigned int len)
+{
+ return skein_512_update((struct skein_512_ctx *)shash_desc_ctx(desc),
+ data, len);
+}
+
+static int skein512_final(struct shash_desc *desc, u8 *out)
+{
+ return skein_512_final((struct skein_512_ctx *)shash_desc_ctx(desc),
+ out);
+}
+
+static int skein512_export(struct shash_desc *desc, void *out)
+{
+ struct skein_512_ctx *sctx = shash_desc_ctx(desc);
+
+ memcpy(out, sctx, sizeof(*sctx));
+ return 0;
+}
+
+static int skein512_import(struct shash_desc *desc, const void *in)
+{
+ struct skein_512_ctx *sctx = shash_desc_ctx(desc);
+
+ memcpy(sctx, in, sizeof(*sctx));
+ return 0;
+}
+
+static int skein1024_init(struct shash_desc *desc)
+{
+ return skein_1024_init((struct skein_1024_ctx *)shash_desc_ctx(desc),
+ SKEIN1024_DIGEST_BIT_SIZE);
+}
+
+int skein1024_update(struct shash_desc *desc, const u8 *data,
+ unsigned int len)
+{
+ return skein_1024_update((struct skein_1024_ctx *)shash_desc_ctx(desc),
+ data, len);
+}
+
+static int skein1024_final(struct shash_desc *desc, u8 *out)
+{
+ return skein_1024_final((struct skein_1024_ctx *)shash_desc_ctx(desc),
+ out);
+}
+
+static int skein1024_export(struct shash_desc *desc, void *out)
+{
+ struct skein_1024_ctx *sctx = shash_desc_ctx(desc);
+
+ memcpy(out, sctx, sizeof(*sctx));
+ return 0;
+}
+
+static int skein1024_import(struct shash_desc *desc, const void *in)
+{
+ struct skein_1024_ctx *sctx = shash_desc_ctx(desc);
+
+ memcpy(sctx, in, sizeof(*sctx));
+ return 0;
+}
+
+static struct shash_alg alg256 = {
+ .digestsize = (SKEIN256_DIGEST_BIT_SIZE / 8),
+ .init = skein256_init,
+ .update = skein256_update,
+ .final = skein256_final,
+ .export = skein256_export,
+ .import = skein256_import,
+ .descsize = sizeof(struct skein_256_ctx),
+ .statesize = sizeof(struct skein_256_ctx),
+ .base = {
+ .cra_name = "skein256",
+ .cra_driver_name = "skein",
+ .cra_flags = CRYPTO_ALG_TYPE_SHASH,
+ .cra_blocksize = SKEIN_256_BLOCK_BYTES,
+ }
+};
+
+static struct shash_alg alg512 = {
+ .digestsize = (SKEIN512_DIGEST_BIT_SIZE / 8),
+ .init = skein512_init,
+ .update = skein512_update,
+ .final = skein512_final,
+ .export = skein512_export,
+ .import = skein512_import,
+ .descsize = sizeof(struct skein_512_ctx),
+ .statesize = sizeof(struct skein_512_ctx),
+ .base = {
+ .cra_name = "skein512",
+ .cra_driver_name = "skein",
+ .cra_flags = CRYPTO_ALG_TYPE_SHASH,
+ .cra_blocksize = SKEIN_512_BLOCK_BYTES,
+ }
+};
+
+static struct shash_alg alg1024 = {
+ .digestsize = (SKEIN1024_DIGEST_BIT_SIZE / 8),
+ .init = skein1024_init,
+ .update = skein1024_update,
+ .final = skein1024_final,
+ .export = skein1024_export,
+ .import = skein1024_import,
+ .descsize = sizeof(struct skein_1024_ctx),
+ .statesize = sizeof(struct skein_1024_ctx),
+ .base = {
+ .cra_name = "skein1024",
+ .cra_driver_name = "skein",
+ .cra_flags = CRYPTO_ALG_TYPE_SHASH,
+ .cra_blocksize = SKEIN_1024_BLOCK_BYTES,
+ }
+};
+
+static int __init skein_generic_init(void)
+{
+ if (crypto_register_shash(&alg256))
+ goto out;
+ if (crypto_register_shash(&alg512))
+ goto unreg256;
+ if (crypto_register_shash(&alg1024))
+ goto unreg512;
+
+ return 0;
+
+
+unreg512:
+ crypto_unregister_shash(&alg512);
+unreg256:
+ crypto_unregister_shash(&alg256);
+out:
+ return -1;
+}
+
+device_initcall(skein_generic_init);
--
2.1.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v6 4/7] staging: skein: Adds Loadable Module Support
2014-10-24 22:29 [PATCH v6 0/7] staging: skein: CryptoAPI and Module Support Eric Rost
` (2 preceding siblings ...)
2014-10-24 22:33 ` [PATCH v6 3/7] staging: skein: Adds CryptoAPI Support Eric Rost
@ 2014-10-24 22:33 ` Eric Rost
2014-10-24 22:34 ` [PATCH v6 5/7] staging: skein: Inlines rotl_64 Eric Rost
` (3 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Eric Rost @ 2014-10-24 22:33 UTC (permalink / raw)
To: gregkh, jason, jake, antonysaraev; +Cc: devel, linux-kernel
Adds loadable module support to the Skein Hashing Algorithm driver.
Signed-off-by: Eric Rost <eric.rost@mybabylon.net>
---
drivers/staging/skein/Kconfig | 2 +-
drivers/staging/skein/Makefile | 13 +++++++------
drivers/staging/skein/skein_generic.c | 19 ++++++++++++++++++-
3 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/skein/Kconfig b/drivers/staging/skein/Kconfig
index de8bdd7..012a823 100644
--- a/drivers/staging/skein/Kconfig
+++ b/drivers/staging/skein/Kconfig
@@ -1,5 +1,5 @@
config CRYPTO_SKEIN
- bool "Skein digest algorithm"
+ tristate "Skein digest algorithm"
depends on (X86 || UML_X86) && 64BIT && CRYPTO
select CRYPTO_HASH
select CRYPTO_ALGAPI
diff --git a/drivers/staging/skein/Makefile b/drivers/staging/skein/Makefile
index d8177cc..b7f947f 100644
--- a/drivers/staging/skein/Makefile
+++ b/drivers/staging/skein/Makefile
@@ -1,9 +1,10 @@
#
# Makefile for the skein secure hash algorithm
#
-obj-$(CONFIG_CRYPTO_SKEIN) += skein_base.o \
- skein_api.o \
- skein_block.o \
- threefish_block.o \
- threefish_api.o \
- skein_generic.o
+obj-$(CONFIG_CRYPTO_SKEIN) += skein.o
+skein-y := skein_base.o \
+ skein_api.o \
+ skein_block.o \
+ threefish_block.o \
+ threefish_api.o \
+ skein_generic.o
diff --git a/drivers/staging/skein/skein_generic.c b/drivers/staging/skein/skein_generic.c
index f2d6dfb..60d16b6 100644
--- a/drivers/staging/skein/skein_generic.c
+++ b/drivers/staging/skein/skein_generic.c
@@ -16,6 +16,7 @@
*/
#include <linux/types.h>
#include <linux/init.h>
+#include <linux/module.h>
#include <crypto/internal/hash.h>
#include "skein_base.h"
@@ -139,6 +140,7 @@ static struct shash_alg alg256 = {
.cra_driver_name = "skein",
.cra_flags = CRYPTO_ALG_TYPE_SHASH,
.cra_blocksize = SKEIN_256_BLOCK_BYTES,
+ .cra_module = THIS_MODULE,
}
};
@@ -156,6 +158,7 @@ static struct shash_alg alg512 = {
.cra_driver_name = "skein",
.cra_flags = CRYPTO_ALG_TYPE_SHASH,
.cra_blocksize = SKEIN_512_BLOCK_BYTES,
+ .cra_module = THIS_MODULE,
}
};
@@ -173,6 +176,7 @@ static struct shash_alg alg1024 = {
.cra_driver_name = "skein",
.cra_flags = CRYPTO_ALG_TYPE_SHASH,
.cra_blocksize = SKEIN_1024_BLOCK_BYTES,
+ .cra_module = THIS_MODULE,
}
};
@@ -196,4 +200,17 @@ out:
return -1;
}
-device_initcall(skein_generic_init);
+static void __exit skein_generic_fini(void)
+{
+ crypto_unregister_shash(&alg256);
+ crypto_unregister_shash(&alg512);
+ crypto_unregister_shash(&alg1024);
+}
+
+module_init(skein_generic_init);
+module_exit(skein_generic_fini);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Skein Hash Algorithm");
+
+MODULE_ALIAS("skein");
--
2.1.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v6 5/7] staging: skein: Inlines rotl_64
2014-10-24 22:29 [PATCH v6 0/7] staging: skein: CryptoAPI and Module Support Eric Rost
` (3 preceding siblings ...)
2014-10-24 22:33 ` [PATCH v6 4/7] staging: skein: Adds Loadable Module Support Eric Rost
@ 2014-10-24 22:34 ` Eric Rost
2014-10-24 22:34 ` [PATCH v6 6/7] staging: skein: Removes unneeded #define Eric Rost
` (2 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Eric Rost @ 2014-10-24 22:34 UTC (permalink / raw)
To: gregkh, jason, jake, antonysaraev; +Cc: devel, linux-kernel
Inlines the rotl_64 macro.
Signed-off-by: Eric Rost <eric.rost@mybabylon.net>
---
drivers/staging/skein/skein_base.h | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/skein/skein_base.h b/drivers/staging/skein/skein_base.h
index 9f10af9..0111fa4 100644
--- a/drivers/staging/skein/skein_base.h
+++ b/drivers/staging/skein/skein_base.h
@@ -33,10 +33,6 @@
#define SKEIN512_DIGEST_BIT_SIZE 512
#define SKEIN1024_DIGEST_BIT_SIZE 1024
-#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, b_cnt) memcpy(dst08, src64, b_cnt)
#define skein_get64_lsb_first(dst64, src08, w_cnt) \
@@ -49,12 +45,12 @@ enum {
SKEIN_BAD_HASHLEN = 2
};
-#define SKEIN_MODIFIER_WORDS (2) /* number of modifier (tweak) words */
+#define SKEIN_MODIFIER_WORDS 2 /* number of modifier (tweak) words */
-#define SKEIN_256_STATE_WORDS (4)
-#define SKEIN_512_STATE_WORDS (8)
-#define SKEIN_1024_STATE_WORDS (16)
-#define SKEIN_MAX_STATE_WORDS (16)
+#define SKEIN_256_STATE_WORDS 4
+#define SKEIN_512_STATE_WORDS 8
+#define SKEIN_1024_STATE_WORDS 16
+#define SKEIN_MAX_STATE_WORDS 16
#define SKEIN_256_STATE_BYTES (8*SKEIN_256_STATE_WORDS)
#define SKEIN_512_STATE_BYTES (8*SKEIN_512_STATE_WORDS)
@@ -92,6 +88,11 @@ struct skein_1024_ctx { /* 1024-bit Skein hash context structure */
u8 b[SKEIN_1024_BLOCK_BYTES]; /* partial block buf (8-byte aligned) */
};
+static inline int rotl_64(int x, int N)
+{
+ return (x << N) | (x >> (64 - N));
+}
+
/* Skein APIs for (incremental) "straight hashing" */
int skein_256_init(struct skein_256_ctx *ctx, size_t hash_bit_len);
int skein_512_init(struct skein_512_ctx *ctx, size_t hash_bit_len);
--
2.1.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v6 6/7] staging: skein: Removes unneeded #define
2014-10-24 22:29 [PATCH v6 0/7] staging: skein: CryptoAPI and Module Support Eric Rost
` (4 preceding siblings ...)
2014-10-24 22:34 ` [PATCH v6 5/7] staging: skein: Inlines rotl_64 Eric Rost
@ 2014-10-24 22:34 ` Eric Rost
2014-10-24 22:34 ` [PATCH v6 7/7] staging: skein: Removes skein_debug include Eric Rost
2014-10-27 13:20 ` [PATCH v6 0/7] staging: skein: CryptoAPI and Module Support Jason Cooper
7 siblings, 0 replies; 11+ messages in thread
From: Eric Rost @ 2014-10-24 22:34 UTC (permalink / raw)
To: gregkh, jason, jake, antonysaraev; +Cc: devel, linux-kernel
Removes unneeded #define SKEIN_PORT_CODE since skein_port.h is
nonexistent.
Signed-off-by: Eric Rost <eric.rost@mybabylon.net>
---
drivers/staging/skein/skein_base.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/staging/skein/skein_base.c b/drivers/staging/skein/skein_base.c
index e0994ea..ebc436a 100644
--- a/drivers/staging/skein/skein_base.c
+++ b/drivers/staging/skein/skein_base.c
@@ -8,8 +8,6 @@
**
************************************************************************/
-#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_base.h" /* get the Skein API definitions */
--
2.1.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v6 7/7] staging: skein: Removes skein_debug include
2014-10-24 22:29 [PATCH v6 0/7] staging: skein: CryptoAPI and Module Support Eric Rost
` (5 preceding siblings ...)
2014-10-24 22:34 ` [PATCH v6 6/7] staging: skein: Removes unneeded #define Eric Rost
@ 2014-10-24 22:34 ` Eric Rost
2014-10-27 13:18 ` Jason Cooper
2014-10-27 13:20 ` [PATCH v6 0/7] staging: skein: CryptoAPI and Module Support Jason Cooper
7 siblings, 1 reply; 11+ messages in thread
From: Eric Rost @ 2014-10-24 22:34 UTC (permalink / raw)
To: gregkh, jason, jake, antonysaraev; +Cc: devel, linux-kernel
Removes skein_debug.h include since skein_debug.h is nonexistent.
Signed-off-by: Eric Rost <eric.rost@mybabylon.net>
---
drivers/staging/skein/skein_base.h | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/staging/skein/skein_base.h b/drivers/staging/skein/skein_base.h
index 0111fa4..5b69e5a 100644
--- a/drivers/staging/skein/skein_base.h
+++ b/drivers/staging/skein/skein_base.h
@@ -15,10 +15,6 @@
**
** The "default" note explains what happens when the switch is not defined.
**
-** SKEIN_DEBUG -- make callouts from inside Skein code
-** to examine/display intermediate values.
-** [default: no callouts (no overhead)]
-**
** SKEIN_ERR_CHECK -- how error checking is handled inside Skein
** code. If not defined, most error checking
** is disabled (for performance). Otherwise,
@@ -282,15 +278,12 @@ int skein_1024_output(struct skein_1024_ctx *ctx, u8 *hash_val);
/*****************************************************************
** "Internal" Skein definitions for debugging and error checking
******************************************************************/
-#ifdef SKEIN_DEBUG /* examine/display intermediate values? */
-#include "skein_debug.h"
-#else /* default is no callouts */
#define skein_show_block(bits, ctx, x, blk_ptr, w_ptr, ks_event_ptr, ks_odd_ptr)
#define skein_show_round(bits, ctx, r, x)
#define skein_show_r_ptr(bits, ctx, r, x_ptr)
#define skein_show_final(bits, ctx, cnt, out_ptr)
#define skein_show_key(bits, ctx, key, key_bytes)
-#endif
+
/* ignore all asserts, for performance */
#define skein_assert_ret(x, ret_code)
--
2.1.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v6 7/7] staging: skein: Removes skein_debug include
2014-10-24 22:34 ` [PATCH v6 7/7] staging: skein: Removes skein_debug include Eric Rost
@ 2014-10-27 13:18 ` Jason Cooper
0 siblings, 0 replies; 11+ messages in thread
From: Jason Cooper @ 2014-10-27 13:18 UTC (permalink / raw)
To: Eric Rost; +Cc: gregkh, jake, antonysaraev, devel, linux-kernel
On Fri, Oct 24, 2014 at 05:34:56PM -0500, Eric Rost wrote:
> Removes skein_debug.h include since skein_debug.h is nonexistent.
>
> Signed-off-by: Eric Rost <eric.rost@mybabylon.net>
> ---
> drivers/staging/skein/skein_base.h | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/staging/skein/skein_base.h b/drivers/staging/skein/skein_base.h
> index 0111fa4..5b69e5a 100644
> --- a/drivers/staging/skein/skein_base.h
> +++ b/drivers/staging/skein/skein_base.h
> @@ -15,10 +15,6 @@
> **
> ** The "default" note explains what happens when the switch is not defined.
> **
> -** SKEIN_DEBUG -- make callouts from inside Skein code
> -** to examine/display intermediate values.
> -** [default: no callouts (no overhead)]
> -**
> ** SKEIN_ERR_CHECK -- how error checking is handled inside Skein
> ** code. If not defined, most error checking
> ** is disabled (for performance). Otherwise,
> @@ -282,15 +278,12 @@ int skein_1024_output(struct skein_1024_ctx *ctx, u8 *hash_val);
> /*****************************************************************
> ** "Internal" Skein definitions for debugging and error checking
> ******************************************************************/
> -#ifdef SKEIN_DEBUG /* examine/display intermediate values? */
> -#include "skein_debug.h"
> -#else /* default is no callouts */
> #define skein_show_block(bits, ctx, x, blk_ptr, w_ptr, ks_event_ptr, ks_odd_ptr)
> #define skein_show_round(bits, ctx, r, x)
> #define skein_show_r_ptr(bits, ctx, r, x_ptr)
> #define skein_show_final(bits, ctx, cnt, out_ptr)
> #define skein_show_key(bits, ctx, key, key_bytes)
Are these called anywhere (sorry, away from dev box atm)? If so, we
should remove those as well.
We shouldn't let this hold up the rest of the series, though. I'll R-b
the rest and we'll keep working on this one.
thx,
Jason.
> -#endif
> +
>
> /* ignore all asserts, for performance */
> #define skein_assert_ret(x, ret_code)
> --
> 2.1.1
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v6 0/7] staging: skein: CryptoAPI and Module Support
2014-10-24 22:29 [PATCH v6 0/7] staging: skein: CryptoAPI and Module Support Eric Rost
` (6 preceding siblings ...)
2014-10-24 22:34 ` [PATCH v6 7/7] staging: skein: Removes skein_debug include Eric Rost
@ 2014-10-27 13:20 ` Jason Cooper
2014-10-29 8:40 ` Greg KH
7 siblings, 1 reply; 11+ messages in thread
From: Jason Cooper @ 2014-10-27 13:20 UTC (permalink / raw)
To: Eric Rost; +Cc: gregkh, jake, antonysaraev, devel, linux-kernel
Greg,
On Fri, Oct 24, 2014 at 05:29:09PM -0500, Eric Rost wrote:
> Adds CryptoAPI and loadable module support to the Skein Hashing
> Algorithm. Collapses threefish module into skein module. Renames skein.c
> and skein.h to skein_base.c and skein_base.h so module can be named
> skein.ko. Inlines rotl_64 macro. Removes unneeded #define and
> skein_debug.h include.
>
> Eric Rost (7):
> staging: skein: Collapses threefish module
> staging: skein: Renames skein to skein_base
> staging: skein: Adds CryptoAPI Support
> staging: skein: Adds Loadable Module Support
> staging: skein: Inlines rotl_64
> staging: skein: Removes unneeded #define
For patches 1 through 6,
Reviewed-by: Jason Cooper <jason@lakedaemon.net>
We'll keep working on #7, but feel free to take the first six when you
get a moment Greg.
thx,
Jason.
> staging: skein: Removes skein_debug include
>
> drivers/staging/skein/Kconfig | 24 +--
> drivers/staging/skein/Makefile | 13 +-
> drivers/staging/skein/skein_api.h | 2 +-
> drivers/staging/skein/{skein.c => skein_base.c} | 5 +-
> drivers/staging/skein/{skein.h => skein_base.h} | 31 ++--
> drivers/staging/skein/skein_block.c | 2 +-
> drivers/staging/skein/skein_block.h | 2 +-
> drivers/staging/skein/skein_generic.c | 216 ++++++++++++++++++++++++
> drivers/staging/skein/skein_iv.h | 2 +-
> drivers/staging/skein/threefish_api.h | 2 +-
> 10 files changed, 249 insertions(+), 50 deletions(-)
> rename drivers/staging/skein/{skein.c => skein_base.c} (99%)
> rename drivers/staging/skein/{skein.h => skein_base.h} (95%)
> create mode 100644 drivers/staging/skein/skein_generic.c
>
> --
> 2.1.1
>
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH v6 0/7] staging: skein: CryptoAPI and Module Support
2014-10-27 13:20 ` [PATCH v6 0/7] staging: skein: CryptoAPI and Module Support Jason Cooper
@ 2014-10-29 8:40 ` Greg KH
0 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2014-10-29 8:40 UTC (permalink / raw)
To: Jason Cooper; +Cc: Eric Rost, devel, antonysaraev, linux-kernel, jake
On Mon, Oct 27, 2014 at 09:20:31AM -0400, Jason Cooper wrote:
> Greg,
>
> On Fri, Oct 24, 2014 at 05:29:09PM -0500, Eric Rost wrote:
> > Adds CryptoAPI and loadable module support to the Skein Hashing
> > Algorithm. Collapses threefish module into skein module. Renames skein.c
> > and skein.h to skein_base.c and skein_base.h so module can be named
> > skein.ko. Inlines rotl_64 macro. Removes unneeded #define and
> > skein_debug.h include.
> >
> > Eric Rost (7):
> > staging: skein: Collapses threefish module
> > staging: skein: Renames skein to skein_base
> > staging: skein: Adds CryptoAPI Support
> > staging: skein: Adds Loadable Module Support
> > staging: skein: Inlines rotl_64
> > staging: skein: Removes unneeded #define
>
> For patches 1 through 6,
>
> Reviewed-by: Jason Cooper <jason@lakedaemon.net>
>
> We'll keep working on #7, but feel free to take the first six when you
> get a moment Greg.
Now applied, thanks.
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread