diff options
author | daurnimator <quae@daurnimator.com> | 2016-11-07 23:16:47 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2016-11-07 23:16:47 +1100 |
commit | f343f2dd6ed3637d9eebf6b88ff752774c005674 (patch) | |
tree | 56b37c1130f269894235abbb4077d73f033297be /src | |
parent | cb727f97f2e00512c70631210de2d8b951e81587 (diff) | |
download | luaossl-f343f2dd6ed3637d9eebf6b88ff752774c005674.tar.gz luaossl-f343f2dd6ed3637d9eebf6b88ff752774c005674.tar.bz2 luaossl-f343f2dd6ed3637d9eebf6b88ff752774c005674.zip |
openssl.x509.store:add(): Allow adding CRLs to store
Uses `X509_STORE_add_crl`
Diffstat (limited to 'src')
-rw-r--r-- | src/openssl.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/openssl.c b/src/openssl.c index 4564061..e070f91 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -6752,17 +6752,24 @@ static int xs_interpose(lua_State *L) { static int xs_add(lua_State *L) { X509_STORE *store = checksimple(L, 1, X509_STORE_CLASS); int i, top = lua_gettop(L); + X509 *crt, *crt_dup; + X509_CRL *crl, *crl_dup; for (i = 2; i <= top; i++) { - if (lua_isuserdata(L, i)) { - X509 *crt = checksimple(L, i, X509_CERT_CLASS); - X509 *dup; + if ((crt = testsimple(L, i, X509_CERT_CLASS))) { + if (!(crt_dup = X509_dup(crt))) + return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); - if (!(dup = X509_dup(crt))) + if (!X509_STORE_add_cert(store, crt_dup)) { + X509_free(crt_dup); + return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); + } + } else if ((crl = testsimple(L, i, X509_CRL_CLASS))) { + if (!(crl_dup = X509_CRL_dup(crl))) return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); - if (!X509_STORE_add_cert(store, dup)) { - X509_free(dup); + if (!X509_STORE_add_crl(store, crl_dup)) { + X509_CRL_free(crl_dup); return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); } } else { |