5 Commits

Author SHA1 Message Date
47cc914e69 Update version number. 2015-11-20 19:39:32 -02:00
90d4f2d95c typo: intall -> install.
update MacOSX version -> 10.11.
2015-11-20 19:20:07 -02:00
172d324243 Fix push_asn1_string(). 2015-11-20 19:16:16 -02:00
6cc8e951d4 Update samples. 2015-11-20 19:12:19 -02:00
d36e156fac Guard SSLv3_method() with #ifndef OPENSSL_NO_SSL3.
Use TLS_method() instead of SSLv32_method(), when it is the case.
2015-11-20 18:54:57 -02:00
48 changed files with 130 additions and 105 deletions

View File

@ -1,3 +1,11 @@
--------------------------------------------------------------------------------
LuaSec 0.5.1
------------
- Check if SSLv3 protocol is available.
- Fix push_asn1_string().
- Update samples to use 'sslv23' and 'tlsv1_2'.
- Update MACOSX_VERSION to 10.11 on Makefile.
--------------------------------------------------------------------------------
LuaSec 0.5
------------

View File

@ -1,9 +1,9 @@
LuaSec 0.5
LuaSec 0.5.1
------------
* OpenSSL options:
By default, LuaSec 0.5 includes options for OpenSSL 1.0.1e.
By default, LuaSec 0.5.1 includes options for OpenSSL 1.0.1e.
If you need to generate the options for a different version of OpenSSL:

View File

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

View File

@ -1,4 +1,4 @@
# Inform the location to intall the modules
# Inform the location to install the modules
LUAPATH ?= /usr/share/lua/5.1
LUACPATH ?= /usr/lib/lua/5.1
@ -16,7 +16,7 @@ INCDIR = -I. $(INC_PATH)
LIBDIR = -L./luasocket $(LIB_PATH)
# For Mac OS X: set the system version
MACOSX_VERSION=10.4
MACOSX_VERSION?=10.11
#----------------------
# Do not edit this part

View File

@ -1,3 +1,10 @@
LuaSec 0.5.1
============
- Check if SSLv3 protocol is available.
- Fix push_asn1_string().
- Update samples to use 'sslv23' and 'tlsv1_2'.
- Update MACOSX_VERSION to 10.11 on Makefile.
LuaSec 0.5
==========

View File

@ -7,12 +7,12 @@ local util = require("util")
local params = {
mode = "client",
protocol = "tlsv1",
protocol = "tlsv1_2",
key = "../certs/clientAkey.pem",
certificate = "../certs/clientA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
local conn = socket.tcp()

View File

@ -7,12 +7,12 @@ local util = require("util")
local params = {
mode = "server",
protocol = "tlsv1",
protocol = "sslv23",
key = "../certs/serverAkey.pem",
certificate = "../certs/serverA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
local ctx = assert(ssl.newcontext(params))

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "client",
protocol = "sslv3",
protocol = "tlsv1_2",
key = "../certs/clientAkey.pem",
certificate = "../certs/clientA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
local peer = socket.tcp()

View File

@ -31,12 +31,12 @@ end
local params = {
mode = "server",
protocol = "sslv3",
protocol = "sslv23",
key = "../certs/serverAkey.pem",
certificate = "../certs/serverA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
dhparam = dhparam_cb,
}

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "client",
protocol = "sslv3",
protocol = "tlsv1_2",
key = "../certs/clientAkey.pem",
certificate = "../certs/clientA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
local peer = socket.tcp()

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "server",
protocol = "sslv3",
protocol = "sslv23",
key = "../certs/serverAkey.pem",
certificate = "../certs/serverA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "client",
protocol = "sslv3",
protocol = "tlsv1_2",
key = "../certs/clientAkey.pem",
certificate = "../certs/clientA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
--
curve = "secp384r1",
}

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "server",
protocol = "sslv3",
protocol = "sslv23",
key = "../certs/serverAkey.pem",
certificate = "../certs/serverA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
--
curve = "secp384r1",
}

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "client",
protocol = "sslv3",
protocol = "tlsv1_2",
key = "../certs/clientAkey.pem",
certificate = "../certs/clientA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
local peer = socket.tcp()

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "server",
protocol = "sslv3",
protocol = "sslv23",
key = "../certs/serverAkey.pem",
certificate = "../certs/serverA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}

View File

@ -5,7 +5,7 @@ local ssl = require("ssl")
local pass = "foobar"
local cfg = {
protocol = "tlsv1",
protocol = "tlsv1_2",
mode = "client",
key = "key.pem",
}

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "client",
protocol = "sslv3",
protocol = "tlsv1_2",
key = "../certs/clientAkey.pem",
certificate = "../certs/clientA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
while true do

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "server",
protocol = "sslv3",
protocol = "sslv23",
key = "../certs/serverAkey.pem",
certificate = "../certs/serverA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
-- [[ SSL context

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "client",
protocol = "sslv3",
protocol = "tlsv1_2",
key = "../certs/clientAkey.pem",
certificate = "../certs/clientA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
while true do

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "server",
protocol = "sslv3",
protocol = "sslv23",
key = "../certs/serverAkey.pem",
certificate = "../certs/serverA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
-- [[ SSL context

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "client",
protocol = "sslv3",
protocol = "tlsv1_2",
key = "../certs/clientAkey.pem",
certificate = "../certs/clientA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
local peer = socket.tcp()

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "server",
protocol = "sslv3",
protocol = "sslv23",
key = "../certs/serverAkey.pem",
certificate = "../certs/serverA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "client",
protocol = "sslv3",
protocol = "tlsv1_2",
key = "../../certs/clientBkey.pem",
certificate = "../../certs/clientB.pem",
cafile = "../../certs/rootB.pem",
verify = {"none"},
options = {"all", "no_sslv2"},
verify = "none",
options = "all",
}
local peer = socket.tcp()

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "server",
protocol = "sslv3",
protocol = "sslv23",
key = "../../certs/serverAkey.pem",
certificate = "../../certs/serverA.pem",
cafile = "../../certs/rootA.pem",
verify = {"none"},
options = {"all", "no_sslv2"},
verify = "none",
options = "all",
}
-- [[ SSL context

View File

@ -6,13 +6,13 @@ local ssl = require("ssl")
local params = {
mode = "client",
protocol = "sslv3",
protocol = "tlsv1_2",
key = "../../certs/clientBkey.pem",
certificate = "../../certs/clientB.pem",
cafile = "../../certs/rootB.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
verifyext = {"lsec_continue"},
options = "all", ,
verifyext = "lsec_continue",
}
-- [[ SSL context

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "server",
protocol = "sslv3",
protocol = "sslv23",
key = "../../certs/serverAkey.pem",
certificate = "../../certs/serverA.pem",
cafile = "../../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
verifyext = {"lsec_continue", "crl_check", "crl_check_chain"},
}

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "client",
protocol = "sslv3",
protocol = "tlsv1_2",
key = "../../certs/clientAkey.pem",
certificate = "../../certs/clientA.pem",
cafile = "../../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
local peer = socket.tcp()

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "server",
protocol = "sslv3",
protocol = "sslv23",
key = "../../certs/serverAkey.pem",
certificate = "../../certs/serverA.pem",
cafile = "../../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}

View File

@ -6,13 +6,13 @@ local ssl = require("ssl")
local params = {
mode = "client",
protocol = "tlsv1",
protocol = "tlsv1_2",
key = "../certs/serverBkey.pem",
certificate = "../certs/serverB.pem",
cafile = "../certs/rootB.pem",
verify = {"peer", "fail_if_no_peer_cert"},
verifyext = {"lsec_continue", "lsec_ignore_purpose"},
options = {"all", "no_sslv2"},
options = "all",
}
local ctx = assert(ssl.newcontext(params))

View File

@ -6,13 +6,13 @@ local ssl = require("ssl")
local params = {
mode = "server",
protocol = "tlsv1",
protocol = "sslv23",
key = "../certs/serverAkey.pem",
certificate = "../certs/serverA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
verifyext = {"lsec_continue", "lsec_ignore_purpose"},
options = {"all", "no_sslv2"},
options = "all",
}

View File

@ -8,12 +8,12 @@ local ssl = require("ssl")
local params = {
mode = "client",
protocol = "sslv3",
protocol = "tlsv1_2",
key = "../certs/clientAkey.pem",
certificate = "../certs/clientA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
-- Wait until socket is ready (for reading or writing)

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "server",
protocol = "sslv3",
protocol = "sslv23",
key = "../certs/serverAkey.pem",
certificate = "../certs/serverA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
-- [[ SSL context

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "client",
protocol = "sslv3",
protocol = "tlsv1_2",
key = "../certs/clientAkey.pem",
certificate = "../certs/clientA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}

View File

@ -8,12 +8,12 @@ local ssl = require("ssl")
local params = {
mode = "server",
protocol = "sslv3",
protocol = "sslv23",
key = "../certs/serverAkey.pem",
certificate = "../certs/serverA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
-- [[ SSL context

View File

@ -6,12 +6,12 @@ local ssl = require("ssl")
local params = {
mode = "client",
protocol = "sslv3",
protocol = "tlsv1_2",
key = "../certs/clientAkey.pem",
certificate = "../certs/clientA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}
local function wait(peer, err)

View File

@ -8,12 +8,12 @@ print("Use Ctrl+S and Ctrl+Q to suspend and resume the server.")
local params = {
mode = "server",
protocol = "sslv3",
protocol = "sslv23",
key = "../certs/serverAkey.pem",
certificate = "../certs/serverA.pem",
cafile = "../certs/rootA.pem",
verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
options = "all",
}

View File

@ -1,6 +1,6 @@
/*--------------------------------------------------------------------------
* LuaSec 0.5
* Copyright (C) 2006-2014 Bruno Silvestre
* LuaSec 0.5.1
* Copyright (C) 2006-2015 Bruno Silvestre
*
*--------------------------------------------------------------------------*/

View File

@ -1,9 +1,9 @@
/*--------------------------------------------------------------------------
* LuaSec 0.5
* LuaSec 0.5.1
*
* Copyright (C) 2014 Kim Alvefur, Paul Aurich, Tobias Markmann,
* Matthew Wild.
* Copyright (C) 2006-2014 Bruno Silvestre.
* Copyright (C) 2014-2015 Kim Alvefur, Paul Aurich, Tobias Markmann,
* Matthew Wild.
* Copyright (C) 2006-2015 Bruno Silvestre.
*
*--------------------------------------------------------------------------*/
@ -35,6 +35,10 @@ typedef const SSL_METHOD LSEC_SSL_METHOD;
typedef SSL_METHOD LSEC_SSL_METHOD;
#endif
#if OPENSSL_VERSION_NUMBER>=0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
#define SSLv23_method() TLS_method()
#endif
/*--------------------------- Auxiliary Functions ----------------------------*/
/**
@ -66,7 +70,9 @@ static int set_option_flag(const char *opt, unsigned long *flag)
static LSEC_SSL_METHOD* str2method(const char *method)
{
if (!strcmp(method, "sslv23")) return SSLv23_method();
#ifndef OPENSSL_NO_SSL3
if (!strcmp(method, "sslv3")) return SSLv3_method();
#endif
if (!strcmp(method, "tlsv1")) return TLSv1_method();
#if (OPENSSL_VERSION_NUMBER >= 0x1000100fL)
if (!strcmp(method, "tlsv1_1")) return TLSv1_1_method();

View File

@ -2,8 +2,8 @@
#define LSEC_CONTEXT_H
/*--------------------------------------------------------------------------
* LuaSec 0.5
* Copyright (C) 2006-2014 Bruno Silvestre
* LuaSec 0.5.1
* Copyright (C) 2006-2015 Bruno Silvestre
*
*--------------------------------------------------------------------------*/

View File

@ -1,6 +1,6 @@
/*--------------------------------------------------------------------------
* LuaSec 0.5
* Copyright (C) 2006-2014 Bruno Silvestre
* LuaSec 0.5.1
* Copyright (C) 2006-2015 Bruno Silvestre
*
*--------------------------------------------------------------------------*/

View File

@ -1,6 +1,6 @@
----------------------------------------------------------------------------
-- LuaSec 0.5
-- Copyright (C) 2009-2014 PUC-Rio
-- LuaSec 0.5.1
-- Copyright (C) 2009-2015 PUC-Rio
--
-- Author: Pablo Musa
-- Author: Tomas Guisasola
@ -22,8 +22,8 @@ local getmetatable = getmetatable
module("ssl.https")
_VERSION = "0.5"
_COPYRIGHT = "LuaSec 0.5 - Copyright (C) 2009-2014 PUC-Rio"
_VERSION = "0.5.1"
_COPYRIGHT = "LuaSec 0.5.1 - Copyright (C) 2009-2015 PUC-Rio"
-- Default settings
PORT = 443

View File

@ -2,8 +2,8 @@
#define LSEC_OPTIONS_H
/*--------------------------------------------------------------------------
* LuaSec 0.5
* Copyright (C) 2006-2014 Bruno Silvestre
* LuaSec 0.5.1
* Copyright (C) 2006-2015 Bruno Silvestre
*
*--------------------------------------------------------------------------*/

View File

@ -21,8 +21,8 @@ local function generate(options, version)
#define LSEC_OPTIONS_H
/*--------------------------------------------------------------------------
* LuaSec 0.5
* Copyright (C) 2006-2014 Bruno Silvestre
* LuaSec 0.5.1
* Copyright (C) 2006-2015 Bruno Silvestre
*
*--------------------------------------------------------------------------*/

View File

@ -1,8 +1,8 @@
/*--------------------------------------------------------------------------
* LuaSec 0.5
* LuaSec 0.5.1
*
* Copyright (C) 2014 Kim Alvefur, Paul Aurich, Tobias Markmann,
* Matthew Wild.
* Copyright (C) 2014-2015 Kim Alvefur, Paul Aurich, Tobias Markmann,
* Matthew Wild.
* Copyright (C) 2006-2014 Bruno Silvestre.
*
*--------------------------------------------------------------------------*/
@ -655,7 +655,7 @@ static int meth_info(lua_State *L)
static int meth_copyright(lua_State *L)
{
lua_pushstring(L, "LuaSec 0.5 - Copyright (C) 2006-2011 Bruno Silvestre"
lua_pushstring(L, "LuaSec 0.5.1 - Copyright (C) 2006-2015 Bruno Silvestre"
#if defined(WITH_LUASOCKET)
"\nLuaSocket 3.0-RC1 - Copyright (C) 2004-2013 Diego Nehab"
#endif

View File

@ -2,8 +2,8 @@
#define LSEC_SSL_H
/*--------------------------------------------------------------------------
* LuaSec 0.5
* Copyright (C) 2006-2014 Bruno Silvestre
* LuaSec 0.5.1
* Copyright (C) 2006-2015 Bruno Silvestre
*
*--------------------------------------------------------------------------*/

View File

@ -1,6 +1,6 @@
------------------------------------------------------------------------------
-- LuaSec 0.5
-- Copyright (C) 2006-2014 Bruno Silvestre
-- LuaSec 0.5.1
-- Copyright (C) 2006-2015 Bruno Silvestre
--
------------------------------------------------------------------------------
@ -10,7 +10,7 @@ local x509 = require("ssl.x509")
module("ssl", package.seeall)
_VERSION = "0.5.PR"
_VERSION = "0.5.1"
_COPYRIGHT = core.copyright()
-- Export

View File

@ -1,8 +1,8 @@
/*--------------------------------------------------------------------------
* LuaSec 0.5
* LuaSec 0.5.1
*
* Copyright (C) 2014 Kim Alvefur, Paul Aurich, Tobias Markmann
* Matthew Wild, Bruno Silvestre.
* Copyright (C) 2014-2015 Kim Alvefur, Paul Aurich, Tobias Markmann
* Matthew Wild, Bruno Silvestre.
*
*--------------------------------------------------------------------------*/
@ -86,10 +86,12 @@ static void push_asn1_objname(lua_State* L, ASN1_OBJECT *object, int no_name)
*/
static void push_asn1_string(lua_State* L, ASN1_STRING *string, int encode)
{
size_t len;
int len;
unsigned char *data;
if (!string)
if (!string) {
lua_pushnil(L);
return;
}
switch (encode) {
case LSEC_AI5_STRING:
lua_pushlstring(L, (char*)ASN1_STRING_data(string),
@ -101,6 +103,8 @@ static void push_asn1_string(lua_State* L, ASN1_STRING *string, int encode)
lua_pushlstring(L, (char*)data, len);
OPENSSL_free(data);
}
else
lua_pushnil(L);
}
}

View File

@ -1,8 +1,8 @@
/*--------------------------------------------------------------------------
* LuaSec 0.5
* LuaSec 0.5.1
*
* Copyright (C) 2014 Kim Alvefur, Paul Aurich, Tobias Markmann
* Matthew Wild, Bruno Silvestre.
* Copyright (C) 2014-2015 Kim Alvefur, Paul Aurich, Tobias Markmann
* Matthew Wild, Bruno Silvestre.
*
*--------------------------------------------------------------------------*/