aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar william <william@25thandclement.com> 2015-02-25 14:38:28 -0800
committerLibravatarLibravatar william <william@25thandclement.com> 2015-02-25 14:38:28 -0800
commit1476267d26c9b0cac8818bf7a74696d48505b79d (patch)
tree1572bcd1676dd9d738ccec28f3794b621e2149fd
parent60e2efe65fd5113952398ad3ed6b49a32a9ea5dd (diff)
downloadluaossl-1476267d26c9b0cac8818bf7a74696d48505b79d.tar.gz
luaossl-1476267d26c9b0cac8818bf7a74696d48505b79d.tar.bz2
luaossl-1476267d26c9b0cac8818bf7a74696d48505b79d.zip
bind set_odd_parity as DES_string_to_key is incompatible with LM scheme
-rw-r--r--src/openssl.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/openssl.c b/src/openssl.c
index dcebeef..6e3039f 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -5620,9 +5620,24 @@ static int de5_string_to_key(lua_State *L) {
return 1;
} /* de5_string_to_key() */
+static int de5_set_odd_parity(lua_State *L) {
+ const char *src;
+ size_t len;
+ DES_cblock key;
+
+ src = luaL_checklstring(L, 1, &len);
+ memset(&key, 0, sizeof key);
+ memcpy(&key, src, MIN(len, sizeof key));
+
+ DES_set_odd_parity(&key);
+ lua_pushlstring(L, (char *)key, sizeof key);
+
+ return 1;
+} /* de5_set_odd_parity() */
static const luaL_Reg des_globals[] = {
- { "string_to_key", &de5_string_to_key },
+ { "string_to_key", &de5_string_to_key },
+ { "set_odd_parity", &de5_set_odd_parity },
{ NULL, NULL },
};