lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140226110814.GC6989@quack.suse.cz>
Date:	Wed, 26 Feb 2014 12:08:14 +0100
From:	Jan Kara <jack@...e.cz>
To:	ZhangZhen <zhenzhang.zhang@...wei.com>
Cc:	jack@...e.cz, linux-ext4@...r.kernel.org
Subject: Re: [PATCH] ext2/3: use prandom_u32() instead of get_random_bytes()

On Wed 26-02-14 10:32:41, ZhangZhen wrote:
> Many of the uses of get_random_bytes() do not actually need
> cryptographically secure random numbers.  Replace those uses with a
> call to prandom_u32(), which is faster and which doesn't consume
> entropy from the /dev/random driver.
> 
> The commit dd1f723bf56bd96efc9d90e9e60dc511c79de48f has made that for
> ext4, and i did the same for ext2/3.
  Thanks. I've merged the patch to my tree.

								Honza

> 
> Signed-off-by: Zhang Zhen <zhenzhang.zhang@...wei.com>
> ---
>  fs/ext2/ialloc.c | 2 +-
>  fs/ext3/ialloc.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
> index 7cadd82..32f131a 100644
> --- a/fs/ext2/ialloc.c
> +++ b/fs/ext2/ialloc.c
> @@ -284,7 +284,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
>  		int best_ndir = inodes_per_group;
>  		int best_group = -1;
> 
> -		get_random_bytes(&group, sizeof(group));
> +		grp = prandom_u32();
>  		parent_group = (unsigned)group % ngroups;
>  		for (i = 0; i < ngroups; i++) {
>  			group = (parent_group + i) % ngroups;
> diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
> index 082afd7..60e63e3 100644
> --- a/fs/ext3/ialloc.c
> +++ b/fs/ext3/ialloc.c
> @@ -215,7 +215,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
>  		int best_ndir = inodes_per_group;
>  		int best_group = -1;
> 
> -		get_random_bytes(&group, sizeof(group));
> +		grp = prandom_u32();
>  		parent_group = (unsigned)group % ngroups;
>  		for (i = 0; i < ngroups; i++) {
>  			group = (parent_group + i) % ngroups;
> -- 
> 1.8.1.4
> 
> 
> .
> 
> 
> 
> 
-- 
Jan Kara <jack@...e.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ