Subject: Re: patch to add libssh2_init() and libssh2_exit()

Re: patch to add libssh2_init() and libssh2_exit()

From: Lars Nordin <Lars.Nordin_at_sdlabs.se>
Date: Wed, 10 Mar 2010 13:32:53 +0100

On 2010-03-10 12:42, Simon Josefsson wrote:
> Lars Nordin<Lars.Nordin_at_SDlabs.se> writes:
>
>
>> Please find attached patch to make libssh2 have a clean way of
>> initialize the library.
>>
> Hi. Great, I agree libssh2 should have proper global init/exit
> functions.
>
>
>> The patch adds a new file, global.c. The makefile.in is changes, but
>> not the WIN32 files.
>>
> The Makefile.in file is automatically generated, the file to modify is
> Makefile.inc.
>
>
Can you modify or should a resend the patch?
> You forgot to attach the new globals.c?
>
Attached...
>
>> + * LIBSSH2_INIT_ALL: Initialize everything
>>
> Maybe we could remove this one? I think it will restrict us too much in
> the future, we could conceivable have init-flags that are not related to
> disable some initialization, and then this flag becomes confusing. Just
> document that callers should pass 0 if they don't want to use any flag.
>
>
libssh2_init() needs a parameter and I think it should be a name rather
then just 0. Maybe change the name or just accept that libssh2_init(0);
is what normally will be done (if you don't handle the init of te used
cryptolibrary yourself)
>> + ERR_load_crypto_strings();
>> + OpenSSL_add_all_algorithms();
>> + ENGINE_load_builtin_engines();
>>
> Are the first and last calls really needed?
>
>
The first call is needed to get errormessages from OpenSSL with names
instead of numbers for error-funtions, but can be removed until vi
display OpenSSL error-messages for DEBUG-reasons.
The last one should be removed, usage of OpenSSL-engines can now be
handled outside libssh2 (and then call libssh2_init with
LIBSSH2_INIT_NO_CRYPTO_INIT) The same for entropy-handling, can be
handled before libssh2_init is called (ie load/update of .rnd as openssh
does it to improve random-generation
> /Simon
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>
>
/Lars

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Received on 2010-03-10