Skip to contentSkip to conversation

Staging: Skein: Moved macros from skein_block.c to header file.

PATCH In review Sanidhya Solanki 5 participants 7 messages Dec 8, 2015 – Jan 29, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: Skein: Moved macros from skein_block.c to header file.

The original code defined macros in the source code, making it harder to read. Moved them to the header file, as per the TODO file.

Upadated the TODO file.

---
 drivers/staging/skein/TODO          | 1 -
 drivers/staging/skein/skein_block.c | 6 ------
 drivers/staging/skein/skein_block.h | 7 +++++++
 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/skein/TODO +0 -1
index cd3508d..e3de0c7 100644
@@ -1,6 +1,5 @@
 skein/threefish TODO
 
- - move macros into appropriate header files
  - add / pass test vectors
  - module support
 
drivers/staging/skein/skein_block.c +0 -6
index 45b4732..2120392 100644
@@ -26,12 +26,6 @@
 #define SKEIN_LOOP 001 /* default: unroll 256 and 512, but not 1024 */
 #endif
 
-#define BLK_BITS        (WCNT * 64) /* some useful definitions for code here */
-#define KW_TWK_BASE     (0)
-#define KW_KEY_BASE     (3)
-#define ks              (kw + KW_KEY_BASE)
-#define ts              (kw + KW_TWK_BASE)
-
 #ifdef SKEIN_DEBUG
 #define debug_save_tweak(ctx)       \
 {                                   \
drivers/staging/skein/skein_block.h +7 -0
index 9d40f4a..0fd4bfe 100644
@@ -7,6 +7,13 @@
 ** This algorithm and source code is released to the public domain.
 **
 ************************************************************************/
+
+#define BLK_BITS        (WCNT * 64) /* some useful definitions for code here */
+#define KW_TWK_BASE     (0)
+#define KW_KEY_BASE     (3)
+#define ks              (kw + KW_KEY_BASE)
+#define ts              (kw + KW_TWK_BASE)
+
 #ifndef _SKEIN_BLOCK_H_
 #define _SKEIN_BLOCK_H_
 
Signature · 1 line
2.5.0
#1 lore raw

Sanidhya,

*Much* better. Only two two small nits (things which Greg may be able to fix up when applying), and one comment.

nit: Patch subject should be 'staging: skein: ...'

Quoted 4 lines · Sanidhya Solanki

The original code defined macros in the source code, making it harder to read. Moved them to the header file, as per the TODO file.

Upadated the TODO file.

nit: typo 'Updated'

Quoted 13 lines
---
 drivers/staging/skein/TODO          | 1 -
 drivers/staging/skein/skein_block.c | 6 ------
 drivers/staging/skein/skein_block.h | 7 +++++++
 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/skein/TODO +0 -0
index cd3508d..e3de0c7 100644

drivers/staging/skein/TODO line 3

Quoted 3 lines
drivers/staging/skein/TODO +0 -1
@@ -1,6 +1,5 @@
 skein/threefish TODO
 
- - move macros into appropriate header files

There are a lot more macros to relocate than what we see below. I'd prefer to edit the TODO only after it's all cleaned up. Sorry if I wasn't clear before. I was assuming previous versions of your patches were tests, and that once you had the process down, you'd hit all of the macros.

So, the question is: Would you like this to be the first patch so you can see the whole process once? If so, we need to leave the TODO item intact. Otherwise, I think you've got the whole submission process down now so you can go ahead and do all the macros.

Just let us know.

thx,

Jason.

Quoted 41 lines
drivers/staging/skein/TODO +0 -0
  - add / pass test vectors
  - module support
 
drivers/staging/skein/skein_block.c +0 -6
index 45b4732..2120392 100644
@@ -26,12 +26,6 @@
 #define SKEIN_LOOP 001 /* default: unroll 256 and 512, but not 1024 */
 #endif
 
-#define BLK_BITS        (WCNT * 64) /* some useful definitions for code here */
-#define KW_TWK_BASE     (0)
-#define KW_KEY_BASE     (3)
-#define ks              (kw + KW_KEY_BASE)
-#define ts              (kw + KW_TWK_BASE)
-
 #ifdef SKEIN_DEBUG
 #define debug_save_tweak(ctx)       \
 {                                   \
drivers/staging/skein/skein_block.h +7 -0
index 9d40f4a..0fd4bfe 100644
@@ -7,6 +7,13 @@
 ** This algorithm and source code is released to the public domain.
 **
 ************************************************************************/
+
+#define BLK_BITS        (WCNT * 64) /* some useful definitions for code here */
+#define KW_TWK_BASE     (0)
+#define KW_KEY_BASE     (3)
+#define ks              (kw + KW_KEY_BASE)
+#define ts              (kw + KW_TWK_BASE)
+
 #ifndef _SKEIN_BLOCK_H_
 #define _SKEIN_BLOCK_H_
 
Signature · 1 line
2.5.0
#2 lore raw

The original code defined macros in the source code, making it harder to read. Moved them to the header file, as per the TODO file.

Updated the TODO file.

---
 drivers/staging/skein/TODO          | 1 -
 drivers/staging/skein/skein_block.c | 6 ------
 drivers/staging/skein/skein_block.h | 7 +++++++
 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/skein/TODO +0 -1
index cd3508d..e3de0c7 100644
@@ -1,6 +1,5 @@
 skein/threefish TODO
 
- - move macros into appropriate header files
  - add / pass test vectors
  - module support
 
drivers/staging/skein/skein_block.c +0 -6
index 45b4732..2120392 100644
@@ -26,12 +26,6 @@
 #define SKEIN_LOOP 001 /* default: unroll 256 and 512, but not 1024 */
 #endif
 
-#define BLK_BITS        (WCNT * 64) /* some useful definitions for code here */
-#define KW_TWK_BASE     (0)
-#define KW_KEY_BASE     (3)
-#define ks              (kw + KW_KEY_BASE)
-#define ts              (kw + KW_TWK_BASE)
-
 #ifdef SKEIN_DEBUG
 #define debug_save_tweak(ctx)       \
 {                                   \
drivers/staging/skein/skein_block.h +7 -0
index 9d40f4a..0fd4bfe 100644
@@ -7,6 +7,13 @@
 ** This algorithm and source code is released to the public domain.
 **
 ************************************************************************/
+
+#define BLK_BITS        (WCNT * 64) /* some useful definitions for code here */
+#define KW_TWK_BASE     (0)
+#define KW_KEY_BASE     (3)
+#define ks              (kw + KW_KEY_BASE)
+#define ts              (kw + KW_TWK_BASE)
+
 #ifndef _SKEIN_BLOCK_H_
 #define _SKEIN_BLOCK_H_
 
Signature · 1 line
2.5.0
#3 lore raw
Quoted 59 lines · Sanidhya Solanki

The original code defined macros in the source code, making it harder to read. Moved them to the header file, as per the TODO file.

Updated the TODO file.

---
 drivers/staging/skein/TODO          | 1 -
 drivers/staging/skein/skein_block.c | 6 ------
 drivers/staging/skein/skein_block.h | 7 +++++++
 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/skein/TODO +0 -1
index cd3508d..e3de0c7 100644
@@ -1,6 +1,5 @@
 skein/threefish TODO
 
- - move macros into appropriate header files
  - add / pass test vectors
  - module support
 
drivers/staging/skein/skein_block.c +0 -6
index 45b4732..2120392 100644
@@ -26,12 +26,6 @@
 #define SKEIN_LOOP 001 /* default: unroll 256 and 512, but not 1024 */
 #endif
 
-#define BLK_BITS        (WCNT * 64) /* some useful definitions for code here */
-#define KW_TWK_BASE     (0)
-#define KW_KEY_BASE     (3)
-#define ks              (kw + KW_KEY_BASE)
-#define ts              (kw + KW_TWK_BASE)
-
 #ifdef SKEIN_DEBUG
 #define debug_save_tweak(ctx)       \
 {                                   \
drivers/staging/skein/skein_block.h +7 -1
index 9d40f4a..0fd4bfe 100644
@@ -7,6 +7,13 @@
 ** This algorithm and source code is released to the public domain.
 **
 ************************************************************************/
+
+#define BLK_BITS        (WCNT * 64) /* some useful definitions for code here */
+#define KW_TWK_BASE     (0)
+#define KW_KEY_BASE     (3)
+#define ks              (kw + KW_KEY_BASE)
+#define ts              (kw + KW_TWK_BASE)
+
 #ifndef _SKEIN_BLOCK_H_
 #define _SKEIN_BLOCK_H_
 
--
Quoted 2 lines

2.5.0

I must admit you lost me here - what is this new version about? I suggest you used the [PATCH v#] convention along with a log of modifications from one version to another when sending new revisions. That way people know what to look for.

Thanks,
Mathieu

#4 lore raw
Quoted 4 lines · On Tue, 15 Dec 2015 07:55:15 -0700 Mathieu Poirier…

I must admit you lost me here - what is this new version about? I suggest you used the [PATCH v#] convention along with a log of modifications from one version to another when sending new revisions. That way people know what to look for.

It moves the macros that were not nested inside functions to the header file. See how all the "defines" in the code are moved to skein_block.h?

The patch just changes 7 lines. The change was on the TODO list, under the heading "Move macros to header files."

#5 lore raw
In reply to Sanidhya Solanki
Quoted 4 lines · Sanidhya Solanki

The original code defined macros in the source code, making it harder to read. Moved them to the header file, as per the TODO file.

Updated the TODO file.

I think the TODO file should not be updated now. There are still some macros in skein_block.c.

regards
sudip

maintainer
#6 lore raw
Quoted 8 lines · Sudip Mukherjee
Quoted 4 lines · Sanidhya Solanki

The original code defined macros in the source code, making it harder to read. Moved them to the header file, as per the TODO file.

Updated the TODO file.

I think the TODO file should not be updated now. There are still some macros in skein_block.c.

I agree, it can't be removed just yet, this patch needs to be redone before I can take it.

thanks,

greg k-h