Fix PSK samples

This commit is contained in:
Bruno Silvestre
2023-02-16 10:52:05 -03:00
parent 6708ccc381
commit b321ba8fab
2 changed files with 23 additions and 11 deletions

View File

@ -4,17 +4,22 @@
local socket = require("socket")
local ssl = require("ssl")
-- @param identity (string)
-- @param max_psk_len (number)
-- @return psk (string)
local function pskcb(identity, max_psk_len)
print(string.format("PSK Callback: identity=%q, max_psk_len=%d", identity, max_psk_len))
if identity == "abcd" then
return "1234"
end
return nil
end
local params = {
mode = "server",
protocol = "any",
options = "all",
psk = function(identity, max_psk_len)
print("PSK Callback: identity=", identity, ", max_psk_len=", max_psk_len)
if identity == "abcd" then
return "1234"
end
return nil
end
psk = pskcb,
}