2
0
Fork 0
mirror of https://git.sr.ht/~sircmpwn/mkproof synced 2024-06-02 06:26:12 +02:00
mkproof/src/random-arc4.c
William Casarin 4a8e70d38c Fix build on macos
I'm not sure entirely sure why arc4random_buf needs to be forward
declared, but these changes are needed for macos builds to work.

Fixed build errors:

include/random.h:4:1: error: unknown type name 'ssize_t'; did you mean 'size_t'?
ssize_t get_random_bytes(unsigned char *buf, size_t nbytes);
^~~~~~~

src/random-arc4.c:7:2: error: implicit declaration of function 'arc4random_buf'
is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        arc4random_buf(buf, nbytes);

Signed-off-by: William Casarin <jb55@jb55.com>
2020-12-24 14:22:11 -05:00

12 lines
188 B
C

#include <stdlib.h>
#include "random.h"
void arc4random_buf(void*, size_t);
ssize_t
get_random_bytes(unsigned char *buf, size_t nbytes)
{
arc4random_buf(buf, nbytes);
return nbytes;
}