public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jake Edge <jake@lwn.net>
To: Anton Saraev <antonysaraev@gmail.com>
Cc: gregkh@linuxfoundation.org, jason@lakedaemon.net,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 02/06] staging: crypto: skein: rename camelcase vars
Date: Mon, 19 May 2014 08:40:28 -0600	[thread overview]
Message-ID: <20140519084028.1527b066@chukar.edge2.net> (raw)
In-Reply-To: <dad2a43d54d03ba2b4fae9136331df060c48154c.1399675444.git.antonysaraev@gmail.com>

On Mon, 19 May 2014 12:09:55 +0400 Anton Saraev wrote:

>  struct skein_ctx_hdr {
> -	size_t  hashBitLen;		/* size of hash result, in bits */
> -	size_t  bCnt;			/* current byte count in buffer b[] */
> -	u64  T[SKEIN_MODIFIER_WORDS];	/* tweak: T[0]=byte cnt, T[1]=flags */
> +	size_t hash_bit_len;		/* size of hash result, in bits */
> +	size_t b_cnt;			/* current byte count in buffer b[] */
> +	u64 T[SKEIN_MODIFIER_WORDS];	/* tweak: T[0]=byte cnt, T[1]=flags */

seems like 'T' should be lower case ... maybe renamed too (tweak?)?

>  struct skein_256_ctx { /* 256-bit Skein hash context structure */
>  	struct skein_ctx_hdr h;		/* common header context variables */
> -	u64  X[SKEIN_256_STATE_WORDS];	/* chaining variables */
> -	u8  b[SKEIN_256_BLOCK_BYTES];	/* partial block buf (8-byte aligned) */
> +	u64 X[SKEIN_256_STATE_WORDS];	/* chaining variables */
> +	u8 b[SKEIN_256_BLOCK_BYTES];	/* partial block buf (8-byte aligned) */
>  };
>  
>  struct skein_512_ctx { /* 512-bit Skein hash context structure */
>  	struct skein_ctx_hdr h;		/* common header context variables */
> -	u64  X[SKEIN_512_STATE_WORDS];	/* chaining variables */
> -	u8  b[SKEIN_512_BLOCK_BYTES];	/* partial block buf (8-byte aligned) */
> +	u64 X[SKEIN_512_STATE_WORDS];	/* chaining variables */
> +	u8 b[SKEIN_512_BLOCK_BYTES];	/* partial block buf (8-byte aligned) */
>  };
>  
>  struct skein1024_ctx { /* 1024-bit Skein hash context structure */
>  	struct skein_ctx_hdr h;		/* common header context variables */
> -	u64  X[SKEIN1024_STATE_WORDS];	/* chaining variables */
> -	u8  b[SKEIN1024_BLOCK_BYTES];	/* partial block buf (8-byte aligned) */
> +	u64 X[SKEIN1024_STATE_WORDS];	/* chaining variables */
> +	u8 b[SKEIN1024_BLOCK_BYTES];	/* partial block buf (8-byte aligned) */

the X arrays here should be renamed too, I suspect ...

> @@ -99,8 +99,8 @@ enum skein_size {
>   * structures as well.
>   */
>  struct skein_ctx {
> -	u64 skeinSize;
> -	u64  XSave[SKEIN_MAX_STATE_WORDS];   /* save area for state variables */
> +	u64 skein_size;
> +	u64 X_save[SKEIN_MAX_STATE_WORDS];   /* save area for state variables */

why not x_save?

> -int skein_init(struct skein_ctx *ctx, size_t hashBitLen)
> +int skein_init(struct skein_ctx *ctx, size_t hash_bit_len)
>  {
>  	int ret = SKEIN_FAIL;
> -	size_t Xlen = 0;
> +	size_t X_len = 0;
>  	u64 *X = NULL;

maybe I am missing something, but why not 'x' and 'x_len' ?

> -int skein_mac_init(struct skein_ctx *ctx, const u8 *key, size_t keyLen,
> -		   size_t hashBitLen)
> +int skein_mac_init(struct skein_ctx *ctx, const u8 *key, size_t key_len,
> +		   size_t hash_bit_len)
>  {
>  	int ret = SKEIN_FAIL;
>  	u64 *X = NULL;
> -	size_t Xlen = 0;
> -	u64 treeInfo = SKEIN_CFG_TREE_INFO_SEQUENTIAL;
> +	size_t X_len = 0;
> +	u64 tree_info = SKEIN_CFG_TREE_INFO_SEQUENTIAL;

and the same here?

>  void skein_reset(struct skein_ctx *ctx)
>  {
> -	size_t Xlen = 0;
> +	size_t X_len = 0;
>  	u64 *X = NULL;

here too ...

> -void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blkPtr,
> -			     size_t blkCnt, size_t byteCntAdd)
> +void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blk_ptr,
> +			     size_t blk_cnt, size_t byte_cnt_add)
>  	{ /* do it in C */
>  	enum {
>  		WCNT = SKEIN_256_STATE_WORDS
> @@ -66,10 +66,11 @@ void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blkPtr,
>  	u64  X0, X1, X2, X3; /* local copy of context vars, for speed */
>  	u64  w[WCNT]; /* local copy of input block */
>  #ifdef SKEIN_DEBUG
> -	const u64 *Xptr[4]; /* use for debugging (help cc put Xn in regs) */
> -	Xptr[0] = &X0;  Xptr[1] = &X1;  Xptr[2] = &X2;  Xptr[3] = &X3;
> +	const u64 *X_ptr[4]; /* use for debugging (help cc put Xn in regs) */
> +
> +	X_ptr[0] = &X0;  X_ptr[1] = &X1;  X_ptr[2] = &X2;  X_ptr[3] = &X3;

bunch of Xs in through here too ... is X special somehow?  maybe so
because it is used in all that loop-unrolling gunk?

jake

-- 
Jake Edge - LWN - jake@lwn.net - http://lwn.net

  parent reply	other threads:[~2014-05-19 14:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-19  8:09 [PATCH v2 00/06] staging: crypto: skein: fixing style issues Anton Saraev
2014-05-19  8:09 ` [PATCH v2 01/06] staging: crypto: skein: rename camelcase functions Anton Saraev
2014-05-19  8:09 ` [PATCH v2 02/06] staging: crypto: skein: rename camelcase vars Anton Saraev
2014-05-19  9:02   ` Dan Carpenter
2014-05-19 14:40   ` Jake Edge [this message]
2014-05-19 19:21     ` Dan Carpenter
2014-05-19 19:44       ` Jake Edge
2014-05-19 19:55         ` Dan Carpenter
2014-05-19  8:09 ` [PATCH v2 03/06] staging: crypto: skein: rename skein1024_ctx to skein_1024_ctx Anton Saraev
2014-05-19  8:09 ` [PATCH v2 04/06] staging: crypto: skein: rename enums Anton Saraev
2014-05-19  8:09 ` [PATCH v2 05/06] staging: crypto: skein: rename macros Anton Saraev
2014-05-19  9:08   ` Dan Carpenter
2014-05-19 14:04     ` Jason Cooper
2014-05-19  8:09 ` [PATCH v2 06/06] staging: crypto: skein: rename files Anton Saraev
2014-05-19 13:29   ` Jake Edge
2014-05-19 14:05     ` Jason Cooper
2014-05-19 13:45   ` Jake Edge
2014-05-19 22:22     ` Greg KH
2014-05-19  8:53 ` [PATCH v2 00/06] staging: crypto: skein: fixing style issues Dan Carpenter
2014-05-19 14:11   ` Jason Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140519084028.1527b066@chukar.edge2.net \
    --to=jake@lwn.net \
    --cc=antonysaraev@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox