Commit 197173db authored by Jason A. Donenfeld's avatar Jason A. Donenfeld
Browse files

treewide: use get_random_bytes() when possible



The prandom_bytes() function has been a deprecated inline wrapper around
get_random_bytes() for several releases now, and compiles down to the
exact same code. Replace the deprecated wrapper with a direct call to
the real function. This was done as a basic find and replace.

Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Reviewed-by: default avatarYury Norov <yury.norov@gmail.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu> # powerpc
Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
parent a251c17a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ static int __init crc_test_init(void)

			if (len <= offset)
				continue;
			prandom_bytes(data, len);
			get_random_bytes(data, len);
			len -= offset;

			crypto_shash_update(crct10dif_shash, data+offset, len);
+1 −1
Original line number Diff line number Diff line
@@ -539,7 +539,7 @@ static int blk_crypto_fallback_init(void)
	if (blk_crypto_fallback_inited)
		return 0;

	prandom_bytes(blank_key, BLK_CRYPTO_MAX_KEY_SIZE);
	get_random_bytes(blank_key, BLK_CRYPTO_MAX_KEY_SIZE);

	err = bioset_init(&crypto_bio_split, 64, 0, 0);
	if (err)
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ static void makedata(int disks)
	int i;

	for (i = 0; i < disks; i++) {
		prandom_bytes(page_address(data[i]), PAGE_SIZE);
		get_random_bytes(page_address(data[i]), PAGE_SIZE);
		dataptrs[i] = data[i];
		dataoffs[i] = 0;
	}
+1 −1
Original line number Diff line number Diff line
@@ -312,7 +312,7 @@ static unsigned long dmatest_random(void)
{
	unsigned long buf;

	prandom_bytes(&buf, sizeof(buf));
	get_random_bytes(&buf, sizeof(buf));
	return buf;
}

+1 −1
Original line number Diff line number Diff line
@@ -1393,7 +1393,7 @@ static int ns_do_read_error(struct nandsim *ns, int num)
	unsigned int page_no = ns->regs.row;

	if (ns_read_error(page_no)) {
		prandom_bytes(ns->buf.byte, num);
		get_random_bytes(ns->buf.byte, num);
		NS_WARN("simulating read error in page %u\n", page_no);
		return 1;
	}
Loading