Skip to content

Commit 19653be

Browse files
committed
chore: more covarges
1 parent 8adbe13 commit 19653be

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

src/pkcs7.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,7 @@ static LUA_FUNCTION(openssl_pkcs7_set_content)
136136
PKCS7 *p7 = CHECK_OBJECT(1, PKCS7, "openssl.pkcs7");
137137
PKCS7 *content = CHECK_OBJECT(2, PKCS7, "openssl.pkcs7");
138138

139-
int ret = PKCS7_set_content(p7, content);
140-
if (ret == 1)
141-
{
142-
lua_pushvalue(L, 1);
143-
lua_pushvalue(L, 2);
144-
lua_rawset(L, LUA_REGISTRYINDEX);
145-
}
139+
int ret = PKCS7_set_content(p7, PKCS7_dup(content));
146140
return openssl_pushresult(L, ret);
147141
}
148142

test/6.pkcs7.lua

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,33 @@ function TestPKCS7:testNew()
6363
der = assert(p7:export())
6464
assert(openssl.pkcs7.read(der, 'auto'))
6565

66-
if helper.openssl3 then
67-
--p7 = openssl.pkcs7.create({
68-
-- ca.cacert,
69-
-- cert
70-
-- }, {ca.crl})
71-
--assert(p7:parse())
72-
--assert(p7:export())
73-
74-
--assert(p7:export('der'))
75-
else
76-
p7 = openssl.pkcs7.new()
77-
p7:add(ca.cacert)
78-
p7:add(cert)
79-
p7:add(ca.crl)
66+
local p = openssl.pkcs7.new()
67+
p:add(ca.cacert)
68+
p:add(cert)
69+
p:add(ca.crl)
70+
assert(p:parse())
71+
assert(p:export())
72+
73+
-- FIXME: illegal zero content
74+
assert(p:export('der'))
75+
local ln, sn = p:type()
76+
assert(ln)
77+
assert(sn)
78+
79+
p7 = openssl.pkcs7.create({
80+
ca.cacert,
81+
cert
82+
}, {ca.crl})
8083
assert(p7:parse())
8184
assert(p7:export())
8285

83-
assert(p7:export('der'))
84-
end
86+
-- TODO: enable below
87+
-- p7:set_content(p)
8588

86-
local ln, sn = p7:type()
89+
-- FIXME: illegal zero content
90+
-- assert(p7:export('der'))
91+
ln, sn = p7:type()
8792
assert(ln)
8893
assert(sn)
94+
8995
end

0 commit comments

Comments
 (0)