8 Commits
v0.9 ... v1.0.1

Author SHA1 Message Date
d5df315617 Update version and rockspec 2021-04-26 09:16:05 -03:00
34252fb10a Set parameter 2 and 3 to none before luaL_buffinit() 2021-04-26 08:37:09 -03:00
711a98b760 Update rockspec 2021-01-30 10:32:28 -03:00
4894c2f6a4 Update version number 2021-01-30 10:29:53 -03:00
ae774258c5 Merge pull request #164 from murillopaula/master
feature: getsignaturename
2021-01-16 10:13:29 -03:00
de393417b7 feature: getsignaturename 2021-01-12 10:49:27 -03:00
22eadbd20e Merge pull request #156 from Petr-kk/upstream
SOCKET_INVALID pushed as integer, not as number
2020-03-06 13:44:42 -03:00
63e35c161f SOCKET_INVALID pushed as integer, not as number
winsock define INVALID_SOCKET as (UINT_PTR)(~0)
in win64 it is 0xffffffffffffffff
if pushed by lua_pushnumber, then ssl.core.SOCKET_INVALID is 1.84467440737096E19

tested in win32/64, linux32/64 lua5.1 and lua5.3
2020-03-04 17:05:06 +01:00
20 changed files with 81 additions and 43 deletions

View File

@ -1,3 +1,19 @@
--------------------------------------------------------------------------------
LuaSec 1.0.1
---------------
This version includes:
* Fix luaL_buffinit() can use the stack and broke buffer_meth_receive()
--------------------------------------------------------------------------------
LuaSec 1.0
---------------
This version includes:
* Add cert:getsignaturename()
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
LuaSec 0.9 LuaSec 0.9
--------------- ---------------

View File

@ -1,4 +1,4 @@
LuaSec 0.9 LuaSec 1.0.1
------------ ------------
* OpenSSL options: * OpenSSL options:

View File

@ -1,5 +1,5 @@
LuaSec 0.9 license LuaSec 1.0.1 license
Copyright (C) 2006-2019 Bruno Silvestre, UFG Copyright (C) 2006-2021 Bruno Silvestre, UFG
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the

View File

@ -1,4 +1,4 @@
LuaSec 0.9 LuaSec 1.0.1
=============== ===============
LuaSec depends on OpenSSL, and integrates with LuaSocket to make it LuaSec depends on OpenSSL, and integrates with LuaSocket to make it
easy to add secure connections to any Lua applications or scripts. easy to add secure connections to any Lua applications or scripts.

View File

@ -1,8 +1,8 @@
package = "LuaSec" package = "LuaSec"
version = "0.9-1" version = "1.0.1-1"
source = { source = {
url = "git://github.com/brunoos/luasec", url = "git://github.com/brunoos/luasec",
tag = "v0.9", tag = "v1.0.1",
} }
description = { description = {
summary = "A binding for OpenSSL library to provide TLS/SSL communication over LuaSocket.", summary = "A binding for OpenSSL library to provide TLS/SSL communication over LuaSocket.",

View File

@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
* LuaSec 0.9 * LuaSec 1.0.1
* *
* Copyright (C) 2006-2019 Bruno Silvestre * Copyright (C) 2006-2021 Bruno Silvestre
* *
*--------------------------------------------------------------------------*/ *--------------------------------------------------------------------------*/

View File

@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
* LuaSec 0.9 * LuaSec 1.0.1
* *
* Copyright (C) 2006-2019 Bruno Silvestre. * Copyright (C) 2006-2021 Bruno Silvestre.
* *
*--------------------------------------------------------------------------*/ *--------------------------------------------------------------------------*/

View File

@ -1,9 +1,9 @@
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
* LuaSec 0.9 * LuaSec 1.0.1
* *
* Copyright (C) 2014-2019 Kim Alvefur, Paul Aurich, Tobias Markmann, * Copyright (C) 2014-2021 Kim Alvefur, Paul Aurich, Tobias Markmann,
* Matthew Wild. * Matthew Wild.
* Copyright (C) 2006-2019 Bruno Silvestre. * Copyright (C) 2006-2021 Bruno Silvestre.
* *
*--------------------------------------------------------------------------*/ *--------------------------------------------------------------------------*/

View File

@ -2,9 +2,9 @@
#define LSEC_CONTEXT_H #define LSEC_CONTEXT_H
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
* LuaSec 0.9 * LuaSec 1.0.1
* *
* Copyright (C) 2006-2019 Bruno Silvestre * Copyright (C) 2006-2021 Bruno Silvestre
* *
*--------------------------------------------------------------------------*/ *--------------------------------------------------------------------------*/

View File

@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
* LuaSec 0.9 * LuaSec 1.0.1
* *
* Copyright (C) 2006-2019 Bruno Silvestre * Copyright (C) 2006-2021 Bruno Silvestre
* *
*--------------------------------------------------------------------------*/ *--------------------------------------------------------------------------*/

View File

@ -1,6 +1,6 @@
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
-- LuaSec 0.9 -- LuaSec 1.0.1
-- Copyright (C) 2009-2019 PUC-Rio -- Copyright (C) 2009-2021 PUC-Rio
-- --
-- Author: Pablo Musa -- Author: Pablo Musa
-- Author: Tomas Guisasola -- Author: Tomas Guisasola
@ -18,8 +18,8 @@ local try = socket.try
-- Module -- Module
-- --
local _M = { local _M = {
_VERSION = "0.9", _VERSION = "1.0.1",
_COPYRIGHT = "LuaSec 0.9 - Copyright (C) 2009-2019 PUC-Rio", _COPYRIGHT = "LuaSec 1.0.1 - Copyright (C) 2009-2021 PUC-Rio",
PORT = 443, PORT = 443,
TIMEOUT = 60 TIMEOUT = 60
} }

View File

@ -107,10 +107,16 @@ int buffer_meth_send(lua_State *L, p_buffer buf) {
* object:receive() interface * object:receive() interface
\*-------------------------------------------------------------------------*/ \*-------------------------------------------------------------------------*/
int buffer_meth_receive(lua_State *L, p_buffer buf) { int buffer_meth_receive(lua_State *L, p_buffer buf) {
int err = IO_DONE, top = lua_gettop(L);
luaL_Buffer b; luaL_Buffer b;
size_t size; size_t size;
const char *part = luaL_optlstring(L, 3, "", &size); const char *part;
int err = IO_DONE;
int top = lua_gettop(L);
if (top < 3) {
lua_settop(L, 3);
top = 3;
}
part = luaL_optlstring(L, 3, "", &size);
#ifdef LUASOCKET_DEBUG #ifdef LUASOCKET_DEBUG
p_timeout tm = timeout_markstart(buf->tm); p_timeout tm = timeout_markstart(buf->tm);
#endif #endif

View File

@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
* LuaSec 0.9 * LuaSec 1.0.1
* *
* Copyright (C) 2006-2019 Bruno Silvestre * Copyright (C) 2006-2021 Bruno Silvestre
* *
*--------------------------------------------------------------------------*/ *--------------------------------------------------------------------------*/

View File

@ -2,9 +2,9 @@
#define LSEC_OPTIONS_H #define LSEC_OPTIONS_H
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
* LuaSec 0.9 * LuaSec 1.0.1
* *
* Copyright (C) 2006-2019 Bruno Silvestre * Copyright (C) 2006-2021 Bruno Silvestre
* *
*--------------------------------------------------------------------------*/ *--------------------------------------------------------------------------*/

View File

@ -18,9 +18,9 @@ end
local function generate(options, version) local function generate(options, version)
print([[ print([[
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
* LuaSec 0.9 * LuaSec 1.0.1
* *
* Copyright (C) 2006-2019 Bruno Silvestre * Copyright (C) 2006-2021 Bruno Silvestre
* *
*--------------------------------------------------------------------------*/ *--------------------------------------------------------------------------*/

View File

@ -1,9 +1,9 @@
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
* LuaSec 0.9 * LuaSec 1.0.1
* *
* Copyright (C) 2014-2019 Kim Alvefur, Paul Aurich, Tobias Markmann, * Copyright (C) 2014-2021 Kim Alvefur, Paul Aurich, Tobias Markmann,
* Matthew Wild. * Matthew Wild.
* Copyright (C) 2006-2019 Bruno Silvestre. * Copyright (C) 2006-2021 Bruno Silvestre.
* *
*--------------------------------------------------------------------------*/ *--------------------------------------------------------------------------*/
@ -819,7 +819,7 @@ static int meth_getalpn(lua_State *L)
static int meth_copyright(lua_State *L) static int meth_copyright(lua_State *L)
{ {
lua_pushstring(L, "LuaSec 0.9 - Copyright (C) 2006-2019 Bruno Silvestre, UFG" lua_pushstring(L, "LuaSec 1.0.1 - Copyright (C) 2006-2021 Bruno Silvestre, UFG"
#if defined(WITH_LUASOCKET) #if defined(WITH_LUASOCKET)
"\nLuaSocket 3.0-RC1 - Copyright (C) 2004-2013 Diego Nehab" "\nLuaSocket 3.0-RC1 - Copyright (C) 2004-2013 Diego Nehab"
#endif #endif
@ -941,7 +941,7 @@ LSEC_API int luaopen_ssl_core(lua_State *L)
luaL_newlib(L, funcs); luaL_newlib(L, funcs);
lua_pushstring(L, "SOCKET_INVALID"); lua_pushstring(L, "SOCKET_INVALID");
lua_pushnumber(L, SOCKET_INVALID); lua_pushinteger(L, SOCKET_INVALID);
lua_rawset(L, -3); lua_rawset(L, -3);
return 1; return 1;

View File

@ -2,9 +2,9 @@
#define LSEC_SSL_H #define LSEC_SSL_H
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
* LuaSec 0.9 * LuaSec 1.0.1
* *
* Copyright (C) 2006-2019 Bruno Silvestre * Copyright (C) 2006-2021 Bruno Silvestre
* *
*--------------------------------------------------------------------------*/ *--------------------------------------------------------------------------*/

View File

@ -1,7 +1,7 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- LuaSec 0.9 -- LuaSec 1.0.1
-- --
-- Copyright (C) 2006-2019 Bruno Silvestre -- Copyright (C) 2006-2021 Bruno Silvestre
-- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
@ -271,7 +271,7 @@ core.setmethod("info", info)
-- --
local _M = { local _M = {
_VERSION = "0.9", _VERSION = "1.0.1",
_COPYRIGHT = core.copyright(), _COPYRIGHT = core.copyright(),
config = config, config = config,
loadcertificate = x509.load, loadcertificate = x509.load,

View File

@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
* LuaSec 0.9 * LuaSec 1.0.1
* *
* Copyright (C) 2014-2019 Kim Alvefur, Paul Aurich, Tobias Markmann * Copyright (C) 2014-2021 Kim Alvefur, Paul Aurich, Tobias Markmann
* Matthew Wild, Bruno Silvestre. * Matthew Wild, Bruno Silvestre.
* *
*--------------------------------------------------------------------------*/ *--------------------------------------------------------------------------*/
@ -652,6 +652,21 @@ static int meth_set_encode(lua_State* L)
return 1; return 1;
} }
/**
* Get signature name.
*/
static int meth_get_sinagure_name(lua_State* L)
{
p_x509 px = lsec_checkp_x509(L, 1);
int nid = X509_get_signature_nid(px->cert);
const char *name = OBJ_nid2sn(nid);
if (!name)
lua_pushnil(L);
else
lua_pushstring(L, name);
return 1;
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static int load_cert(lua_State* L) static int load_cert(lua_State* L)
@ -680,6 +695,7 @@ static luaL_Reg methods[] = {
{"digest", meth_digest}, {"digest", meth_digest},
{"setencode", meth_set_encode}, {"setencode", meth_set_encode},
{"extensions", meth_extensions}, {"extensions", meth_extensions},
{"getsignaturename", meth_get_sinagure_name},
{"issuer", meth_issuer}, {"issuer", meth_issuer},
{"notbefore", meth_notbefore}, {"notbefore", meth_notbefore},
{"notafter", meth_notafter}, {"notafter", meth_notafter},

View File

@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
* LuaSec 0.9 * LuaSec 1.0.1
* *
* Copyright (C) 2014-2019 Kim Alvefur, Paul Aurich, Tobias Markmann * Copyright (C) 2014-2021 Kim Alvefur, Paul Aurich, Tobias Markmann
* Matthew Wild, Bruno Silvestre. * Matthew Wild, Bruno Silvestre.
* *
*--------------------------------------------------------------------------*/ *--------------------------------------------------------------------------*/