Commit 836d5c9 1 parent ec2ef27 commit 836d5c9 Copy full SHA for 836d5c9
File tree 3 files changed +18
-5
lines changed
3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -33,11 +33,14 @@ _M.bignum = _M.bn
33
33
function _M .luaossl_compat ()
34
34
for mod , tbl in pairs (_M ) do
35
35
if type (tbl ) == ' table' then
36
+
37
+ -- avoid using a same table as the iterrator will change
38
+ local new_tbl = {}
36
39
-- luaossl always error() out
37
40
for k , f in pairs (tbl ) do
38
41
if type (f ) == ' function' then
39
42
local of = f
40
- tbl [k ] = function (...)
43
+ new_tbl [k ] = function (...)
41
44
local ret = { of (... ) }
42
45
if ret and # ret > 1 and ret [# ret ] then
43
46
error (mod .. " ." .. k .. " (): " .. ret [# ret ])
@@ -47,6 +50,10 @@ function _M.luaossl_compat()
47
50
end
48
51
end
49
52
53
+ for k , f in pairs (new_tbl ) do
54
+ tbl [k ] = f
55
+ end
56
+
50
57
setmetatable (tbl , {
51
58
__index = function (t , k )
52
59
local tok
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ local GEN_URI = 6
8
8
local GEN_IPADD = 7
9
9
-- local GEN_RID = 8
10
10
11
- local types = {
11
+ local default_types = {
12
12
RFC822Name = GEN_EMAIL ,
13
13
RFC822 = GEN_EMAIL ,
14
14
Email = GEN_EMAIL ,
@@ -29,8 +29,10 @@ local literals = {
29
29
[GEN_IPADD ] = " IP" ,
30
30
}
31
31
32
- for t , gid in pairs (types ) do
32
+ local types = {}
33
+ for t , gid in pairs (default_types ) do
33
34
types [t :lower ()] = gid
35
+ types [t ] = gid
34
36
end
35
37
36
38
return {
Original file line number Diff line number Diff line change @@ -324,7 +324,7 @@ local function generate_key(config)
324
324
return ctx_ptr [0 ]
325
325
end
326
326
327
- local load_key_try_funcs = {
327
+ local _load_key_try_funcs = {
328
328
PEM = {
329
329
-- Note: make sure we always try load priv key first
330
330
pr = {
@@ -351,7 +351,10 @@ local load_key_try_funcs = {
351
351
-- populate * funcs
352
352
local all_funcs = {}
353
353
local typ_funcs = {}
354
- for fmt , ffs in pairs (load_key_try_funcs ) do
354
+ local load_key_try_funcs = {}
355
+ for fmt , ffs in pairs (_load_key_try_funcs ) do
356
+ load_key_try_funcs [fmt ] = ffs
357
+
355
358
local funcs = {}
356
359
for typ , fs in pairs (ffs ) do
357
360
for f , arg in pairs (fs ) do
@@ -370,6 +373,7 @@ load_key_try_funcs["*"]["*"] = all_funcs
370
373
for typ , fs in pairs (typ_funcs ) do
371
374
load_key_try_funcs [typ ] = fs
372
375
end
376
+ _load_key_try_funcs = nil
373
377
374
378
local function tostring (self , is_priv , fmt )
375
379
if fmt == " JWK" then
You can’t perform that action at this time.
0 commit comments