aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-10-30 18:09:13 +1100
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-10-31 13:13:29 +1100
commitc0c334e88bffc74a97b1316d0c55cedd4b041ccb (patch)
tree2b5ca8ce03f7d09adeee8cb5a8d2395222fe6ae3
parent14381ef9d1a1f61e50a78eb7e9dfd51fab046cdd (diff)
downloadluaossl-c0c334e88bffc74a97b1316d0c55cedd4b041ccb.tar.gz
luaossl-c0c334e88bffc74a97b1316d0c55cedd4b041ccb.tar.bz2
luaossl-c0c334e88bffc74a97b1316d0c55cedd4b041ccb.zip
Add openssl.extensionSupported()
-rw-r--r--doc/luaossl.tex4
-rw-r--r--src/openssl.c19
2 files changed, 23 insertions, 0 deletions
diff --git a/doc/luaossl.tex b/doc/luaossl.tex
index ddfde04..c3e4463 100644
--- a/doc/luaossl.tex
+++ b/doc/luaossl.tex
@@ -250,6 +250,10 @@ name & description \\\hline
\small{\texttt{SSLEAY\_DIR}} & OpenSSL installation directory description as a string. \\
\end{ctabular}
+\subsubsection[\fn{openssl.extensionSupported}]{\fn{openssl.extensionSupported($ext\_type$)}}
+
+Returns a boolean indicating if the extension $ext\_type$ is handled internally by OpenSSL.
+
\end{Module}
diff --git a/src/openssl.c b/src/openssl.c
index d8d9e01..6b6d5cd 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -351,6 +351,10 @@
#define HAVE_SSL_CTX_USE_SERVERINFO_FILE OPENSSL_PREREQ(1,0,2)
#endif
+#ifndef HAVE_SSL_EXTENSION_SUPPORTED
+#define HAVE_SSL_EXTENSION_SUPPORTED OPENSSL_PREREQ(1,0,2)
+#endif
+
#ifndef HAVE_SSL_GET0_ALPN_SELECTED
#define HAVE_SSL_GET0_ALPN_SELECTED HAVE_SSL_CTX_SET_ALPN_PROTOS
#endif
@@ -2456,8 +2460,23 @@ static int ossl_version(lua_State *L) {
return 1;
} /* ossl_version() */
+
+#if HAVE_SSL_EXTENSION_SUPPORTED
+static int ossl_extensionSupported(lua_State *L) {
+ unsigned int ext_type = auxL_checkunsigned(L, 1);
+
+ lua_pushboolean(L, SSL_extension_supported(ext_type));
+
+ return 1;
+} /* ossl_extensionSupported() */
+#endif
+
+
static const auxL_Reg ossl_globals[] = {
{ "version", &ossl_version },
+#if HAVE_SSL_EXTENSION_SUPPORTED
+ { "extensionSupported", &ossl_extensionSupported },
+#endif
{ NULL, NULL },
};