Skip to content

Commit e7ddb5f

Browse files
committed
getentropy() returns int and is restricted to 256 bytes on macOS, too.
Signed-off-by: Christian Heimes <[email protected]>
1 parent 15c6a33 commit e7ddb5f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/_cffi_src/openssl/src/osrandom_engine.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,9 @@ static int osrandom_init(ENGINE *e) {
8181
}
8282

8383
static int osrandom_rand_bytes(unsigned char *buffer, int size) {
84-
Py_ssize_t len;
85-
int res;
84+
int len, res;
8685
while (size > 0) {
87-
/* OpenBSD restricts maximum buffer size to 256. */
86+
/* OpenBSD and macOS restrict maximum buffer size to 256. */
8887
len = size > 256 ? 256: size;
8988
res = getentropy(buffer, len);
9089
if (res < 0) {

0 commit comments

Comments
 (0)