Skip to content

Commit a1e0355

Browse files
committed
deps: update lua-resty-openssl to version 1.6.3
1 parent f27eabd commit a1e0355

File tree

6 files changed

+56
-12
lines changed

6 files changed

+56
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
## v1.6.5-rc2 - ????/??/??
44

55
- [BUGFIX] Enhance database backup and restore functionality with improved compatibility and options
6-
- [FEATURE] Add support for new reCAPTCHA version in `AntiBot` plugin
6+
- [FEATURE] Add support for new reCAPTCHA version in `Antibot` plugin
77
- [ALL-IN-ONE] Add support for disabling specific CrowdSec parsers
88
- [ALL-IN-ONE] Update CrowdSec version to 1.7.0
99
- [DOCS] Add multi-language support to the documentation, including French
1010
- [DEPS] Update lua-resty-session version to v4.1.4
11-
- [DEPS] Update lua-resty-openssl version to v1.6.2
11+
- [DEPS] Update lua-resty-openssl version to v1.6.3
1212
- [DEPS] Update coreruleset-v4 version to v4.18.0
1313
- [SECURITY] Enforce restrictive umask across scripts and configurations for improved security
1414

src/deps/deps.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@
125125
},
126126
{
127127
"id": "lua-resty-openssl",
128-
"name": "lua-resty-openssl v1.6.2",
128+
"name": "lua-resty-openssl v1.6.3",
129129
"url": "https://github.com/fffonion/lua-resty-openssl.git",
130-
"commit": "61512f0aea40559997051009fccc2c4d95192607",
130+
"commit": "790209507c4bb7d24f5b3eb3f4cb9621af60831b",
131131
"post_install": "rm -r src/deps/src/lua-resty-openssl/t"
132132
},
133133
{

src/deps/src/lua-resty-openssl/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
## [Unreleased]
33

44

5+
<a name="1.6.3"></a>
6+
## [1.6.3] - 2025-09-04
7+
### bug fixes
8+
- **jwk:** allow to load an ECX public key from private JWK [fb800c1](https://github.com/fffonion/lua-resty-openssl/commit/fb800c15951d42edb2c5cd462800f6c0ef5dbc06)
9+
10+
511
<a name="1.6.2"></a>
612
## [1.6.2] - 2025-09-02
713
### bug fixes
@@ -652,7 +658,8 @@
652658
- **x509:** export pubkey [ede4f81](https://github.com/fffonion/lua-resty-openssl/commit/ede4f817cb0fe092ad6f9ab5d6ecdcde864a9fd8)
653659

654660

655-
[Unreleased]: https://github.com/fffonion/lua-resty-openssl/compare/1.6.2...HEAD
661+
[Unreleased]: https://github.com/fffonion/lua-resty-openssl/compare/1.6.3...HEAD
662+
[1.6.3]: https://github.com/fffonion/lua-resty-openssl/compare/1.6.2...1.6.3
656663
[1.6.2]: https://github.com/fffonion/lua-resty-openssl/compare/1.6.1...1.6.2
657664
[1.6.1]: https://github.com/fffonion/lua-resty-openssl/compare/1.6.0...1.6.1
658665
[1.6.0]: https://github.com/fffonion/lua-resty-openssl/compare/1.5.2...1.6.0

src/deps/src/lua-resty-openssl/lib/resty/openssl.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ try_require_modules()
2424

2525

2626
local _M = {
27-
_VERSION = '1.6.2',
27+
_VERSION = '1.6.3',
2828
}
2929

3030
function _M.load_modules()

src/deps/src/lua-resty-openssl/lib/resty/openssl/auxiliary/jwk.lua

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
local ffi = require "ffi"
33
local C = ffi.C
4+
local ffi_str = ffi.string
45

56

67
local evp_macro = require "resty.openssl.include.evp"
@@ -13,6 +14,7 @@ local encode_base64url = require "resty.openssl.auxiliary.compat".encode_base64u
1314
local decode_base64url = require "resty.openssl.auxiliary.compat".decode_base64url
1415
local param_lib = require "resty.openssl.param"
1516
local json = require "resty.openssl.auxiliary.compat".json
17+
local ctypes = require "resty.openssl.auxiliary.ctypes"
1618
local format_error = require "resty.openssl.err".format_error
1719

1820
local OPENSSL_3X = require("resty.openssl.version").OPENSSL_3X
@@ -336,10 +338,8 @@ local jwk_params_required_mapping = {
336338
x = true,
337339
y = true,
338340
},
339-
OKP = {
340-
-- crv = true, handled earlier
341-
x = true,
342-
},
341+
-- OKP required parameters are checked elsewhere
342+
OKP = {},
343343
}
344344

345345
function _M.load_jwk_ex(txt, ptyp, properties)
@@ -363,6 +363,15 @@ function _M.load_jwk_ex(txt, ptyp, properties)
363363
return nil, "jwk:load_jwk: missing \"crv\" parameter from OKP JWK"
364364
end
365365
tbl["crv"] = nil
366+
367+
if not tbl["x"] and not tbl["d"] then
368+
return nil, "jwk:load_jwk: missing at least one of \"x\" or \"d\" parameter from OKP JWK"
369+
end
370+
371+
if tbl["d"] and selection == evp_macro.EVP_PKEY_PUBLIC_KEY then
372+
-- if only 'd' is provided and we want to import a public key, first create a private key
373+
selection = evp_macro.EVP_PKEY_KEYPAIR
374+
end
366375
end
367376

368377
local ctx = ffi.new("EVP_PKEY*[1]")
@@ -425,6 +434,34 @@ function _M.load_jwk_ex(txt, ptyp, properties)
425434
return nil, format_error("jwk:load_jwk: EVP_PKEY_fromdata()")
426435
end
427436

437+
if kty == "OKP" and ptyp == "pu" and params_t["priv"] then
438+
-- re-export the pubkey
439+
local MAX_ECX_KEY_SIZE = 114 -- ed448 uses 114 bytes
440+
local buf = ctypes.uchar_array(MAX_ECX_KEY_SIZE)
441+
local length = ctypes.ptr_of_size_t(MAX_ECX_KEY_SIZE)
442+
443+
if C.EVP_PKEY_get_raw_public_key(ctx[0], buf, length) ~= 1 then
444+
C.EVP_PKEY_free(ctx[0])
445+
return nil, format_error("jwk:load_jwk: unable to derive public key from private key OKP JWK")
446+
end
447+
448+
params_t["pub"] = ffi_str(buf, length[0])
449+
450+
C.EVP_PKEY_free(ctx[0])
451+
ctx[0] = nil
452+
453+
local params, err = param_lib.construct(params_t, nil, schema)
454+
if params == nil then
455+
return nil, "jwk:load_jwk: failed to construct parameters for " .. kty .. " key: " .. err
456+
end
457+
458+
if C.EVP_PKEY_fromdata(pctx, ctx, evp_macro.EVP_PKEY_PUBLIC_KEY, params) ~= 1 then
459+
return nil, format_error("jwk:load_jwk: EVP_PKEY_fromdata()")
460+
end
461+
462+
return ctx[0]
463+
end
464+
428465
return ctx[0]
429466
end
430467

src/deps/src/lua-resty-openssl/lua-resty-openssl-1.6.2-1.rockspec renamed to src/deps/src/lua-resty-openssl/lua-resty-openssl-1.6.3-1.rockspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package = "lua-resty-openssl"
2-
version = "1.6.2-1"
2+
version = "1.6.3-1"
33
source = {
44
url = "git+https://github.com/fffonion/lua-resty-openssl.git",
5-
tag = "1.6.2"
5+
tag = "1.6.3"
66
}
77
description = {
88
detailed = "FFI-based OpenSSL binding for LuaJIT.",

0 commit comments

Comments
 (0)