Thread (20 messages) 20 messages, 6 authors, 2022-12-01

Re: [PATCH v10 1/4] random: add vgetrandom_alloc() syscall

From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: 2022-12-01 00:18:26
Also in: linux-crypto, linux-patches, lkml

On Wed, Nov 30, 2022 at 10:39:38PM +0000, David Laight wrote:
quoted
struct vgetrandom_state {
	union {
		struct {
			u8	batch[CHACHA_BLOCK_SIZE * 3 / 2];
			u32	key[CHACHA_KEY_SIZE / sizeof(u32)];
		};
		u8	batch_key[CHACHA_BLOCK_SIZE * 2];
	};
	unsigned long	generation;
	u8		pos;
	bool		in_use;
};

Plus some kernel doc which explains what this is about.
That structure looks horrid - especially for something shared
between entities.
The 'unsigned long' should be either u32 or u64.
This struct isn't shared. It's used only by user mode code.
There may well be other issues with that long, though.

Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help