Page MenuHomePhabricator

ssh_finalize() issue in 0.8.5
Closed, ResolvedPublic




with libssh linked as static lib leads to access violation.

See Seems calling


is missing in crypto_thread_finalize() of file libcrypto.c

So on second ssh_init() call probably still the old libcrypto_lock_callback pointer is stored and called by openssl before CRYPTO_set_locking_callback() is newly set.

Event Timeline

chcg created this task.Nov 1 2018, 12:55 AM
chcg added a comment.EditedNov 1 2018, 12:59 AM

Used openssl version 1.0.2p.


 	NppFTP.dll!ssh_threads_set_callbacks()	C
>	NppFTP.dll!CRYPTO_lock(int mode, int type, const char * file, int line) Zeile 604	C
 	NppFTP.dll!CRYPTO_mem_ctrl(int mode) Zeile 213	C
 	NppFTP.dll!OBJ_NAME_init() Zeile 61	C
 	NppFTP.dll!OBJ_NAME_add(const char * name, int type, const char * data) Zeile 185	C
 	NppFTP.dll!EVP_add_cipher(const evp_cipher_st * c) Zeile 76	C
 	NppFTP.dll!OpenSSL_add_all_ciphers() Zeile 70	C
 	NppFTP.dll!OPENSSL_add_all_algorithms_noconf() Zeile 85	C
 	[Externer Code]	
 	NppFTP.dll!FTPClientWrapperSSH::connect_ssh() Zeile 405	C++
 	NppFTP.dll!FTPClientWrapperSSH::Connect() Zeile 66	C++
 	NppFTP.dll!QueueConnect::Perform() Zeile 185	C++
 	NppFTP.dll!FTPQueue::QueueLoop() Zeile 200	C++
 	NppFTP.dll!FTPQueue::QueueThread(FTPQueue * queue) Zeile 264	C++
 	NppFTP.dll!ThreadProc(void * param) Zeile 269	C++
 	[Externer Code]


+		file	0x00007ff94a927898 ".\\crypto\\mem_dbg.c"	const char *
		line	0x000000d4	int
		locking_callback	0x00007ff94a4b79af {NppFTP.dll!libcrypto_lock_callback}	void(*)(int, int, const char *, int)
		mode	0x00000009	int
		type	0x00000014	int

at CRYPTO_lock line 604 from cryptlib.c

chcg updated the task description. (Show Details)Nov 1 2018, 1:04 AM


Thanks for reporting this. I had some trouble to reproduce this issue since it only happens in Windows environment.

Follows attached a patch set to fix this issue. It can also be reviewed in:

chcg added a comment.Nov 28 2018, 8:36 PM

Thanks for the fix and the extensive work on the test environment. Sorry that I forgot to mention that this was observed on windows will working on