diff options
Diffstat (limited to 'src')
| -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 | ||
