Hi and sorry for the delay
Considering Alexander's comments, the current proposal would be as follows:
Looks like an initialized instance of LIBSSH2_SESSION is necessary as
it contains pointers to memory management functions (alloc, realloc,
free) and memory management macros (LIBSSH2_ALLOC, LIBSSH2_FREE, etc.)
require it.
The function's parameters will be a session pointer, method_type and
(as an output parameter) a pointer to array of strings.
On success, the function returns the number of algorithms for the
given method_type (a positive number), allocates the array and
appropriately fills it (it will not be NULL terminated). On failure
(e.g. unsuccessful allocation, etc.) it returns an error code (a
negative number). Internally, LIBSSH2_ALLOC will be used to allocate
the appropriate amount of memory.
If the function fails it will free the allocated memory (if necessary) itself.
If the function succeeds and returns a valid list, the user must free
it when he doesn't need it anymore. This is done by calling
libssh2_free (which actually calls LIBSSH2_FREE).
The possible problem is with thread safety as in general malloc cannot
be considered as thread safe (it depends on the C-library, compiler
settings etc.)
And finally let me ask one (not so much) offtopic question. Except at
AES, CTR mode is not supported among symmetric algorithms. Is the
reason for this in OpenSSL or something else?
Regards,
Jernej
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-09-25