mirror of
https://github.com/brunoos/luasec.git
synced 2024-11-07 22:18:27 +01:00
Merge pull request #8 from xnyhps/protocol_version
Report the actual TLS version used, not the version the cipher belongs to.
This commit is contained in:
commit
4a95102cc8
@ -646,7 +646,8 @@ static int meth_info(lua_State *L)
|
||||
lua_pushstring(L, buf);
|
||||
lua_pushnumber(L, bits);
|
||||
lua_pushnumber(L, algbits);
|
||||
return 3;
|
||||
lua_pushstring(L, SSL_get_version(ssl->ssl));
|
||||
return 4;
|
||||
}
|
||||
|
||||
static int meth_copyright(lua_State *L)
|
||||
|
@ -133,7 +133,7 @@ end
|
||||
-- Extract connection information.
|
||||
--
|
||||
local function info(ssl, field)
|
||||
local str, comp, err
|
||||
local str, comp, err, protocol
|
||||
comp, err = core.compression(ssl)
|
||||
if err then
|
||||
return comp, err
|
||||
@ -143,7 +143,7 @@ local function info(ssl, field)
|
||||
return comp
|
||||
end
|
||||
local info = {compression = comp}
|
||||
str, info.bits, info.algbits = core.info(ssl)
|
||||
str, info.bits, info.algbits, protocol = core.info(ssl)
|
||||
if str then
|
||||
info.cipher, info.protocol, info.key,
|
||||
info.authentication, info.encryption, info.mac =
|
||||
@ -151,6 +151,9 @@ local function info(ssl, field)
|
||||
"^(%S+)%s+(%S+)%s+Kx=(%S+)%s+Au=(%S+)%s+Enc=(%S+)%s+Mac=(%S+)")
|
||||
info.export = (string.match(str, "%sexport%s*$") ~= nil)
|
||||
end
|
||||
if protocol then
|
||||
info.protocol = protocol
|
||||
end
|
||||
if field then
|
||||
return info[field]
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user