diff options
-rw-r--r-- | .gitignore | 10 | ||||
-rw-r--r-- | debian/changelog | 70 | ||||
-rwxr-xr-x | regress/104-interposition-discarded.lua | 12 | ||||
-rwxr-xr-x[-rw-r--r--] | regress/53-csr-extensions.lua | 0 | ||||
-rw-r--r-- | src/GNUmakefile | 2 | ||||
-rw-r--r-- | src/openssl.c | 25 |
6 files changed, 101 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7708b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +*.o +*.so +*.rockspec +*.rock +config.h +doc/*.aux +doc/*.idx +doc/*.log +doc/*.toc +doc/*.out diff --git a/debian/changelog b/debian/changelog index 5f5981a..37f86a3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,73 @@ +liblua-openssl (20170903-0) unstable; urgency=low + + * Fix pkey.new failing when generating RSA keys + * Fix loading C modules clearing interposed fields + * Fix building compat-5.3.o + + -- Daurnimator <quae@daurnimator.com> Sun, 03 Sep 2017 22:39:20 +1000 + +liblua-openssl (20170901-0) unstable; urgency=low + + * New openssl.ocsp.basic and openssl.ocsp.response modules + * Add x509:getOCSP() + * Add x509:getSignatureName() (#79) + * Add crl:verify(publickey) + * Add pkcs12.parse(bag[, passphrase]) + * Add context:setStore(store) and context:getStore() + * Add context:setParam(params) and context:getParam() + * Add context:setCurvesList(string [, ...]) + * Add context:setAlpnSelect(cb) + * Add context:setTLSextStatusType(type) and context:getTLSextStatusType() + * Add ssl:getVerifyResult() (#75) + * Add ssl:setContext(context) (#84) + * Add ssl:setVerify([mode][, depth]) and ssl:getVerify() (#84) + * Add ssl:setCertificate(crt), ssl:setPrivateKey(key), ssl:setCurvesList(string [, ...]) (#84) + * Add ssl:setTLSextStatusType(type) and ssl:getTLSextStatusType() + * Add ssl:setTLSextStatusOCSPResp(or) and ssl:getTLSextStatusOCSPResp() + * Use lua-compat-5.3 (fixes LuaJIT header file compatibility) (#94) + * Add generator field to replace exp when generating a DH key + * Move away from interfaces deprecated in OpenSSL 1.1.0 + +-- Daurnimator <quae@daurnimator.com> Fri, 01 Sep 2017 14:20:00 +1000 + +liblua-openssl (20161214-0) unstable; urgency=low + + * Refactor of bignum operations, fixes bn:sqr() + + -- William Ahern <william@25thandClement.com> + +liblua-openssl (20161209-0) unstable; urgency=low + + * Add ssl:getVerifyResult() + + -- William Ahern <william@25thandClement.com> + +liblua-openssl (20161208-0) unstable; urgency=low + + * openssl.x509.store:addDefaults() new function to add the operating system's default ca's to a certificate store. + * openssl.x509.store:add() can now take a CRL + * openssl.ssl.context:getStore() new function that returns a reference to a context's certificate store + * openssl.pkey:encrypt() and openssl.pkey:decrypt() + * openssl.ssl.new() to construct an SSL* given a SSL_CTX* + * Bindings for X509_VERIFY_PARAM* + + -- William Ahern <william@25thandClement.com> + +liblua-openssl (20161101-0) unstable; urgency=low + + * Rename bignum methods tobin, todec, tohex to CamelCase: toDecimal, toDecimal, toHex + + -- William Ahern <william@25thandClement.com> + +liblua-openssl (20161029-0) unstable; urgency=low + + * Add lots of bignum methods + * Allow hex strings creating bignums + * Expose openssl.x509.csr + * Use autoguess project to get platform features + + -- William Ahern <william@25thandClement.com> + liblua-openssl (20151221-0) unstable; urgency=low * Add :tohex and :todec methods to bignums, and make metamethods diff --git a/regress/104-interposition-discarded.lua b/regress/104-interposition-discarded.lua new file mode 100755 index 0000000..4261bcb --- /dev/null +++ b/regress/104-interposition-discarded.lua @@ -0,0 +1,12 @@ +#!/usr/bin/env lua + +require"regress".export".*" + +local ssl_context = require "openssl.ssl.context" + +local value = {} +ssl_context.interpose("foo", value) +check(ssl_context.new().foo == value, "interpose failed") + +require "openssl.ssl" -- Pick a module that doesn't get loaded by regress.lua +check(ssl_context.new().foo == value, "loading a module reset methods") diff --git a/regress/53-csr-extensions.lua b/regress/53-csr-extensions.lua index 6b7d60c..6b7d60c 100644..100755 --- a/regress/53-csr-extensions.lua +++ b/regress/53-csr-extensions.lua diff --git a/src/GNUmakefile b/src/GNUmakefile index dc8af36..f5c7c55 100644 --- a/src/GNUmakefile +++ b/src/GNUmakefile @@ -42,7 +42,7 @@ $$(d)/$(1)/%.o: $$(d)/%.c $$(d)/config.h ifneq ($(1), 5.3) $$(d)/$(1)/compat53.o: $$(d)/../vendor/compat53/c-api/compat-5.3.c $$(d)/../vendor/compat53/c-api/compat-5.3.h $$(d)/config.h $$(MKDIR) -p $$(@D) - $$(CC) $$(CFLAGS_$$(<D)) $$(ALL_LUA$(subst .,,$(1))_CPPFLAGS) $$(CPPFLAGS_$$(<D)) -c -o $$@ $$< + $$(CC) $$(CFLAGS_$(d)) $$(ALL_LUA$(subst .,,$(1))_CPPFLAGS) $$(CPPFLAGS_$(d)) -c -o $$@ $$< $$(d)/$(1)/%.o: $$(d)/../vendor/compat53/c-api/compat-5.3.h diff --git a/src/openssl.c b/src/openssl.c index e5f0cd4..a34a8cf 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -1221,6 +1221,9 @@ static _Bool auxL_newclass(lua_State *L, const char *name, const auxL_Reg *metho _Bool fresh = auxL_newmetatable(L, name, reset); int n; + if (!reset && !fresh) + return fresh; + auxL_setfuncs(L, metamethods, 0); if ((n = auxL_liblen(methods))) { @@ -3249,8 +3252,6 @@ static int pk_new(lua_State *L) { /* #1 table or key; if key, #2 format and #3 type */ lua_settop(L, 3); - ud = prepsimple(L, PKEY_CLASS); - if (lua_istable(L, 1) || lua_isnil(L, 1)) { int type = EVP_PKEY_RSA; unsigned bits = 1024; @@ -3292,7 +3293,7 @@ static int pk_new(lua_State *L) { bits = (unsigned)n; } - if (!getfield(L, 1, "exp")) { + if (getfield(L, 1, "exp")) { exp = checkbig(L, -1); } else { /* default to 65537 */ @@ -3327,6 +3328,8 @@ static int pk_new(lua_State *L) { } creat: + ud = prepsimple(L, PKEY_CLASS); + if (!(*ud = EVP_PKEY_new())) return auxL_error(L, auxL_EOPENSSL, "pkey.new"); @@ -3467,6 +3470,8 @@ creat: data = luaL_checklstring(L, 1, &len); + ud = prepsimple(L, PKEY_CLASS); + if (!(bio = BIO_new_mem_buf((void *)data, len))) return auxL_error(L, auxL_EOPENSSL, "pkey.new"); @@ -5639,11 +5644,7 @@ static int xc_digest(lua_State *L) { luaL_Buffer B; unsigned i; -#if LUA_VERSION_NUM < 502 - luaL_buffinit(L, &B); -#else luaL_buffinitsize(L, &B, 2 * len); -#endif for (i = 0; i < len; i++) { luaL_addchar(&B, x[0x0f & (md[i] >> 4)]); @@ -8903,19 +8904,9 @@ static int ssl_getClientRandom(lua_State *L) { unsigned char *out; len = SSL_get_client_random(ssl, NULL, 0); -#if LUA_VERSION_NUM < 502 - if (LUAL_BUFFERSIZE < len) - luaL_error(L, "ssl:getClientRandom: LUAL_BUFFERSIZE(%d) < SSL_get_client_random(ssl, NULL, 0)", (int)LUAL_BUFFERSIZE, (int)len); - luaL_buffinit(L, &B); - out = (unsigned char*)luaL_prepbuffer(&B); - len = SSL_get_client_random(ssl, out, len); - luaL_addsize(&B, len); - luaL_pushresult(&B); -#else out = (unsigned char*)luaL_buffinitsize(L, &B, len); len = SSL_get_client_random(ssl, out, len); luaL_pushresultsize(&B, len); -#endif return 1; } /* ssl_getClientRandom() */ |