Skip to content

Commit 88574d5

Browse files
committed
fix(store) set X509_V_FLAG_CRL_CHECK flag if a crl is added
1 parent dd4d7a6 commit 88574d5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/resty/openssl/include/x509_vfy.lua

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ ffi.cdef [[
2828
X509 *x509, OPENSSL_STACK *chain);
2929

3030
int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
31+
32+
int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);
3133
]]
3234

3335
local _M = {}

lib/resty/openssl/x509/store.lua

+6
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ function _M:add(item)
6464
if C.X509_STORE_add_crl(self.ctx, dup) ~= 1 then
6565
err = format_error("store:add: X509_STORE_add_crl")
6666
end
67+
68+
-- define X509_V_FLAG_CRL_CHECK 0x4
69+
-- enables CRL checking for the certificate chain leaf certificate.
70+
-- An error occurs if a suitable CRL cannot be found.
71+
-- Note: this does not check for certificates in the chain.
72+
C.X509_STORE_set_flags(self.ctx, 0x4)
6773
-- decrease the dup ctx ref count immediately to make leak test happy
6874
C.X509_CRL_free(dup)
6975
else

0 commit comments

Comments
 (0)