Skip to content

Commit

Permalink
getentropy() returns int and is restricted to 256 bytes on macOS, too.
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Heimes <christian@python.org>
  • Loading branch information
tiran committed Nov 22, 2016
1 parent 15c6a33 commit e7ddb5f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/_cffi_src/openssl/src/osrandom_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ static int osrandom_init(ENGINE *e) {
}

static int osrandom_rand_bytes(unsigned char *buffer, int size) {
Py_ssize_t len;
int res;
int len, res;
while (size > 0) {
/* OpenBSD restricts maximum buffer size to 256. */
/* OpenBSD and macOS restrict maximum buffer size to 256. */
len = size > 256 ? 256: size;
res = getentropy(buffer, len);
if (res < 0) {
Expand Down

0 comments on commit e7ddb5f

Please sign in to comment.