Skip to content

Commit

Permalink
chore(tests): remove boring ssl related tests (#12171)
Browse files Browse the repository at this point in the history
Signed-off-by: Aapo Talvensaari <[email protected]>
  • Loading branch information
bungle authored Dec 13, 2023
1 parent e98a938 commit 32996ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
9 changes: 2 additions & 7 deletions build/tests/01-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,8 @@ assert_exec 0 'root' "/usr/local/openresty/bin/resty -e 'print(jit.version)' | g
###

# check which ssl openresty is using
if docker_exec root '/usr/local/openresty/bin/openresty -V 2>&1' | grep 'BoringSSL'; then
msg_test 'openresty binary uses expected boringssl version'
assert_exec 0 'root' "/usr/local/openresty/bin/openresty -V 2>&1 | grep '1.1.0'"
else
msg_test 'openresty binary uses expected openssl version'
assert_exec 0 'root' "/usr/local/openresty/bin/openresty -V 2>&1 | grep '${OPENSSL}'"
fi
msg_test 'openresty binary uses expected openssl version'
assert_exec 0 'root' "/usr/local/openresty/bin/openresty -V 2>&1 | grep '${OPENSSL}'"

msg_test 'openresty binary is linked to kong-provided ssl libraries'
assert_exec 0 'root' "ldd /usr/local/openresty/bin/openresty | grep -E 'libssl.so.*kong/lib'"
Expand Down
21 changes: 7 additions & 14 deletions spec/helpers/ssl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ local ffi = require "ffi"
local C = ffi.C
local bit = require "bit"
local format_error = require("resty.openssl.err").format_error
local BORINGSSL = require("resty.openssl.version").BORINGSSL
require "resty.openssl.include.ssl"

ffi.cdef [[
Expand Down Expand Up @@ -76,24 +75,18 @@ local errors = {
SSL_ERROR_WANT_RETRY_VERIFY = 12,
}

local SOCKET_INVALID = -1
local SSL_FILETYPE_PEM = 1

local errors_literal = {}
for k, v in pairs(errors) do
errors_literal[v] = k
end

local SOCKET_INVALID = -1


local ssl_set_mode
if BORINGSSL then
ssl_set_mode = function(...) return C.SSL_set_mode(...) end
else
local SSL_CTRL_MODE = 33
ssl_set_mode = function(ctx, mode) return C.SSL_ctrl(ctx, SSL_CTRL_MODE, mode, nil) end
local function ssl_set_mode(ctx, mode)
return C.SSL_ctrl(ctx, 33, mode, nil)
end

local SSL_FILETYPE_PEM = 1

local function ssl_ctx_new(cfg)
if cfg.protocol and cfg.protocol ~= "any" then
return nil, "protocol other than 'any' is currently not supported"
Expand Down Expand Up @@ -166,10 +159,10 @@ function SSL.wrap(sock, cfg)
ctx = s,
fd = fd,
}, ssl_mt)

return self, nil
end
return nil, err
return nil, err
end

local function socket_waitfd(fd, events, timeout)
Expand Down

0 comments on commit 32996ab

Please sign in to comment.