xref: /linux/arch/arm64/kernel/vdso/vgetrandom.c (revision 566ab427f827b0256d3e8ce0235d088e6a9c28bd)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <uapi/asm-generic/errno.h>
4 
5 typeof(__cvdso_getrandom) __kernel_getrandom;
6 
7 ssize_t __kernel_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state, size_t opaque_len)
8 {
9 	if (alternative_has_cap_likely(ARM64_HAS_FPSIMD))
10 		return __cvdso_getrandom(buffer, len, flags, opaque_state, opaque_len);
11 
12 	if (unlikely(opaque_len == ~0UL && !buffer && !len && !flags))
13 		return -ENOSYS;
14 	return getrandom_syscall(buffer, len, flags);
15 }
16