fixes initialisation of global openssl structures. introduce new public function "mg_cleanup()".