diff options
author | william <william@25tandclement.com> | 2014-09-22 15:03:08 -0700 |
---|---|---|
committer | william <william@25tandclement.com> | 2014-09-22 15:03:08 -0700 |
commit | d4914b31664e771ae93b88f6f83fb24c616b20fd (patch) | |
tree | ed9e8b545d096cb97a7864d1aa95b5e3a804c338 /src | |
parent | a5d3fa1f606facb9d169b0821172e4a0e416386f (diff) | |
download | luaossl-d4914b31664e771ae93b88f6f83fb24c616b20fd.tar.gz luaossl-d4914b31664e771ae93b88f6f83fb24c616b20fd.tar.bz2 luaossl-d4914b31664e771ae93b88f6f83fb24c616b20fd.zip |
bind opensslv.h and opensslconf.h macros
Diffstat (limited to 'src')
-rw-r--r-- | src/GNUmakefile | 6 | ||||
-rw-r--r-- | src/openssl.c | 177 | ||||
-rw-r--r-- | src/openssl.lua | 1 |
3 files changed, 184 insertions, 0 deletions
diff --git a/src/GNUmakefile b/src/GNUmakefile index 6a0bb3c..1b77d43 100644 --- a/src/GNUmakefile +++ b/src/GNUmakefile @@ -87,6 +87,7 @@ LUAC$(1)_$(d) = $$(or $$(call LUAPATH_$(d), $(1), luac), true) MODS$(1)_$(d) = \ $$(DESTDIR)$(2)/_openssl.so \ + $$(DESTDIR)$(3)/openssl.lua \ $$(DESTDIR)$(3)/openssl/bignum.lua \ $$(DESTDIR)$(3)/openssl/pkey.lua \ $$(DESTDIR)$(3)/openssl/pubkey.lua \ @@ -111,6 +112,11 @@ $$(DESTDIR)$(2)/_openssl.so: $$(d)/$(1)/openssl.so $$(MKDIR) -p $$(@D) $$(CP) -fp $$< $$@ +$$(DESTDIR)$(3)/openssl.lua: $$(d)/openssl.lua + $$(LUAC$(1)_$(d)) -p $$< + $$(MKDIR) -p $$(@D) + $$(CP) -p $$< $$@ + $$(DESTDIR)$(3)/openssl/%.lua: $$(d)/openssl.%.lua $$(LUAC$(1)_$(d)) -p $$< $$(MKDIR) -p $$(@D) diff --git a/src/openssl.c b/src/openssl.c index 4936003..5695b58 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -60,6 +60,8 @@ #include <mach/mach_time.h> /* mach_absolute_time() */ #endif +#include <openssl/opensslconf.h> +#include <openssl/opensslv.h> #include <openssl/err.h> #include <openssl/bn.h> #include <openssl/asn1.h> @@ -518,6 +520,181 @@ static void initall(lua_State *L); /* + * OPENSSL - openssl + * + * Miscellaneous global interfaces. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * NOTE: Compile-time cipher exclusions from openssl-1.0.1i/util/mkdef.pl. + */ +static const char opensslconf_no[][20] = { +#ifdef OPENSSL_NO_RC2 + { "NO_RC2" }, +#endif +#ifdef OPENSSL_NO_RC4 + { "NO_RC4" }, +#endif +#ifdef OPENSSL_NO_RC5 + { "NO_RC5" }, +#endif +#ifdef OPENSSL_NO_IDEA + { "NO_IDEA" }, +#endif +#ifdef OPENSSL_NO_DES + { "NO_DES" }, +#endif +#ifdef OPENSSL_NO_BF + { "NO_BF" }, +#endif +#ifdef OPENSSL_NO_CAST + { "NO_CAST" }, +#endif +#ifdef OPENSSL_NO_WHIRLPOOL + { "NO_WHIRLPOOL" }, +#endif +#ifdef OPENSSL_NO_CAMELLIA + { "NO_CAMELLIA" }, +#endif +#ifdef OPENSSL_NO_SEED + { "NO_SEED" }, +#endif +#ifdef OPENSSL_NO_MD2 + { "NO_MD2" }, +#endif +#ifdef OPENSSL_NO_MD4 + { "NO_MD4" }, +#endif +#ifdef OPENSSL_NO_MD5 + { "NO_MD5" }, +#endif +#ifdef OPENSSL_NO_SHA + { "NO_SHA" }, +#endif +#ifdef OPENSSL_NO_RIPEMD + { "NO_RIPEMD" }, +#endif +#ifdef OPENSSL_NO_MDC2 + { "NO_MDC2" }, +#endif +#ifdef OPENSSL_NO_RSA + { "NO_RSA" }, +#endif +#ifdef OPENSSL_NO_DSA + { "NO_DSA" }, +#endif +#ifdef OPENSSL_NO_DH + { "NO_DH" }, +#endif +#ifdef OPENSSL_NO_HMAC + { "NO_HMAC" }, +#endif +#ifdef OPENSSL_NO_AES + { "NO_AES" }, +#endif +#ifdef OPENSSL_NO_KRB5 + { "NO_KRB5" }, +#endif +#ifdef OPENSSL_NO_EC + { "NO_EC" }, +#endif +#ifdef OPENSSL_NO_ECDSA + { "NO_ECDSA" }, +#endif +#ifdef OPENSSL_NO_ECDH + { "NO_ECDH" }, +#endif +#ifdef OPENSSL_NO_ENGINE + { "NO_ENGINE" }, +#endif +#ifdef OPENSSL_NO_HW + { "NO_HW" }, +#endif +#ifdef OPENSSL_NO_FP_API + { "NO_FP_API" }, +#endif +#ifdef OPENSSL_NO_STATIC_ENGINE + { "NO_STATIC_ENGINE" }, +#endif +#ifdef OPENSSL_NO_GMP + { "NO_GMP" }, +#endif +#ifdef OPENSSL_NO_DEPRECATED + { "NO_DEPRECATED" }, +#endif +#ifdef OPENSSL_NO_RFC3779 + { "NO_RFC3779" }, +#endif +#ifdef OPENSSL_NO_PSK + { "NO_PSK" }, +#endif +#ifdef OPENSSL_NO_TLSEXT + { "NO_TLSEXT" }, +#endif +#ifdef OPENSSL_NO_CMS + { "NO_CMS" }, +#endif +#ifdef OPENSSL_NO_CAPIENG + { "NO_CAPIENG" }, +#endif +#ifdef OPENSSL_NO_JPAKE + { "NO_JPAKE" }, +#endif +#ifdef OPENSSL_NO_SRP + { "NO_SRP" }, +#endif +#ifdef OPENSSL_NO_SSL2 + { "NO_SSL2" }, +#endif +#ifdef OPENSSL_NO_EC2M + { "NO_EC2M" }, +#endif +#ifdef OPENSSL_NO_NISTP_GCC + { "NO_NISTP_GCC" }, +#endif +#ifdef OPENSSL_NO_NEXTPROTONEG + { "NO_NEXTPROTONEG" }, +#endif +#ifdef OPENSSL_NO_SCTP + { "NO_SCTP" }, +#endif +#ifdef OPENSSL_NO_UNIT_TEST + { "NO_UNIT_TEST" }, +#endif + { "" } /* in case nothing is defined above */ +}; /* opensslconf_no[] */ + + +int luaopen__openssl(lua_State *L) { + size_t i; + + lua_newtable(L); + + for (i = 0; i < countof(opensslconf_no); i++) { + if (*opensslconf_no[i]) { + lua_pushboolean(L, 1); + lua_setfield(L, -2, opensslconf_no[i]); + } + } + + lib_pushinteger(L, OPENSSL_VERSION_NUMBER); + lua_setfield(L, -2, "VERSION_NUMBER"); + + lua_pushstring(L, OPENSSL_VERSION_TEXT); + lua_setfield(L, -2, "VERSION_TEXT"); + + lua_pushstring(L, SHLIB_VERSION_HISTORY); + lua_setfield(L, -2, "SSHLIB_VERSION_HISTORY"); + + lua_pushstring(L, SHLIB_VERSION_NUMBER); + lua_setfield(L, -2, "SSHLIB_VERSION_NUMBER"); + + return 1; +} /* luaopen__openssl() */ + + +/* * BIGNUM - openssl.bignum * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/src/openssl.lua b/src/openssl.lua new file mode 100644 index 0000000..cce2150 --- /dev/null +++ b/src/openssl.lua @@ -0,0 +1 @@ +return require"_openssl" |