aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar william <william@25thandclement.com> 2015-02-25 12:45:18 -0800
committerLibravatarLibravatar william <william@25thandclement.com> 2015-02-25 12:45:18 -0800
commit685b4c9e4038268872d4f144bd495aae518c23de (patch)
tree59f4a4775a432bff1f17308c6a601cc442e67527
parent4231605183ac19c84fe6eb412c88915fa0ba12f3 (diff)
downloadluaossl-685b4c9e4038268872d4f144bd495aae518c23de.tar.gz
luaossl-685b4c9e4038268872d4f144bd495aae518c23de.tar.bz2
luaossl-685b4c9e4038268872d4f144bd495aae518c23de.zip
add des module to make it easier to implement NTLM authentication protocol
-rw-r--r--src/openssl.c30
-rw-r--r--src/openssl.des.lua3
2 files changed, 33 insertions, 0 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 58e60a6..dcebeef 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -73,6 +73,7 @@
#include <openssl/ssl.h>
#include <openssl/hmac.h>
#include <openssl/rand.h>
+#include <openssl/des.h>
#include <lua.h>
#include <lualib.h>
@@ -5606,6 +5607,35 @@ int luaopen__openssl_rand(lua_State *L) {
/*
+ * DES - openssl.des
+ *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+static int de5_string_to_key(lua_State *L) {
+ DES_cblock key;
+
+ DES_string_to_key(luaL_checkstring(L, 1), &key);
+ lua_pushlstring(L, (char *)key, sizeof key);
+
+ return 1;
+} /* de5_string_to_key() */
+
+
+static const luaL_Reg des_globals[] = {
+ { "string_to_key", &de5_string_to_key },
+ { NULL, NULL },
+};
+
+int luaopen__openssl_des(lua_State *L) {
+ initall(L);
+
+ luaL_newlib(L, des_globals);
+
+ return 1;
+} /* luaopen__openssl_des() */
+
+
+/*
* Multithread Reentrancy Protection
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/src/openssl.des.lua b/src/openssl.des.lua
new file mode 100644
index 0000000..449267c
--- /dev/null
+++ b/src/openssl.des.lua
@@ -0,0 +1,3 @@
+local ctx = require"_openssl.des"
+
+return ctx