2017-04-17 00:47:48

by Karim Eshapa

[permalink] [raw]
Subject: [PATCH 2/2] staging:skein: skein_base.h, skein_block.h: move macros into appropriate header files

Macros more related to BLK operations.

Signed-off-by: Karim Eshapa <[email protected]>
---
drivers/staging/skein/skein_base.h | 28 ----------------------------
drivers/staging/skein/skein_block.h | 28 ++++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/skein/skein_base.h b/drivers/staging/skein/skein_base.h
index cd794c1..a159a32 100644
--- a/drivers/staging/skein/skein_base.h
+++ b/drivers/staging/skein/skein_base.h
@@ -169,34 +169,6 @@ int skein_1024_output(struct skein_1024_ctx *ctx, u8 *hash_val);
#define SKEIN_T1_TREE_LVL_MASK (((u64)0x7F) << SKEIN_T1_POS_TREE_LVL)
#define SKEIN_T1_TREE_LEVEL(n) (((u64)(n)) << SKEIN_T1_POS_TREE_LVL)

-/* tweak word tweak[1]: block type field */
-#define SKEIN_BLK_TYPE_KEY (0) /* key, for MAC and KDF */
-#define SKEIN_BLK_TYPE_CFG (4) /* configuration block */
-#define SKEIN_BLK_TYPE_PERS (8) /* personalization string */
-#define SKEIN_BLK_TYPE_PK (12) /* pubkey (for digital sigs) */
-#define SKEIN_BLK_TYPE_KDF (16) /* key identifier for KDF */
-#define SKEIN_BLK_TYPE_NONCE (20) /* nonce for PRNG */
-#define SKEIN_BLK_TYPE_MSG (48) /* message processing */
-#define SKEIN_BLK_TYPE_OUT (63) /* output stage */
-#define SKEIN_BLK_TYPE_MASK (63) /* bit field mask */
-
-#define SKEIN_T1_BLK_TYPE(T) (((u64)(SKEIN_BLK_TYPE_##T)) << \
- SKEIN_T1_POS_BLK_TYPE)
-#define SKEIN_T1_BLK_TYPE_KEY SKEIN_T1_BLK_TYPE(KEY) /* for MAC and KDF */
-#define SKEIN_T1_BLK_TYPE_CFG SKEIN_T1_BLK_TYPE(CFG) /* config block */
-#define SKEIN_T1_BLK_TYPE_PERS SKEIN_T1_BLK_TYPE(PERS) /* personalization */
-#define SKEIN_T1_BLK_TYPE_PK SKEIN_T1_BLK_TYPE(PK) /* pubkey (for sigs) */
-#define SKEIN_T1_BLK_TYPE_KDF SKEIN_T1_BLK_TYPE(KDF) /* key ident for KDF */
-#define SKEIN_T1_BLK_TYPE_NONCE SKEIN_T1_BLK_TYPE(NONCE)/* nonce for PRNG */
-#define SKEIN_T1_BLK_TYPE_MSG SKEIN_T1_BLK_TYPE(MSG) /* message processing */
-#define SKEIN_T1_BLK_TYPE_OUT SKEIN_T1_BLK_TYPE(OUT) /* output stage */
-#define SKEIN_T1_BLK_TYPE_MASK SKEIN_T1_BLK_TYPE(MASK) /* field bit mask */
-
-#define SKEIN_T1_BLK_TYPE_CFG_FINAL (SKEIN_T1_BLK_TYPE_CFG | \
- SKEIN_T1_FLAG_FINAL)
-#define SKEIN_T1_BLK_TYPE_OUT_FINAL (SKEIN_T1_BLK_TYPE_OUT | \
- SKEIN_T1_FLAG_FINAL)
-
#define SKEIN_VERSION (1)

#ifndef SKEIN_ID_STRING_LE /* allow compile-time personalization */
diff --git a/drivers/staging/skein/skein_block.h b/drivers/staging/skein/skein_block.h
index ec1baea..0dfceef 100644
--- a/drivers/staging/skein/skein_block.h
+++ b/drivers/staging/skein/skein_block.h
@@ -14,6 +14,34 @@

#include "skein_base.h" /* get the Skein API definitions */

+/* tweak word tweak[1]: block type field */
+#define SKEIN_BLK_TYPE_KEY (0) /* key, for MAC and KDF */
+#define SKEIN_BLK_TYPE_CFG (4) /* configuration block */
+#define SKEIN_BLK_TYPE_PERS (8) /* personalization string */
+#define SKEIN_BLK_TYPE_PK (12) /* pubkey (for digital sigs) */
+#define SKEIN_BLK_TYPE_KDF (16) /* key identifier for KDF */
+#define SKEIN_BLK_TYPE_NONCE (20) /* nonce for PRNG */
+#define SKEIN_BLK_TYPE_MSG (48) /* message processing */
+#define SKEIN_BLK_TYPE_OUT (63) /* output stage */
+#define SKEIN_BLK_TYPE_MASK (63) /* bit field mask */
+
+#define SKEIN_T1_BLK_TYPE(T) (((u64)(SKEIN_BLK_TYPE_##T)) << \
+ SKEIN_T1_POS_BLK_TYPE)
+#define SKEIN_T1_BLK_TYPE_KEY SKEIN_T1_BLK_TYPE(KEY) /* for MAC and KDF */
+#define SKEIN_T1_BLK_TYPE_CFG SKEIN_T1_BLK_TYPE(CFG) /* config block */
+#define SKEIN_T1_BLK_TYPE_PERS SKEIN_T1_BLK_TYPE(PERS) /* personalization */
+#define SKEIN_T1_BLK_TYPE_PK SKEIN_T1_BLK_TYPE(PK) /* pubkey (for sigs) */
+#define SKEIN_T1_BLK_TYPE_KDF SKEIN_T1_BLK_TYPE(KDF) /* key ident for KDF */
+#define SKEIN_T1_BLK_TYPE_NONCE SKEIN_T1_BLK_TYPE(NONCE)/* nonce for PRNG */
+#define SKEIN_T1_BLK_TYPE_MSG SKEIN_T1_BLK_TYPE(MSG) /* message processing */
+#define SKEIN_T1_BLK_TYPE_OUT SKEIN_T1_BLK_TYPE(OUT) /* output stage */
+#define SKEIN_T1_BLK_TYPE_MASK SKEIN_T1_BLK_TYPE(MASK) /* field bit mask */
+
+#define SKEIN_T1_BLK_TYPE_CFG_FINAL (SKEIN_T1_BLK_TYPE_CFG | \
+ SKEIN_T1_FLAG_FINAL)
+#define SKEIN_T1_BLK_TYPE_OUT_FINAL (SKEIN_T1_BLK_TYPE_OUT | \
+ SKEIN_T1_FLAG_FINAL)
+
void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blk_ptr,
size_t blk_cnt, size_t byte_cnt_add);
void skein_512_process_block(struct skein_512_ctx *ctx, const u8 *blk_ptr,
--
2.7.4


2017-04-17 07:04:17

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging:skein: skein_base.h, skein_block.h: move macros into appropriate header files

On Mon, Apr 17, 2017 at 02:47:34AM +0200, Karim Eshapa wrote:
> Macros more related to BLK operations.

That doesn't make any sense to me, can you be more explicit?

> Signed-off-by: Karim Eshapa <[email protected]>
> ---
> drivers/staging/skein/skein_base.h | 28 ----------------------------
> drivers/staging/skein/skein_block.h | 28 ++++++++++++++++++++++++++++
> 2 files changed, 28 insertions(+), 28 deletions(-)

Moving stuff from one file to another doesn't seem like it is really
worth it.

And where is patch 1/2 in this series?

thanks,

greg k-h

2017-04-17 15:04:44

by Karim Eshapa

[permalink] [raw]
Subject: Re:staging:skein: skein_base.h, skein_block.h: move macros into appropriate header files

On Mon, 17 Apr 2017 09:04:03 +0200, Greg KH wrote:
> On Mon, Apr 17, 2017 at 02:47:34AM +0200, Karim Eshapa wrote:
>>
>> Macros more related to BLK operations.
>
> That doesn't make any sense to me, can you be more explicit?.

skein_block.h contains all fn's related to processing on
different block size so , it's more finer to contain macros
that define block configuration, message,.. specially they
aren't even referenced in all files that include skein_base.h
but these macros I think still exist in driver files for future work as well.

> Moving stuff from one file to another doesn't seem like it is really
> worth it.
> And where is patch 1/2 in this series?

And, Moving stuff is what "TODO" see it is worth.
There is no patch1/2 sorry, but may be because I sent
the patch twice as one of the mails was witten wrong.

>> Signed-off-by: Karim Eshapa <[email protected]>
>> ---
>> drivers/staging/skein/skein_base.h | 28 ----------------------------
>> drivers/staging/skein/skein_block.h | 28 ++++++++++++++++++++++++++++
>> 2 files changed, 28 insertions(+), 28 deletions(-)

Thanks,
Karim