lua-arc4random

Cryptographically secure PRNG for Lua
Log | Files | Refs | README

commit 4a1a4da102455c62bca99b5148da3a3742787789
parent 81d6ec940b1b50af71ffdab807d072ae675ff6f6
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun, 12 Jul 2020 13:03:04 +0300

Merge branch 'master' of github.com:mikejsavage/lua-arc4random

Diffstat:
MMakefile.mess | 9++++++++-
Msrc/main.c | 2+-
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Makefile.mess b/Makefile.mess @@ -12,7 +12,9 @@ else LDFLAGS += -bundle -undefined dynamic_lookup endif -ifneq ($(uname),OpenBSD) +ifeq ($(uname),OpenBSD) +else ifeq ($(uname),NetBSD) +else # This is more or less what libressl does # See http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/lib/libssl/src/crypto/mem_clr.c?rev=1.4&content-type=text/x-cvsweb-markup CFLAGS += -DOPENSSL_cleanse=explicit_bzero @@ -32,6 +34,11 @@ ifneq ($(uname),OpenBSD) LDFLAGS += -lrt endif + ifeq ($(uname),SunOS) + SRCS += compat/sha/sha512.c + SRCS += compat/getentropy/getentropy_solaris.c + endif + ifeq ($(uname),Darwin) SRCS += compat/getentropy/getentropy_osx.c endif diff --git a/src/main.c b/src/main.c @@ -26,7 +26,7 @@ #define luaL_newlib( L, l ) ( lua_newtable( L ), luaL_register( L, NULL, l ) ) #endif -#define LUAINT_MAX ( sizeof( lua_Integer ) == 32 ? INT32_MAX : INT64_MAX ) +#define LUAINT_MAX ( sizeof( lua_Integer ) == 4 ? INT32_MAX : INT64_MAX ) static int luaarc4_random( lua_State * const L ) { if( lua_gettop( L ) == 0 ) {