Re: [PATCH v2 09/12] staging: ks7010: replace MichaelBlockFunction macro with inline function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 23, 2018 at 02:05:17PM +0100, Sergio Paracuellos wrote:
> This commit replaces MichaelBlockFunction macro with similar 
> inline function renaming it to michael_block.
> 
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx>
> ---
>  drivers/staging/ks7010/michael_mic.c | 30 +++++++++++++++---------------
>  1 file changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
> index 6829cb5..07913d0 100644
> --- a/drivers/staging/ks7010/michael_mic.c
> +++ b/drivers/staging/ks7010/michael_mic.c
> @@ -48,17 +48,17 @@ static void michael_init(struct michael_mic_t *mic, uint8_t *key)
>  	michael_clear(mic);
>  }
>  
> -#define MichaelBlockFunction(L, R)				\
> -do {								\
> -	R ^= rol32(L, 17);					\
> -	L += R;							\
> -	R ^= ((L & 0xff00ff00) >> 8) | ((L & 0x00ff00ff) << 8);	\
> -	L += R;							\
> -	R ^= rol32(L, 3);					\
> -	L += R;							\
> -	R ^= ror32(L, 2);					\
> -	L += R;							\
> -} while (0)
> +static inline void michael_block(u32 *l, u32 *r)
> +{
> +	*r ^= rol32(*l, 17);
> +	*l += *r;
> +	*r ^= ((*l & 0xff00ff00) >> 8) | ((*l & 0x00ff00ff) << 8);
> +	*l += *r;
> +	*r ^= rol32(*l, 3);
> +	*l += *r;
> +	*r ^= ror32(*l, 2);
> +	*l += *r;
> +}

What does this function really do?  Are you sure it's not just doing a
horrible implementation of bitrev32() or something like it?

It looks odd to me, is this some crypto hashing function?

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux