Kfsio lib: invoke ssl context and ssl new / free at the end of ssl init to ensure that all openssl internal globals are properly initialized before other threads are started. Fix SslFilter attach method by invoking SSL_connect or SSL_accept depending on the type of the ssl context. Fix SslFilter write method error handling logic and return code.