include/vdso/getrandom.h

Source file repositories/reference/linux-study-clean/include/vdso/getrandom.h

File Facts

System
Linux kernel
Corpus path
include/vdso/getrandom.h
Extension
.h
Size
2468 bytes
Lines
75
Domain
Repository Root And Misc
Bucket
include
Inferred role
Repository Root And Misc: implementation source
Status
source implementation candidate

Why This File Exists

Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.

Dependency Surface

Detected Declarations

Annotated Snippet

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];
	};
	u64			generation;
	u8			pos;
	bool 			in_use;
};

/**
 * __arch_chacha20_blocks_nostack - Generate ChaCha20 stream without using the stack.
 * @dst_bytes:	Destination buffer to hold @nblocks * 64 bytes of output.
 * @key:	32-byte input key.
 * @counter:	8-byte counter, read on input and updated on return.
 * @nblocks:	Number of blocks to generate.
 *
 * Generates a given positive number of blocks of ChaCha20 output with nonce=0, and does not write
 * to any stack or memory outside of the parameters passed to it, in order to mitigate stack data
 * leaking into forked child processes.
 */
extern void __arch_chacha20_blocks_nostack(u8 *dst_bytes, const u32 *key, u32 *counter, size_t nblocks);

/**
 * __vdso_getrandom - Architecture-specific vDSO implementation of getrandom() syscall.
 * @buffer:		Passed to __cvdso_getrandom().
 * @len:		Passed to __cvdso_getrandom().
 * @flags:		Passed to __cvdso_getrandom().
 * @opaque_state:	Passed to __cvdso_getrandom().
 * @opaque_len:		Passed to __cvdso_getrandom();
 *
 * This function is implemented by making a single call to to __cvdso_getrandom(), whose
 * documentation may be consulted for more information.
 *
 * Returns:	The return value of __cvdso_getrandom().
 */
extern ssize_t __vdso_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state, size_t opaque_len);

#endif /* _VDSO_GETRANDOM_H */

Annotation

Implementation Notes