2
0
mirror of https://git.sr.ht/~sircmpwn/mkproof synced 2024-11-23 13:12:00 +01:00

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>
This commit is contained in:
William Casarin 2020-12-24 11:07:35 -08:00 committed by Drew DeVault
parent 738f584ff6
commit 4a8e70d38c
2 changed files with 4 additions and 0 deletions

@ -1,6 +1,8 @@
#ifndef RANDOM_H
#define RANDOM_H
#include <sys/types.h>
ssize_t get_random_bytes(unsigned char *buf, size_t nbytes);
#endif

@ -1,6 +1,8 @@
#include <stdlib.h>
#include "random.h"
void arc4random_buf(void*, size_t);
ssize_t
get_random_bytes(unsigned char *buf, size_t nbytes)
{