diff options
author | william <william@25thandclement.com> | 2015-02-25 14:38:28 -0800 |
---|---|---|
committer | william <william@25thandclement.com> | 2015-02-25 14:38:28 -0800 |
commit | 1476267d26c9b0cac8818bf7a74696d48505b79d (patch) | |
tree | 1572bcd1676dd9d738ccec28f3794b621e2149fd | |
parent | 60e2efe65fd5113952398ad3ed6b49a32a9ea5dd (diff) | |
download | luaossl-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.c | 17 |
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) { | |||
5620 | return 1; | 5620 | return 1; |
5621 | } /* de5_string_to_key() */ | 5621 | } /* de5_string_to_key() */ |
5622 | 5622 | ||
5623 | static int de5_set_odd_parity(lua_State *L) { | ||
5624 | const char *src; | ||
5625 | size_t len; | ||
5626 | DES_cblock key; | ||
5627 | |||
5628 | src = luaL_checklstring(L, 1, &len); | ||
5629 | memset(&key, 0, sizeof key); | ||
5630 | memcpy(&key, src, MIN(len, sizeof key)); | ||
5631 | |||
5632 | DES_set_odd_parity(&key); | ||
5633 | lua_pushlstring(L, (char *)key, sizeof key); | ||
5634 | |||
5635 | return 1; | ||
5636 | } /* de5_set_odd_parity() */ | ||
5623 | 5637 | ||
5624 | static const luaL_Reg des_globals[] = { | 5638 | static const luaL_Reg des_globals[] = { |
5625 | { "string_to_key", &de5_string_to_key }, | 5639 | { "string_to_key", &de5_string_to_key }, |
5640 | { "set_odd_parity", &de5_set_odd_parity }, | ||
5626 | { NULL, NULL }, | 5641 | { NULL, NULL }, |
5627 | }; | 5642 | }; |
5628 | 5643 | ||