From f22b3ea609140e9a5bbb6946af4be9cb66911d4f Mon Sep 17 00:00:00 2001 From: Bruno Silvestre Date: Wed, 20 Jul 2022 17:39:20 -0300 Subject: [PATCH] Code format --- src/ssl.c | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index 8358e8b..4520d56 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -675,36 +675,35 @@ static int meth_getpeerfinished(lua_State *L) */ static int meth_exportkeyingmaterial(lua_State *L) { - p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection"); + p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection"); - if(ssl->state != LSEC_STATE_CONNECTED) { - lua_pushnil(L); - lua_pushstring(L, "closed"); - return 0; - } + if(ssl->state != LSEC_STATE_CONNECTED) { + lua_pushnil(L); + lua_pushstring(L, "closed"); + return 0; + } - size_t llen = 0; - const char *label = luaL_checklstring(L, 2, &llen); - int olen = luaL_checkinteger(L, 3); - size_t contextlen = 0; - const unsigned char *context = NULL; + size_t llen = 0; + const char *label = luaL_checklstring(L, 2, &llen); + int olen = luaL_checkinteger(L, 3); + size_t contextlen = 0; + const unsigned char *context = NULL; - if(!lua_isnoneornil(L, 4)) { - context = (unsigned char *)luaL_checklstring(L, 4, &contextlen); - } + if (!lua_isnoneornil(L, 4)) + context = (unsigned char*)luaL_checklstring(L, 4, &contextlen); - /* temporary buffer memory-managed by Lua itself */ - unsigned char *out = lua_newuserdata(L, olen); + /* Temporary buffer memory-managed by Lua itself */ + unsigned char *out = lua_newuserdata(L, olen); - if(SSL_export_keying_material(ssl->ssl, out, olen, label, llen, context, contextlen, context != NULL) != 1) { - lua_pushnil(L); - /* Could not find whether OpenSSL keeps any details anywhere */ - lua_pushstring(L, "error exporting keying material"); - return 2; - } + if(SSL_export_keying_material(ssl->ssl, out, olen, label, llen, context, contextlen, context != NULL) != 1) { + lua_pushnil(L); + /* Could not find whether OpenSSL keeps any details anywhere */ + lua_pushstring(L, "error exporting keying material"); + return 2; + } - lua_pushlstring(L, (char *)out, olen); - return 1; + lua_pushlstring(L, (char*)out, olen); + return 1; } /**