1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Fix a problem in the changes to the openssl NSE library made in r17002

found by Patrik Karlsson. The second and subsequent times we call
EVP{Encrypt,Decrypt}Init_ex, we have to pass NULL for the type argument.
This allows setting to accumulate from previous calls.
This commit is contained in:
david
2010-03-28 21:18:02 +00:00
parent a646a2ec60
commit 36927f0810

View File

@@ -393,7 +393,7 @@ static int l_encrypt(lua_State *L) /** encrypt( string algorithm, string key, st
if (!out) return luaL_error( L, "Couldn't allocate memory.");
if (!(
EVP_EncryptInit_ex( &cipher_ctx, evp_cipher, NULL, key, iv ) &&
EVP_EncryptInit_ex( &cipher_ctx, NULL, NULL, key, iv ) &&
EVP_EncryptUpdate( &cipher_ctx, out, &out_len, data, data_len ) &&
EVP_EncryptFinal_ex( &cipher_ctx, out + out_len, &final_len ) )) {
EVP_CIPHER_CTX_cleanup( &cipher_ctx );
@@ -447,7 +447,7 @@ static int l_decrypt(lua_State *L) /** decrypt( string algorithm, string key, st
if (!out) return luaL_error( L, "Couldn't allocate memory.");
if (!(
EVP_DecryptInit_ex( &cipher_ctx, evp_cipher, NULL, key, iv ) &&
EVP_DecryptInit_ex( &cipher_ctx, NULL, NULL, key, iv ) &&
EVP_DecryptUpdate( &cipher_ctx, out, &out_len, data, data_len ) &&
EVP_DecryptFinal_ex( &cipher_ctx, out + out_len, &final_len ) )) {
EVP_CIPHER_CTX_cleanup( &cipher_ctx );