archrandom.h 615 B

12345678910111213141516171819202122232425
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_UM_ARCHRANDOM_H__
  3. #define __ASM_UM_ARCHRANDOM_H__
  4. #include <linux/types.h>
  5. /* This is from <os.h>, but better not to #include that in a global header here. */
  6. ssize_t os_getrandom(void *buf, size_t len, unsigned int flags);
  7. static inline size_t __must_check arch_get_random_longs(unsigned long *v, size_t max_longs)
  8. {
  9. ssize_t ret;
  10. ret = os_getrandom(v, max_longs * sizeof(*v), 0);
  11. if (ret < 0)
  12. return 0;
  13. return ret / sizeof(*v);
  14. }
  15. static inline size_t __must_check arch_get_random_seed_longs(unsigned long *v, size_t max_longs)
  16. {
  17. return 0;
  18. }
  19. #endif