diff options
| author | william <william@25thandclement.com> | 2015-02-25 12:45:18 -0800 |
|---|---|---|
| committer | william <william@25thandclement.com> | 2015-02-25 12:45:18 -0800 |
| commit | 685b4c9e4038268872d4f144bd495aae518c23de (patch) | |
| tree | 59f4a4775a432bff1f17308c6a601cc442e67527 | |
| parent | 4231605183ac19c84fe6eb412c88915fa0ba12f3 (diff) | |
| download | luaossl-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.c | 30 | ||||
| -rw-r--r-- | src/openssl.des.lua | 3 |
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 @@ | |||
| 73 | #include <openssl/ssl.h> | 73 | #include <openssl/ssl.h> |
| 74 | #include <openssl/hmac.h> | 74 | #include <openssl/hmac.h> |
| 75 | #include <openssl/rand.h> | 75 | #include <openssl/rand.h> |
| 76 | #include <openssl/des.h> | ||
| 76 | 77 | ||
| 77 | #include <lua.h> | 78 | #include <lua.h> |
| 78 | #include <lualib.h> | 79 | #include <lualib.h> |
| @@ -5606,6 +5607,35 @@ int luaopen__openssl_rand(lua_State *L) { | |||
| 5606 | 5607 | ||
| 5607 | 5608 | ||
| 5608 | /* | 5609 | /* |
| 5610 | * DES - openssl.des | ||
| 5611 | * | ||
| 5612 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
| 5613 | |||
| 5614 | static int de5_string_to_key(lua_State *L) { | ||
| 5615 | DES_cblock key; | ||
| 5616 | |||
| 5617 | DES_string_to_key(luaL_checkstring(L, 1), &key); | ||
| 5618 | lua_pushlstring(L, (char *)key, sizeof key); | ||
| 5619 | |||
| 5620 | return 1; | ||
| 5621 | } /* de5_string_to_key() */ | ||
| 5622 | |||
| 5623 | |||
| 5624 | static const luaL_Reg des_globals[] = { | ||
| 5625 | { "string_to_key", &de5_string_to_key }, | ||
| 5626 | { NULL, NULL }, | ||
| 5627 | }; | ||
| 5628 | |||
| 5629 | int luaopen__openssl_des(lua_State *L) { | ||
| 5630 | initall(L); | ||
| 5631 | |||
| 5632 | luaL_newlib(L, des_globals); | ||
| 5633 | |||
| 5634 | return 1; | ||
| 5635 | } /* luaopen__openssl_des() */ | ||
| 5636 | |||
| 5637 | |||
| 5638 | /* | ||
| 5609 | * Multithread Reentrancy Protection | 5639 | * Multithread Reentrancy Protection |
| 5610 | * | 5640 | * |
| 5611 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | 5641 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
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 @@ | |||
| 1 | local ctx = require"_openssl.des" | ||
| 2 | |||
| 3 | return ctx | ||
