security/lua-argon2: New port

Lua C binding for the Argon2 password hashing function. Compatible with Lua 5.x and LuaJIT.

PR:		268039
Reported by:	Manuel Wiesinger <manuel at mmap.at>
This commit is contained in:
Vanilla I. Shu 2023-01-09 11:19:20 +08:00
parent e840646b65
commit 0eb692f7d0
6 changed files with 64 additions and 0 deletions

View File

@ -333,6 +333,7 @@
SUBDIR += linux-c7-trousers
SUBDIR += local-php-security-checker
SUBDIR += logcheck
SUBDIR += lua-argon2
SUBDIR += lua-bcrypt
SUBDIR += luasec
SUBDIR += lxqt-openssh-askpass

View File

@ -0,0 +1,26 @@
PORTNAME= argon2
DISTVERSION= 3.0.1
CATEGORIES= security
PKGNAMEPREFIX= ${LUA_PKGNAMEPREFIX}
MAINTAINER= mdw@FreeBSD.org
COMMENT= Lua C binding for the Argon2 password hashing function
WWW= https://github.com/thibaultcha/lua-argon2
LICENSE= MIT
LIB_DEPENDS+= libargon2.so:security/libargon2
USES= compiler:c11 lua:module
USE_GITHUB= yes
GH_ACCOUNT= thibaultcha
GH_PROJECT= lua-argon2
PLIST_FILES= ${LUA_MODLIBDIR}/argon2.so
do-install:
@${MKDIR} ${STAGEDIR}${LUA_MODLIBDIR}
${INSTALL_LIB} ${WRKSRC}/argon2.so ${STAGEDIR}${LUA_MODLIBDIR}
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
TIMESTAMP = 1664113729
SHA256 (thibaultcha-lua-argon2-3.0.1_GH0.tar.gz) = d109c6e8e93cd9e27e8738567a998a2763d56252cc1abca1f0f2ac36ef8ce0f4
SIZE (thibaultcha-lua-argon2-3.0.1_GH0.tar.gz) = 13836

View File

@ -0,0 +1,22 @@
--- Makefile.orig 2018-06-11 02:10:23 UTC
+++ Makefile
@@ -1,8 +1,7 @@
LIB_NAME = argon2
-CC ?= gcc
-LDFLAGS ?= -shared
-CFLAGS ?= -O2 -fPIC -ansi -Wall -Werror -Wpedantic
+LDFLAGS += -shared
+CFLAGS += -fPIC -std=c11 -Wall -Wpedantic
PREFIX ?= /usr/local
ARGON2_INCDIR ?= $(PREFIX)/include
@@ -17,7 +16,7 @@ BUILD_LDFLAGS = -L$(ARGON2_LIBDIR) -largon2
all: $(LIB_NAME).so
$(LIB_NAME).so: $(LIB_NAME).o
- $(CC) $(LDFLAGS) -o $@ $< $(BUILD_LDFLAGS)
+ $(CC) $(LDFLAGS) -o $@ $(LIB_NAME).o $(BUILD_LDFLAGS)
$(LIB_NAME).o: src/$(LIB_NAME).c
$(CC) $(CFLAGS) -c $< -o $@ $(BUILD_CFLAGS)

View File

@ -0,0 +1,10 @@
--- src/argon2.c.orig 2022-09-25 20:11:00 UTC
+++ src/argon2.c
@@ -486,7 +486,7 @@ static const luaL_Reg largon2[] = { { "verify", largon
{ NULL, NULL } };
-int
+LUALIB_API int
luaopen_argon2(lua_State *L)
{
lua_newtable(L);

View File

@ -0,0 +1,2 @@
Lua C binding for the Argon2 password hashing function. Compatible with Lua 5.x
and LuaJIT.