public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-lua/lua-openssl/files/, dev-lua/lua-openssl/
@ 2015-10-06 21:24 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2015-10-06 21:24 UTC (permalink / raw
  To: gentoo-commits

commit:     6dc179438eec2c60cd8ba4e276741449d6e8caee
Author:     Jakub Jirutka <jakub <AT> jirutka <DOT> cz>
AuthorDate: Sat Oct  3 14:36:35 2015 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Oct  6 21:16:11 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6dc17943

dev-lua/lua-openssl: new package

 dev-lua/lua-openssl/Manifest                       |  1 +
 .../files/lua-openssl-0.4.1-Makefile.patch         | 86 ++++++++++++++++++++++
 dev-lua/lua-openssl/lua-openssl-0.4.1.ebuild       | 45 +++++++++++
 dev-lua/lua-openssl/metadata.xml                   | 16 ++++
 4 files changed, 148 insertions(+)

diff --git a/dev-lua/lua-openssl/Manifest b/dev-lua/lua-openssl/Manifest
new file mode 100644
index 0000000..1b7e99d
--- /dev/null
+++ b/dev-lua/lua-openssl/Manifest
@@ -0,0 +1 @@
+DIST lua-openssl-0.4.1.tar.gz 363525 SHA256 cce51e33b07b6450854d2e57e129b5f369b749a780d58c44719c834f198ee340 SHA512 c6deda86f77f9d6de1863611db9eb82506ea9789ec0425cb40cdb7d142d53aa633d53e1446b7eeb464636261385822d9cedc841bd35163931cc3758e7c3a308d WHIRLPOOL cbb5367bc7b716bcde731340339e7dafc3b4c5a542e1cf30e4fcf1d6c720e4f49676afe33f77860ab1da0a55b6dde434d0c312ae42c96765512494c6e8bbeb49

diff --git a/dev-lua/lua-openssl/files/lua-openssl-0.4.1-Makefile.patch b/dev-lua/lua-openssl/files/lua-openssl-0.4.1-Makefile.patch
new file mode 100644
index 0000000..bf5374e
--- /dev/null
+++ b/dev-lua/lua-openssl/files/lua-openssl-0.4.1-Makefile.patch
@@ -0,0 +1,86 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+
+Fix Makefile to respect system CFLAGS, LDFLAGS, and CC provided by environment.
+Allow to specify pkg-config command using variable, to be friendly with
+cross-compiling etc.
+
+diff --git a/Makefile b/Makefile
+index 195ef6b..375fb65 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2,9 +2,10 @@ T=openssl
+ 
+ PREFIX		?=/usr/local
+ LIB_OPTION	?= -shared 
++PKG_CONFIG	?= pkg-config
+ 
+ #Lua auto detect
+-LUA_VERSION ?= $(shell pkg-config luajit --print-provides)
++LUA_VERSION ?= $(shell $(PKG_CONFIG) luajit --print-provides)
+ ifeq ($(LUA_VERSION),)                         ############ Not use luajit
+ LUAV		?= $(shell lua -e "_,_,v=string.find(_VERSION,'Lua (.+)');print(v)")
+ LUA_CFLAGS	?= -I$(PREFIX)/include/lua$(LUAV)
+@@ -12,8 +13,8 @@ LUA_LIBS	?= -L$(PREFIX)/lib
+ LUA_LIBDIR	?= $(PREFIX)/lib/lua/$(LUAV)
+ else
+ LUAV		?= $(shell lua -e "_,_,v=string.find(_VERSION,'Lua (.+)');print(v)")
+-LUA_CFLAGS	?= $(shell pkg-config luajit --cflags)
+-LUA_LIBS	?= $(shell pkg-config luajit --libs)
++LUA_CFLAGS	?= $(shell $(PKG_CONFIG) luajit --cflags)
++LUA_LIBS	?= $(shell $(PKG_CONFIG) luajit --libs)
+ LUA_LIBDIR	?= $(PREFIX)/lib/lua/$(LUAV)
+ endif
+ 
+@@ -22,30 +23,30 @@ SYS := $(shell gcc -dumpmachine)
+ 
+ ifneq (, $(findstring linux, $(SYS)))
+ # Do linux things
+-LDFLAGS		    = -fPIC -lrt -ldl
+-OPENSSL_LIBS	?= $(shell pkg-config openssl --libs) 
+-OPENSSL_CFLAGS	?= $(shell pkg-config openssl --cflags)
+-CFLAGS		    = -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS)
++LDFLAGS		    += -fPIC -lrt -ldl
++OPENSSL_LIBS	?= $(shell $(PKG_CONFIG) openssl --libs) 
++OPENSSL_CFLAGS	?= $(shell $(PKG_CONFIG) openssl --cflags)
++CFLAGS		    += -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS)
+ endif
+ ifneq (, $(findstring apple, $(SYS)))
+ # Do darwin things
+-LDFLAGS		    = -fPIC -lrt -ldl
+-OPENSSL_LIBS	?= $(shell pkg-config openssl --libs) 
+-OPENSSL_CFLAGS	?= $(shell pkg-config openssl --cflags)
+-CFLAGS		    = -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS)
++LDFLAGS		    += -fPIC -lrt -ldl
++OPENSSL_LIBS	?= $(shell $(PKG_CONFIG) openssl --libs) 
++OPENSSL_CFLAGS	?= $(shell $(PKG_CONFIG) openssl --cflags)
++CFLAGS		    += -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS)
+ endif
+ ifneq (, $(findstring mingw, $(SYS)))
+ # Do mingw things
+ V			= $(shell lua -e "v=string.gsub('$(LUAV)','%.','');print(v)")
+-LDFLAGS		= -mwindows -lcrypt32 -lssl -lcrypto -lws2_32 $(PREFIX)/bin/lua$(V).dll 
++LDFLAGS		+= -mwindows -lcrypt32 -lssl -lcrypto -lws2_32 $(PREFIX)/bin/lua$(V).dll
+ LUA_CFLAGS	= -DLUA_LIB -DLUA_BUILD_AS_DLL -I$(PREFIX)/include/
+-CFLAGS		= $(OPENSSL_CFLAGS) $(LUA_CFLAGS)
++CFLAGS		+= $(OPENSSL_CFLAGS) $(LUA_CFLAGS)
+ endif
+ ifneq (, $(findstring cygwin, $(SYS)))
+ # Do cygwin things
+-OPENSSL_LIBS	?= $(shell pkg-config openssl --libs) 
+-OPENSSL_CFLAGS  ?= $(shell pkg-config openssl --cflags)
+-CFLAGS		= -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS)
++OPENSSL_LIBS	?= $(shell $(PKG_CONFIG) openssl --libs) 
++OPENSSL_CFLAGS  ?= $(shell $(PKG_CONFIG) openssl --cflags)
++CFLAGS		+= -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS)
+ endif
+ #custome config
+ ifeq (.config, $(wildcard .config))
+@@ -61,7 +62,7 @@ WARN_MOST	= -Wall -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnest
+ WARN		= -Wall -Wno-unused-value
+ WARN_MIN	= 
+ CFLAGS		+= $(WARN_MIN) -DPTHREADS 
+-CC= gcc -g $(CFLAGS) -Ideps
++CC			?= gcc -g $(CFLAGS) -Ideps
+ 
+ 
+ OBJS=src/asn1.o src/auxiliar.o src/bio.o src/cipher.o src/cms.o src/compat.o src/crl.o src/csr.o src/dh.o src/digest.o src/dsa.o \

diff --git a/dev-lua/lua-openssl/lua-openssl-0.4.1.ebuild b/dev-lua/lua-openssl/lua-openssl-0.4.1.ebuild
new file mode 100644
index 0000000..94b2ce6
--- /dev/null
+++ b/dev-lua/lua-openssl/lua-openssl-0.4.1.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="OpenSSL binding for Lua"
+HOMEPAGE="https://github.com/zhaozg/lua-openssl"
+SRC_URI="https://github.com/zhaozg/lua-openssl/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT openssl PHP-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="luajit"
+
+RDEPEND="
+	luajit? ( dev-lang/luajit:2 )
+	!luajit? ( >=dev-lang/lua-5.1:0 )
+	dev-libs/openssl:0"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig"
+
+src_prepare() {
+	epatch "${FILESDIR}/${P}-Makefile.patch"
+	use luajit && LUAV=luajit || LUAV=lua
+}
+
+src_compile() {
+	local pkgconfig=$(tc-getPKG_CONFIG)
+	emake \
+		CC="$(tc-getCC) \$(CFLAGS) -Ideps" \
+		PKG_CONFIG="$pkgconfig" \
+		LUA_CFLAGS="$($pkgconfig --cflags $LUAV)" \
+		LUA_LIBS="$($pkgconfig --libs $LUAV)" \
+		LUA_LIBDIR="$($pkgconfig --variable INSTALL_CMOD $LUAV)"
+}
+
+src_install() {
+	emake \
+		LUA_LIBDIR="${D}$($(tc-getPKG_CONFIG) --variable INSTALL_CMOD $LUAV)" \
+		install
+	einstalldocs
+}

diff --git a/dev-lua/lua-openssl/metadata.xml b/dev-lua/lua-openssl/metadata.xml
new file mode 100644
index 0000000..ea45693
--- /dev/null
+++ b/dev-lua/lua-openssl/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>proxy-maintainers</herd>
+	<maintainer>
+		<email>jakub@jirutka.cz</email>
+		<name>Jakub Jirutka</name>
+	</maintainer>
+	<use>
+		<flag name="luajit">Use <pkg>dev-lang/luajit</pkg> instead of
+			<pkg>dev-lang/lua</pkg></flag>
+	</use>
+	<upstream>
+		<remote-id type="github">zhaozg/lua-openssl</remote-id>
+	</upstream>
+</pkgmetadata>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-lua/lua-openssl/files/, dev-lua/lua-openssl/
@ 2018-10-06  7:11 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2018-10-06  7:11 UTC (permalink / raw
  To: gentoo-commits

commit:     762dee6c53a540946e0c270d7d585464086782e5
Author:     Matthias Hauber <crito <AT> fnordpipe <DOT> org>
AuthorDate: Mon Oct  1 21:31:27 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Oct  6 07:11:00 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=762dee6c

dev-lua/lua-openssl: fix libressl build

backports libressl compat from master branch and disables
  cms, sm2 and srp.
Additionally set dependency to libressl < 2.7.0 because there
are changes in the libressl-2.7 api that raises
a lot of incompatible pointer types.

Closes: https://bugs.gentoo.org/667390
Signed-off-by: Matthias Hauber <crito <AT> fnordpipe.org>
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/10039

 .../files/0001-fix-libressl-compat.patch           | 433 +++++++++++++++++++++
 dev-lua/lua-openssl/lua-openssl-0.7.3.ebuild       |   4 +-
 2 files changed, 436 insertions(+), 1 deletion(-)

diff --git a/dev-lua/lua-openssl/files/0001-fix-libressl-compat.patch b/dev-lua/lua-openssl/files/0001-fix-libressl-compat.patch
new file mode 100644
index 00000000000..19b0539c082
--- /dev/null
+++ b/dev-lua/lua-openssl/files/0001-fix-libressl-compat.patch
@@ -0,0 +1,433 @@
+From 44d5360d0caed1f4f364691f789fe825fcd17a3e Mon Sep 17 00:00:00 2001
+From: crito <crito@fnordpipe.org>
+Date: Mon, 1 Oct 2018 20:10:05 +0200
+Subject: [PATCH] fix libressl compat
+
+add conditions to build with libressl and add missing functions.
+backported from upstream repo.
+---
+ src/compat.c  | 11 ++++++++---
+ src/digest.c  |  2 +-
+ src/ec.c      |  2 +-
+ src/engine.c  | 10 +++++-----
+ src/lhash.c   |  7 ++++---
+ src/openssl.c | 12 ++++++++++--
+ src/ots.c     |  5 +++++
+ src/pkcs7.c   | 24 ++++++++++++------------
+ src/private.h |  7 ++++---
+ src/sm2.c     |  2 +-
+ src/srp.c     |  3 ++-
+ src/x509.c    |  2 +-
+ 12 files changed, 54 insertions(+), 33 deletions(-)
+
+diff --git a/src/compat.c b/src/compat.c
+index cc4cc21..cc45845 100644
+--- a/src/compat.c
++++ b/src/compat.c
+@@ -5,7 +5,7 @@
+ #include "openssl.h"
+ #include "private.h"
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ int BIO_up_ref(BIO *b)
+ {
+   CRYPTO_add(&b->references, 1, CRYPTO_LOCK_BIO);
+@@ -16,6 +16,11 @@ int X509_up_ref(X509 *x)
+   CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
+   return 1;
+ }
++int X509_CRL_up_ref(X509_CRL *x)
++{
++  int refs = CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509_CRL);
++  return (refs > 1) ? 1 : 0;
++}
+ int X509_STORE_up_ref(X509_STORE *s)
+ {
+   CRYPTO_add(&s->references, 1, CRYPTO_LOCK_X509_STORE);
+@@ -464,7 +469,7 @@ const ASN1_BIT_STRING *TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *a)
+   return a->failure_info;
+ }
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10002000L
++#if OPENSSL_VERSION_NUMBER < 0x10002000L || defined(LIBRESSL_VERSION_NUMBER)
+ int i2d_re_X509_tbs(X509 *x, unsigned char **pp)
+ {
+   x->cert_info->enc.modified = 1;
+@@ -527,4 +532,4 @@ unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx,
+   return ctx->imprint;
+ }
+ 
+-#endif /* < 1.1.0 */
+\ No newline at end of file
++#endif /* < 1.1.0 */
+diff --git a/src/digest.c b/src/digest.c
+index 02e8fe1..0dcf65b 100644
+--- a/src/digest.c
++++ b/src/digest.c
+@@ -468,7 +468,7 @@ restore md data
+ static LUA_FUNCTION(openssl_digest_ctx_data)
+ {
+   EVP_MD_CTX *ctx = CHECK_OBJECT(1, EVP_MD_CTX, "openssl.evp_digest_ctx");
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   if (lua_isnone(L, 2))
+   {
+     lua_pushlstring(L, ctx->md_data, ctx->digest->ctx_size);
+diff --git a/src/ec.c b/src/ec.c
+index f0d2b6b..5db32db 100644
+--- a/src/ec.c
++++ b/src/ec.c
+@@ -611,7 +611,7 @@ static int openssl_ecdsa_set_method(lua_State *L)
+ {
+   EC_KEY *ec = CHECK_OBJECT(1, EC_KEY, "openssl.ec_key");
+   ENGINE *e = CHECK_OBJECT(2, ENGINE, "openssl.engine");
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   const ECDSA_METHOD *m = ENGINE_get_ECDSA(e);
+   if (m) {
+     int r = ECDSA_set_method(ec, m);
+diff --git a/src/engine.c b/src/engine.c
+index 1a26d8b..f12ca53 100644
+--- a/src/engine.c
++++ b/src/engine.c
+@@ -14,7 +14,7 @@ enum
+ {
+   TYPE_RSA,
+   TYPE_DSA,
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   TYPE_ECDH,
+   TYPE_ECDSA,
+ #else
+@@ -24,7 +24,7 @@ enum
+   TYPE_RAND,
+   TYPE_CIPHERS,
+   TYPE_DIGESTS,
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   TYPE_STORE,
+ #else
+   TYPE_PKEY_METHODS,
+@@ -150,7 +150,7 @@ static int openssl_engine_register(lua_State*L)
+       else
+         ENGINE_register_DSA(eng);
+       break;
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     case TYPE_ECDH:
+       if (unregister)
+         ENGINE_unregister_ECDH(eng);
+@@ -183,7 +183,7 @@ static int openssl_engine_register(lua_State*L)
+       else
+         ENGINE_register_RAND(eng);
+       break;
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     case TYPE_STORE:
+       if (unregister)
+         ENGINE_unregister_STORE(eng);
+@@ -392,7 +392,7 @@ static int openssl_engine_set_default(lua_State*L)
+     case TYPE_DSA:
+       ret = ENGINE_set_default_DSA(eng);
+       break;
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     case TYPE_ECDH:
+       ret = ENGINE_set_default_ECDH(eng);
+       break;
+diff --git a/src/lhash.c b/src/lhash.c
+index 564bb52..8057efb 100644
+--- a/src/lhash.c
++++ b/src/lhash.c
+@@ -130,21 +130,22 @@ static void dump_value_doall_arg(CONF_VALUE *a, lua_State *L)
+   }
+ }
+ 
+-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
+ IMPLEMENT_LHASH_DOALL_ARG_CONST(CONF_VALUE, lua_State);
+ #elif OPENSSL_VERSION_NUMBER >= 0x10000002L
+ static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE, lua_State)
+ #endif
++#if !defined(LIBRESSL_VERSION_NUMBER)
+ #define LHM_lh_doall_arg(type, lh, fn, arg_type, arg) \
+   lh_doall_arg(CHECKED_LHASH_OF(type, lh), fn, CHECKED_PTR_OF(arg_type, arg))
+-
++#endif
+ 
+ static LUA_FUNCTION(openssl_lhash_parse)
+ {
+   LHASH* lhash = CHECK_OBJECT(1, LHASH, "openssl.lhash");
+ 
+   lua_newtable(L);
+-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
+   lh_CONF_VALUE_doall_lua_State(lhash, dump_value_doall_arg, L);
+ #elif OPENSSL_VERSION_NUMBER >= 0x10000002L
+   lh_CONF_VALUE_doall_arg(lhash, LHASH_DOALL_ARG_FN(dump_value), lua_State, L);
+diff --git a/src/openssl.c b/src/openssl.c
+index 994c22b..debea63 100644
+--- a/src/openssl.c
++++ b/src/openssl.c
+@@ -338,6 +338,9 @@ get FIPS mode
+ */
+ static int openssl_fips_mode(lua_State *L)
+ {
++#if defined(LIBRESSL_VERSION_NUMBER)
++  return 0;
++#else
+   int ret =0, on = 0;
+   if(lua_isnone(L, 1))
+   {
+@@ -353,6 +356,7 @@ static int openssl_fips_mode(lua_State *L)
+   else
+     ret = openssl_pushresult(L, ret);
+   return ret;
++#endif
+ }
+ 
+ #ifndef OPENSSL_NO_CRYPTO_MDEBUG
+@@ -405,7 +409,9 @@ void CRYPTO_thread_cleanup(void);
+ 
+ static int luaclose_openssl(lua_State *L)
+ {
++#if !defined(LIBRESSL_VERSION_NUMBER)
+   FIPS_mode_set(0);
++#endif
+ #if defined(OPENSSL_THREADS)
+   CRYPTO_thread_cleanup();
+ #endif
+@@ -421,7 +427,7 @@ static int luaclose_openssl(lua_State *L)
+   CRYPTO_cleanup_all_ex_data();
+ #ifndef OPENSSL_NO_CRYPTO_MDEBUG
+ #if !(defined(OPENSSL_NO_STDIO) || defined(OPENSSL_NO_FP_API))
+-#if OPENSSL_VERSION_NUMBER < 0x10101000L
++#if OPENSSL_VERSION_NUMBER < 0x10101000L || defined(LIBRESSL_VERSION_NUMBER)
+   CRYPTO_mem_leaks_fp(stderr);
+ #else
+   if(CRYPTO_mem_leaks_fp(stderr)!=1)
+@@ -541,13 +547,15 @@ LUALIB_API int luaopen_openssl(lua_State*L)
+   luaopen_dh(L);
+   lua_setfield(L, -2, "dh");
+ 
+-#if (OPENSSL_VERSION_NUMBER >= 0x10101007L) && !defined(OPENSSL_NO_SM2)
++#if (OPENSSL_VERSION_NUMBER >= 0x10101007L) && !defined(OPENSSL_NO_SM2) && !defined(LIBRESSL_VERSION_NUMBER)
+   luaopen_sm2(L);
+   lua_setfield(L, -2, "sm2");
+ #endif
+ 
++#if !defined(LIBRESSL_VERSION_NUMBER)
+   luaopen_srp(L);
+   lua_setfield(L, -2, "srp");
++#endif
+ 
+ #ifdef ENABLE_OPENSSL_GLOBAL
+   lua_pushvalue(L, -1);
+diff --git a/src/ots.c b/src/ots.c
+index 6b75946..762d17e 100644
+--- a/src/ots.c
++++ b/src/ots.c
+@@ -1265,7 +1265,12 @@ static LUA_FUNCTION(openssl_ts_resp_ctx_set_time_cb)
+   arg->cb_arg = luaL_ref(L, LUA_REGISTRYINDEX);
+ 
+   openssl_valueset(L, ctx, time_cb_key);
++#if defined(LIBRESSL_VERSION_NUMBER)
++  ctx->time_cb = openssl_time_cb;
++  ctx->time_cb_data = L;
++#else
+   TS_RESP_CTX_set_time_cb(ctx, openssl_time_cb, L);
++#endif
+   return 0;
+ }
+ 
+diff --git a/src/pkcs7.c b/src/pkcs7.c
+index f043c86..f0e5221 100644
+--- a/src/pkcs7.c
++++ b/src/pkcs7.c
+@@ -346,7 +346,7 @@ static int openssl_pkcs7_dataFinal(PKCS7 *p7, BIO *bio)
+     os = p7->d.signed_and_enveloped->enc_data->enc_data;
+     if (!os)
+     {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+       os = M_ASN1_OCTET_STRING_new();
+ #else
+       os = ASN1_OCTET_STRING_new();
+@@ -364,7 +364,7 @@ static int openssl_pkcs7_dataFinal(PKCS7 *p7, BIO *bio)
+     os = p7->d.enveloped->enc_data->enc_data;
+     if (!os)
+     {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+       os = M_ASN1_OCTET_STRING_new();
+ #else
+       os = ASN1_OCTET_STRING_new();
+@@ -383,7 +383,7 @@ static int openssl_pkcs7_dataFinal(PKCS7 *p7, BIO *bio)
+     /* If detached data then the content is excluded */
+     if (PKCS7_type_is_data(p7->d.sign->contents) && p7->detached)
+     {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+       M_ASN1_OCTET_STRING_free(os);
+ #else
+       ASN1_OCTET_STRING_free(os);
+@@ -398,7 +398,7 @@ static int openssl_pkcs7_dataFinal(PKCS7 *p7, BIO *bio)
+     /* If detached data then the content is excluded */
+     if (PKCS7_type_is_data(p7->d.digest->contents) && p7->detached)
+     {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+       M_ASN1_OCTET_STRING_free(os);
+ #else
+       ASN1_OCTET_STRING_free(os);
+@@ -474,7 +474,7 @@ static int openssl_pkcs7_dataFinal(PKCS7 *p7, BIO *bio)
+       goto err;
+     if (!EVP_DigestFinal_ex(mdc, md_data, &md_len))
+       goto err;
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     M_ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len);
+ #else
+     ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len);
+@@ -577,7 +577,7 @@ int PKCS7_signatureVerify_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si, X509 *x509,
+ 
+   md_type = OBJ_obj2nid(si->digest_alg->algorithm);
+   md = EVP_get_digestbynid(md_type);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   if (!md || !data || (hash && len != (size_t) md->ctx_size) )
+     goto err;
+ 
+@@ -1137,7 +1137,7 @@ static LUA_FUNCTION(openssl_pkcs7_sign_digest)
+     os = p7->d.signed_and_enveloped->enc_data->enc_data;
+     if (!os)
+     {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+       os = M_ASN1_OCTET_STRING_new();
+ #else
+       os = ASN1_OCTET_STRING_new();
+@@ -1155,7 +1155,7 @@ static LUA_FUNCTION(openssl_pkcs7_sign_digest)
+     os = p7->d.enveloped->enc_data->enc_data;
+     if (!os)
+     {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+       os = M_ASN1_OCTET_STRING_new();
+ #else
+       os = ASN1_OCTET_STRING_new();
+@@ -1174,7 +1174,7 @@ static LUA_FUNCTION(openssl_pkcs7_sign_digest)
+     /* If detached data then the content is excluded */
+     if (PKCS7_type_is_data(p7->d.sign->contents) && p7->detached)
+     {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+       M_ASN1_OCTET_STRING_free(os);
+ #else
+       ASN1_OCTET_STRING_free(os);
+@@ -1189,7 +1189,7 @@ static LUA_FUNCTION(openssl_pkcs7_sign_digest)
+     /* If detached data then the content is excluded */
+     if (PKCS7_type_is_data(p7->d.digest->contents) && p7->detached)
+     {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+       M_ASN1_OCTET_STRING_free(os);
+ #else
+       ASN1_OCTET_STRING_free(os);
+@@ -1217,7 +1217,7 @@ static LUA_FUNCTION(openssl_pkcs7_sign_digest)
+ 
+       if (hash)
+       {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+         if (l == (size_t) mdc->digest->ctx_size)
+         {
+           memcpy(mdc->md_data, data, l);
+@@ -1272,7 +1272,7 @@ static LUA_FUNCTION(openssl_pkcs7_sign_digest)
+     unsigned int md_len;
+     md = EVP_get_digestbynid(OBJ_obj2nid(p7->d.digest->md->algorithm));
+     EVP_DigestInit_ex(mdc, md, NULL);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     if (l == (size_t) mdc->digest->ctx_size)
+     {
+       memcpy(mdc->md_data, data, l);
+diff --git a/src/private.h b/src/private.h
+index 8e9d5b8..7140cae 100644
+--- a/src/private.h
++++ b/src/private.h
+@@ -46,9 +46,10 @@ extern "C" {
+   luaL_getmetatable(L,"openssl.bn");                    \
+   lua_setmetatable(L,-2)
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ int BIO_up_ref(BIO *b);
+ int X509_up_ref(X509 *x);
++int X509_CRL_up_ref(X509_CRL *x);
+ int X509_STORE_up_ref(X509_STORE *s);
+ int EVP_PKEY_up_ref(EVP_PKEY *pkey);
+ 
+@@ -124,12 +125,12 @@ STACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx,
+ unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx,
+     unsigned char *hexstr, long len);
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10002000L
++#if OPENSSL_VERSION_NUMBER < 0x10002000L || defined(LIBRESSL_VERSION_NUMBER)
+ int i2d_re_X509_tbs(X509 *x, unsigned char **pp);
++#endif
+ void X509_get0_signature(ASN1_BIT_STRING **psig, X509_ALGOR **palg,
+                          const X509 *x);
+ int X509_get_signature_nid(const X509 *x);
+-#endif
+ 
+ #endif
+ 
+diff --git a/src/sm2.c b/src/sm2.c
+index 0655888..1db3198 100644
+--- a/src/sm2.c
++++ b/src/sm2.c
+@@ -1,7 +1,7 @@
+ #include "openssl.h"
+ #include "private.h"
+ 
+-#if (OPENSSL_VERSION_NUMBER >= 0x10101007L) && !defined(OPENSSL_NO_SM2)
++#if (OPENSSL_VERSION_NUMBER >= 0x10101007L) && !defined(OPENSSL_NO_SM2) && !defined(LIBRESSL_VERSION_NUMBER)
+ 
+ #  include <openssl/sm2.h>
+ 
+diff --git a/src/srp.c b/src/srp.c
+index 85626b5..6fb0a50 100644
+--- a/src/srp.c
++++ b/src/srp.c
+@@ -1,6 +1,7 @@
+ #include "openssl.h"
+ #include "private.h"
+ 
++#if !defined(LIBRESSL_VERSION_NUMBER)
+ #include <openssl/srp.h>
+ #include <openssl/bn.h>
+ 
+@@ -198,4 +199,4 @@ int luaopen_srp(lua_State *L)
+   lua_settable(L, -3);
+   return 1;
+ }
+-
++#endif
+diff --git a/src/x509.c b/src/x509.c
+index 94e9982..07adb54 100644
+--- a/src/x509.c
++++ b/src/x509.c
+@@ -1196,7 +1196,7 @@ static int openssl_x509_extensions(lua_State* L)
+   else
+   {
+     STACK_OF(X509_EXTENSION) *others = (STACK_OF(X509_EXTENSION) *)openssl_sk_x509_extension_fromtable(L, 2);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+     sk_X509_EXTENSION_pop_free(self->cert_info->extensions, X509_EXTENSION_free);
+     self->cert_info->extensions = others;
+ #else
+-- 
+2.16.4
+

diff --git a/dev-lua/lua-openssl/lua-openssl-0.7.3.ebuild b/dev-lua/lua-openssl/lua-openssl-0.7.3.ebuild
index 7f3d2b11e5e..564518d7fb1 100644
--- a/dev-lua/lua-openssl/lua-openssl-0.7.3.ebuild
+++ b/dev-lua/lua-openssl/lua-openssl-0.7.3.ebuild
@@ -21,13 +21,15 @@ IUSE="libressl luajit"
 RDEPEND="
 	luajit? ( dev-lang/luajit:2 )
 	!luajit? ( >=dev-lang/lua-5.1:0 )
-	libressl? ( dev-libs/libressl:0= )
+	libressl? ( <dev-libs/libressl-2.7.0:0= )
 	!libressl? ( dev-libs/openssl:0=[-bindist] )
 	!dev-lua/luaossl
 	"
 DEPEND="${RDEPEND}
 	virtual/pkgconfig"
 
+PATCHES=("${FILESDIR}/0001-fix-libressl-compat.patch")
+
 src_unpack() {
 	unpack "${P}.tar.gz"
 	pushd "${WORKDIR}/${P}/deps" > /dev/null || die


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-06  7:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-06 21:24 [gentoo-commits] repo/gentoo:master commit in: dev-lua/lua-openssl/files/, dev-lua/lua-openssl/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2018-10-06  7:11 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox