Browse Source

luasec: Update to 0.9

Signed-off-by: Rosen Penev <rosenp@gmail.com>
lilik-openwrt-22.03
Rosen Penev 5 years ago
parent
commit
71f82ad771
No known key found for this signature in database GPG Key ID: 36D31CFA845F0E3B
2 changed files with 3 additions and 93 deletions
  1. +3
    -4
      lang/luasec/Makefile
  2. +0
    -89
      lang/luasec/patches/040-openssl-deprecated.patch

+ 3
- 4
lang/luasec/Makefile View File

@ -8,13 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luasec
PKG_VERSION:=0.8.2
PKG_VERSION:=0.9
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/brunoos/luasec/tar.gz/luasec-$(PKG_VERSION)?
PKG_HASH:=591c35c425d8518bb7d343cde1500606266f76de913d3116c765f5f21ef24d6d
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_URL:=https://codeload.github.com/brunoos/luasec/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=6b6b94e8517bf6baf545fad29a2112f9ac7957ad85b4aae8e0727bec77d7a325
MAINTAINER:=W. Michael Petullo <mike@flyn.org>
PKG_LICENSE:=MIT


+ 0
- 89
lang/luasec/patches/040-openssl-deprecated.patch View File

@ -1,89 +0,0 @@
--- a/src/context.c
+++ b/src/context.c
@@ -17,6 +17,7 @@
#include <openssl/err.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
+#include <openssl/dh.h>
#include <lua.h>
#include <lauxlib.h>
@@ -819,7 +820,9 @@ LSEC_API int luaopen_ssl_context(lua_State *L)
luaL_newlib(L, meta_index);
lua_setfield(L, -2, "__index");
+#ifndef OPENSSL_NO_EC
lsec_load_curves(L);
+#endif
/* Return the module */
luaL_newlib(L, funcs);
--- a/src/ssl.c
+++ b/src/ssl.c
@@ -857,6 +857,7 @@ static luaL_Reg funcs[] = {
*/
LSEC_API int luaopen_ssl_core(lua_State *L)
{
+#if OPENSSL_VERSION_NUMBER<0x10100000L
/* Initialize SSL */
if (!SSL_library_init()) {
lua_pushstring(L, "unable to initialize SSL library");
@@ -864,6 +865,7 @@ LSEC_API int luaopen_ssl_core(lua_State *L)
}
OpenSSL_add_all_algorithms();
SSL_load_error_strings();
+#endif
#if defined(WITH_LUASOCKET)
/* Initialize internal library */
--- a/src/x509.c
+++ b/src/x509.c
@@ -42,6 +42,10 @@
#define LSEC_ASN1_STRING_data(x) ASN1_STRING_data(x)
#endif
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#define X509_get0_notBefore X509_get_notBefore
+#define X509_get0_notAfter X509_get_notAfter
+#endif
static const char* hex_tab = "0123456789abcdef";
@@ -174,7 +178,7 @@ static void push_asn1_string(lua_State* L, ASN1_STRING *string, int encode)
/**
* Return a human readable time.
*/
-static int push_asn1_time(lua_State *L, ASN1_UTCTIME *tm)
+static int push_asn1_time(lua_State *L, const ASN1_UTCTIME *tm)
{
char *tmp;
long size;
@@ -490,8 +494,8 @@ static int meth_valid_at(lua_State* L)
{
X509* cert = lsec_checkx509(L, 1);
time_t time = luaL_checkinteger(L, 2);
- lua_pushboolean(L, (X509_cmp_time(X509_get_notAfter(cert), &time) >= 0
- && X509_cmp_time(X509_get_notBefore(cert), &time) <= 0));
+ lua_pushboolean(L, (X509_cmp_time(X509_get0_notAfter(cert), &time) >= 0
+ && X509_cmp_time(X509_get0_notBefore(cert), &time) <= 0));
return 1;
}
@@ -519,7 +523,7 @@ static int meth_serial(lua_State *L)
static int meth_notbefore(lua_State *L)
{
X509* cert = lsec_checkx509(L, 1);
- return push_asn1_time(L, X509_get_notBefore(cert));
+ return push_asn1_time(L, X509_get0_notBefore(cert));
}
/**
@@ -528,7 +532,7 @@ static int meth_notbefore(lua_State *L)
static int meth_notafter(lua_State *L)
{
X509* cert = lsec_checkx509(L, 1);
- return push_asn1_time(L, X509_get_notAfter(cert));
+ return push_asn1_time(L, X509_get0_notAfter(cert));
}
/**

Loading…
Cancel
Save