Add GETENTROPY_MAX.
This commit is contained in:
parent
e2f0f4776c
commit
6197e05a23
2 changed files with 8 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, 2016, 2017 Jonas 'Sortie' Termansen.
|
||||
* Copyright (c) 2014, 2016, 2017, 2024 Jonas 'Sortie' Termansen.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -28,4 +28,8 @@
|
|||
#define IOV_MAX 1024
|
||||
#endif
|
||||
|
||||
#if __USE_SORTIX || 202405L <= __USE_POSIX
|
||||
#define GETENTROPY_MAX 256
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, 2015, 2016 Jonas 'Sortie' Termansen.
|
||||
* Copyright (c) 2014, 2015, 2016, 2024 Jonas 'Sortie' Termansen.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -24,6 +24,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <sortix/clock.h>
|
||||
#include <sortix/limits.h>
|
||||
|
||||
#include <sortix/kernel/addralloc.h>
|
||||
#include <sortix/kernel/copy.h>
|
||||
|
@ -162,7 +163,7 @@ namespace Sortix {
|
|||
|
||||
int sys_getentropy(void* user_buffer, size_t size)
|
||||
{
|
||||
unsigned char buffer[256];
|
||||
unsigned char buffer[GETENTROPY_MAX];
|
||||
if ( sizeof(buffer) < size )
|
||||
return errno = EIO, -1;
|
||||
arc4random_buf(buffer, size);
|
||||
|
|
Loading…
Reference in a new issue