aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-05-28 18:10:52 +1000
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-05-28 18:10:52 +1000
commit0f437c5951d3b6cdb75195bbcc8b8237fb2e4969 (patch)
tree3d3de5c7f4ace8736d2676f7f61c4657bbf149fb /src
parent237f4b17b61f6e77af9ecf4ee414337dc2a35617 (diff)
downloadluaossl-0f437c5951d3b6cdb75195bbcc8b8237fb2e4969.tar.gz
luaossl-0f437c5951d3b6cdb75195bbcc8b8237fb2e4969.tar.bz2
luaossl-0f437c5951d3b6cdb75195bbcc8b8237fb2e4969.zip
src/openssl.c: Add csr:addRequestedExtension
Diffstat (limited to 'src')
-rw-r--r--src/openssl.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 2f15bc7..52eaf55 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -6793,6 +6793,24 @@ error:
} /* xr_getSubjectAlt() */
+static int xr_addRequestedExtension(lua_State *L) {
+ X509_REQ *csr = checksimple(L, 1, X509_CSR_CLASS);
+ X509_EXTENSION *ext = checksimple(L, 2, X509_EXT_CLASS);
+ int nid, crit;
+ void *value;
+
+ nid = OBJ_obj2nid(X509_EXTENSION_get_object(ext));
+ crit = X509_EXTENSION_get_critical(ext);
+ value = X509_EXTENSION_get_data(ext);
+
+ if (xr_modifyRequestedExtension(csr, nid, crit, value, X509V3_ADD_APPEND))
+ return auxL_error(L, auxL_EOPENSSL, "x509.csr:addRequestedExtension");
+
+ lua_pushboolean(L, 1);
+ return 1;
+} /* xr_addRequestedExtension() */
+
+
static int xr_setRequestedExtension(lua_State *L) {
X509_REQ *csr = checksimple(L, 1, X509_CSR_CLASS);
X509_EXTENSION *ext = checksimple(L, 2, X509_EXT_CLASS);
@@ -6937,6 +6955,7 @@ static const auxL_Reg xr_methods[] = {
{ "setSubjectAlt", &xr_setSubjectAlt },
{ "getRequestedExtension", &xr_getRequestedExtension },
{ "getRequestedExtensionCount", &xr_getRequestedExtensionCount },
+ { "addRequestedExtension", &xr_addRequestedExtension },
{ "setRequestedExtension", &xr_setRequestedExtension },
{ "sign", &xr_sign },
{ "tostring", &xr__tostring },