LuaCrypto, a Lua binding for the OpenSSL crypto libraries

This commit is contained in:
pedro 2006-09-20 14:08:47 +00:00
parent e66c8096bf
commit d2acf35264
9 changed files with 163 additions and 0 deletions

View File

@ -0,0 +1,29 @@
# $OpenBSD: Makefile,v 1.1.1.1 2006/09/20 14:08:47 pedro Exp $
COMMENT= "Lua binding for the OpenSSL crypto libraries"
NOT_FOR_ARCHS= ${NO_SHARED_ARCHS}
DISTNAME= luacrypto-0.1.1
CATEGORIES= security
MASTER_SITES= http://luaforge.net/frs/download.php/1395/
HOMEPAGE= http://luacrypto.luaforge.net/
MAINTAINER= Pedro Martelletto <pedro@openbsd.org>
# MIT
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
USE_GMAKE= Yes
WANTLIB= crypto
REGRESS_TARGET= tests
CFLAGS+= -fPIC -DPIC
BUILD_DEPENDS= ::lang/lua
RUN_DEPENDS= ${BUILD_DEPENDS}
REGRESS_DEPENDS= ${BUILD_DEPENDS}
.include <bsd.port.mk>

View File

@ -0,0 +1,4 @@
MD5 (luacrypto-0.1.1.tar.gz) = 8311595e69bcaf39ea285b53ccc3b556
RMD160 (luacrypto-0.1.1.tar.gz) = 519c12633fa5918b0690e6bdac18fbb976c87025
SHA1 (luacrypto-0.1.1.tar.gz) = 295adeb343e0949005536ede880c8ed77619d30b
SIZE (luacrypto-0.1.1.tar.gz) = 11427

View File

@ -0,0 +1,38 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2006/09/20 14:08:47 pedro Exp $
--- Makefile.orig Sun Jan 22 21:16:35 2006
+++ Makefile Fri Aug 11 16:20:49 2006
@@ -18,7 +18,7 @@ SHELL = /bin/sh
MODULES = evp hmac
COMPAT_DIR = contrib/compat-5.1r4
COMPAT_O = $(if $(USE_COMPAT),$(outdir)/compat-5.1.o)
-CFLAGS = $(CRYPTOINC) $(LUAINC) $(if $(USE_COMPAT),-I$(COMPAT_DIR) -DUSE_COMPAT) -ansi -pedantic -Wall -O2
+CFLAGS += $(CRYPTOINC) $(LUAINC)
SOOBJS = $(outdir)/crypto/core.so $(foreach module,$(MODULES),$(outdir)/crypto/$(module)/core.so)
LCOBJS = $(outdir)/crypto.$(LUATYPE) $(foreach module,$(MODULES),$(outdir)/crypto/$(module).$(LUATYPE))
LDFLAGS = $(CRYPTOLIB)
@@ -76,8 +76,8 @@ mostlyclean:
define INSTALL_TEMPLATE
$(1)_install: $(outdir)/crypto/$(1)/core.so $(outdir)/crypto/$(1).$(LUATYPE)
$(INSTALL) -d $(LUA_CPATH)/crypto/$(1)
- $(INSTALL) -D $(outdir)/crypto/$(1)/core.so $(LUA_CPATH)/crypto/$(1)/core.so
- $(INSTALL) -D $(outdir)/crypto/$(1).$(LUATYPE) $(LUA_PATH)/crypto/$(1).$(LUATYPE)
+ $(INSTALL) $(outdir)/crypto/$(1)/core.so $(LUA_CPATH)/crypto/$(1)/core.so
+ $(INSTALL) $(outdir)/crypto/$(1).$(LUATYPE) $(LUA_PATH)/crypto/$(1).$(LUATYPE)
$(1)_uninstall:
-rm $(LUA_CPATH)/crypto/$(1)/core.so
@@ -93,11 +93,11 @@ $(foreach module,$(MODULES),$(eval $(cal
crypto_install:
$(INSTALL) -d $(LUA_PATH)/crypto/
$(INSTALL) -d $(LUA_CPATH)/crypto/
- $(INSTALL) -D $(outdir)/crypto/core.so $(LUA_CPATH)/crypto/core.so
- $(INSTALL) -D $(outdir)/crypto.$(LUATYPE) $(LUA_CPATH)/crypto.$(LUATYPE)
+ $(INSTALL) $(outdir)/crypto/core.so $(LUA_CPATH)/crypto/core.so
+ $(INSTALL) $(outdir)/crypto.$(LUATYPE) $(LUA_PATH)/crypto.$(LUATYPE)
compat_install:
- $(INSTALL) -D $(COMPAT_DIR)/compat-5.1.lua $(LUA_PATH)/compat-5.1.lua
+ $(INSTALL) $(COMPAT_DIR)/compat-5.1.lua $(LUA_PATH)/compat-5.1.lua
install: crypto_install $(foreach module,$(MODULES),$(module)_install) $(if $(INSTALL_COMPAT),compat_install) ;

View File

@ -0,0 +1,33 @@
$OpenBSD: patch-config,v 1.1.1.1 2006/09/20 14:08:47 pedro Exp $
--- config.orig Sun Jan 22 21:16:35 2006
+++ config Fri Aug 11 16:31:35 2006
@@ -3,9 +3,9 @@
# and the Lua include files (LUAINC) are required to compile and install. Set
# USE_COMPAT to 1 if you building for a Lua 5.0 environment, or leave it blank
# if you are building for a Lua 5.1 environment.
-LUA_PATH = /usr/share/lua
-LUA_CPATH = /usr/local/lua
-LUAINC = -I/usr/include/lua
+LUA_PATH = $(PREFIX)/share/lua/5.1
+LUA_CPATH = $(PREFIX)/lib/lua/5.1
+LUAINC = -I$(PREFIX)/include
# If your target environment is Lua 5.1, leave both of these COMPAT flags unset.
# If your target environment is Lua 5.0, the USE_COMPAT flag must be set to 1
@@ -19,8 +19,8 @@ INSTALL_COMPAT =
# The location of the Lua interpreter and Lua compiler are required to run the
# test suite and to generate precompiled Lua libraries instead of source Lua
# libraries for install.
-LUA = /usr/bin/lua
-LUAC = /usr/bin/luac
+LUA = $(PREFIX)/bin/lua
+LUAC = $(PREFIX)/bin/luac
# This provides the necessary flags for linking against your OpenSSL libcrypto
# installation. Change it to suit your system if necessary.
@@ -29,4 +29,4 @@ CRYPTOINC =
# Set this to lc to install the precompiled Lua libraries (compiled with luac),
# or to lua to install the source Lua libraries.
-LUATYPE = lc
+LUATYPE = lua

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-src_evp_c,v 1.1.1.1 2006/09/20 14:08:47 pedro Exp $
--- src/evp.c.orig Fri Aug 11 22:50:16 2006
+++ src/evp.c Fri Aug 11 22:51:05 2006
@@ -97,7 +97,7 @@ static int Ldigest(lua_State *L) /** di
EVP_MD_CTX *c = Pget(L, 1);
EVP_MD_CTX *d = NULL;
unsigned char digest[EVP_MAX_MD_SIZE];
- size_t written = 0;
+ unsigned int written = 0;
if (lua_isstring(L, 2))
{
@@ -149,7 +149,7 @@ static int Lfdigest(lua_State *L) /** d
const char *s = luaL_checkstring(L, 2);
const EVP_MD *type = EVP_get_digestbyname(type_name);
unsigned char digest[EVP_MAX_MD_SIZE];
- size_t written = 0;
+ unsigned int written = 0;
if (type == NULL) {
luaL_argerror(L, 1, "invalid digest type");

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-src_hmac_c,v 1.1.1.1 2006/09/20 14:08:47 pedro Exp $
--- src/hmac.c.orig Fri Aug 11 22:50:19 2006
+++ src/hmac.c Fri Aug 11 22:51:26 2006
@@ -92,7 +92,7 @@ static int Ldigest(lua_State *L) /** di
{
HMAC_CTX *c = Pget(L, 1);
unsigned char digest[EVP_MAX_MD_SIZE];
- size_t written = 0;
+ unsigned int written = 0;
if (lua_isstring(L, 2))
{
@@ -138,7 +138,7 @@ static int Lfdigest(lua_State *L) /** di
{
HMAC_CTX c;
unsigned char digest[EVP_MAX_MD_SIZE];
- size_t written = 0;
+ unsigned int written = 0;
const char *t = luaL_checkstring(L, 1);
const char *s = luaL_checkstring(L, 2);
const char *k = luaL_checkstring(L, 3);

View File

@ -0,0 +1,4 @@
LuaCrypto provides digest functions, such as MD5, SHA-1, and HMAC;
cipher functions, such as RC5 and Blowfish; public key crypto, such as
RSA and Diffie-Hellman; and some other assorted tools (i.e. random
number generation).

View File

@ -0,0 +1,7 @@
@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2006/09/20 14:08:47 pedro Exp $
lib/lua/5.1/crypto/
lib/lua/5.1/crypto/core.so
lib/lua/5.1/crypto/evp/
lib/lua/5.1/crypto/evp/core.so
lib/lua/5.1/crypto/hmac/
lib/lua/5.1/crypto/hmac/core.so

View File

@ -0,0 +1,6 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2006/09/20 14:08:47 pedro Exp $
%%SHARED%%
share/lua/5.1/crypto/
share/lua/5.1/crypto.lua
share/lua/5.1/crypto/evp.lua
share/lua/5.1/crypto/hmac.lua