lua-symmetric

Symmetric crypto for Lua
Log | Files | Refs

commit 690fc5b4e9908183854fc99c2f7e26b4959c371b
parent e0ebb7919aa1cbdd7953b0a445244080b20f6a52
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Thu, 24 Dec 2015 15:09:57 +0000

Fix building on OpenBSD

Diffstat:
Makefile.mess | 50+++++++++++++++++++++++++++-----------------------
rockspec/symmetric-1.0-2.rockspec | 34++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 23 deletions(-)

diff --git a/Makefile.mess b/Makefile.mess @@ -1,10 +1,3 @@ -# 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 - -# GCC whines without this. Assume everyone has strndup anyway -CFLAGS += -DHAVE_STRNDUP - # Let Luarocks point us to the right headers ifdef LUA_INCDIR CFLAGS += -I$(LUA_INCDIR) @@ -13,29 +6,40 @@ endif # OS detection uname := $(shell uname -s) -ifneq ($(uname),Darwin) +ifeq ($(uname),OpenBSD) LDFLAGS += -shared else - LDFLAGS += -bundle -undefined dynamic_lookup -endif + # 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 -CFLAGS += -Iinclude + # GCC whines without this. Assume everyone has strndup anyway + CFLAGS += -DHAVE_STRNDUP -SRCS += compat/safebfuns.c -SRCS += compat/arc4random/arc4random.c -SRCS += compat/sha/sha512.c + ifneq ($(uname),Darwin) + LDFLAGS += -shared + else + LDFLAGS += -bundle -undefined dynamic_lookup + endif -ifeq ($(uname),Linux) - SRCS += compat/getentropy/getentropy_linux.c - LDFLAGS += -lrt -endif + CFLAGS += -Iinclude -ifeq ($(uname),Darwin) - SRCS += compat/getentropy/getentropy_osx.c -endif + SRCS += compat/safebfuns.c + SRCS += compat/arc4random/arc4random.c + SRCS += compat/sha/sha512.c + + ifeq ($(uname),Linux) + SRCS += compat/getentropy/getentropy_linux.c + LDFLAGS += -lrt + endif + + ifeq ($(uname),Darwin) + SRCS += compat/getentropy/getentropy_osx.c + endif -ifeq ($(uname),FreeBSD) - SRCS += compat/getentropy/getentropy_freebsd.c + ifeq ($(uname),FreeBSD) + SRCS += compat/getentropy/getentropy_freebsd.c + endif endif compat/safebfuns.o: compat/safebfuns.c diff --git a/rockspec/symmetric-1.0-2.rockspec b/rockspec/symmetric-1.0-2.rockspec @@ -0,0 +1,34 @@ +package = "symmetric" +version = "1.0-2" + +source = { + url = "git://github.com/mikejsavage/lua-symmetric.git", + tag = "v1.0-2", +} + +description = { + summary = "A Lua wrapper for symmetric cryptography, using libsodium's secret box", + homepage = "http://github.com/mikejsavage/lua-symmetric", + license = "MIT", + maintainer = "Mike Savage", +} + +dependencies = { + "lua >= 5.1", +} + +build = { + type = "make", + + install_pass = false, + + build_variables = { + LUA_INCDIR = "$(LUA_INCDIR)", + }, + + install = { + lib = { + [ "symmetric" ] = "symmetric.so", + }, + }, +}