Re: [PATCH 1/3] target/iscsi: Remove chap_set_random()

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

 



On Mon, 2013-03-04 at 13:52 -0800, Andy Grover wrote:
> The result from get_random_bytes should already be random, so further
> manipulation and mixing should not be needed.
> 
> Signed-off-by: Andy Grover <agrover@xxxxxxxxxx>
> ---

Looks fine.

Applying to for-next queue.

>  drivers/target/iscsi/iscsi_target_auth.c |   28 +---------------------------
>  1 files changed, 1 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c
> index db0cf7c..b104c49 100644
> --- a/drivers/target/iscsi/iscsi_target_auth.c
> +++ b/drivers/target/iscsi/iscsi_target_auth.c
> @@ -49,32 +49,6 @@ static void chap_binaryhex_to_asciihex(char *dst, char *src, int src_len)
>  	}
>  }
>  
> -static void chap_set_random(char *data, int length)
> -{
> -	long r;
> -	unsigned n;
> -
> -	while (length > 0) {
> -		get_random_bytes(&r, sizeof(long));
> -		r = r ^ (r >> 8);
> -		r = r ^ (r >> 4);
> -		n = r & 0x7;
> -
> -		get_random_bytes(&r, sizeof(long));
> -		r = r ^ (r >> 8);
> -		r = r ^ (r >> 5);
> -		n = (n << 3) | (r & 0x7);
> -
> -		get_random_bytes(&r, sizeof(long));
> -		r = r ^ (r >> 8);
> -		r = r ^ (r >> 5);
> -		n = (n << 2) | (r & 0x3);
> -
> -		*data++ = n;
> -		length--;
> -	}
> -}
> -
>  static void chap_gen_challenge(
>  	struct iscsi_conn *conn,
>  	int caller,
> @@ -86,7 +60,7 @@ static void chap_gen_challenge(
>  
>  	memset(challenge_asciihex, 0, CHAP_CHALLENGE_LENGTH * 2 + 1);
>  
> -	chap_set_random(chap->challenge, CHAP_CHALLENGE_LENGTH);
> +	get_random_bytes(chap->challenge, CHAP_CHALLENGE_LENGTH);
>  	chap_binaryhex_to_asciihex(challenge_asciihex, chap->challenge,
>  				CHAP_CHALLENGE_LENGTH);
>  	/*


--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux