1
1

18 Коммитов

Автор SHA1 Сообщение Дата
Anderson Toshiyuki Sasaki
83b43443e5 threads: Automatically call ssh_init on load
This makes unnecessary to call ssh_init() when the library is
dynamically loaded.  Also removes the threads shared library.  The used
threads implementation is chosen in configuration time, changing the
ssh_threads_get_default() depending on the available threads library.

Internally, it is expected a threads implementation providing:

- void ssh_mutex_lock(void **mutex);
- void ssh_mutex_unlock(void **mutex);
- struct ssh_threads_callbacks_struct *ssh_threads_get_default(void);

and a crypto implementation providing:

- int crypto_thread_init(struct ssh_threads_callbacks_struct *user_callbacks);
- void crypto_thread_finalize(void);

This adds internal threads implementation for pthreads and noop.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-03 16:43:03 +02:00
Andreas Schneider
952c64b4c0 threads: Fix compiler warning
Use a protype for libcrypto_lock_callback().

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-04 11:18:12 +02:00
Andreas Schneider
2cff66c155 threads: Use calloc() instead of malloc()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-01-18 18:55:04 +01:00
Juraj Vijtiuk
778652460f add mbedtls crypto support
Summary:
This patch adds support for mbedTLS as a crypto backend for libssh.
mbedTLS is an SSL/TLS library that has been designed to mainly be used
in embedded systems.  It is loosely coupled and has a low memory
footprint.  mbedTLS also provides a cryptography library (libmbedcrypto)
that can be used without the TLS modules.
The patch is unfortunately quite big, since several new files had to
be added.
DSA is disabled at compile time, since mbedTLS doesn't support DSA
Patch review and feedback would be appreciated, and if any issues or
suggestions appear, I'm willing to work on them.

Signed-off-by: Juraj Vijtiuk <juraj.vijtiuk@sartura.hr>

Test Plan:
* The patch has been tested with a Debug and MinSizeRel build, with
libssh unit tests, client tests and the pkd tests.
* All the tests have been run with valgrind's memcheck, drd and helgrind
tools.
* The examples/samplessh client works when built with the patch.

Reviewers: asn, aris

Subscribers: simonsj

Differential Revision: https://bugs.libssh.org/D1
2017-12-28 11:17:39 +01:00
Andreas Schneider
2dff359a33 threads: Use new API call for OpenSSL CRYPTO THREADID
BUG: https://red.libssh.org/issues/222

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-11-07 11:46:47 +01:00
Aris Adamantiadis
57ef959aa3 threads: support libgcrypt 1.6 hack
Not 100% satisfied of this patch, but the way libgcrypt handles
threading in 1.6 is not compatible with custom handlers. The
new code basicaly uses pthreads in every case. This will probably
not work on windows.
2014-01-08 18:57:31 +01:00
Andreas Schneider
e68b763a67 threads: Make libcrypto_mutexes static.
Fixes sparse warnings.
2012-02-19 13:26:02 +01:00
Andreas Schneider
72db38b31d threads: Fix function defintions.
Fixes sparse warnings.
2012-02-19 13:26:02 +01:00
Andreas Schneider
acfc8ea83f priv: Remove crypto.h and add correct includes to src files. 2011-09-18 21:37:17 +02:00
Bernhard R. Link
8b51d29363 proper prototypes
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2011-02-12 12:26:33 +01:00
Andreas Schneider
751f202f56 doc: Follow the current naming convention. 2010-12-10 20:28:59 +01:00
Aris Adamantiadis
5b1c985a0e Changed the threads cbks from struct to publ func 2010-09-30 11:10:08 +02:00
Andreas Schneider
9d3b84c914 threads: Fixed windows build.
MSVC isn't C99.
2010-09-28 19:12:01 +02:00
Aris Adamantiadis
5eb7c7b6ec Added initialisation logs for threading 2010-09-12 21:53:42 +02:00
Aris Adamantiadis
b7af2b2959 Changed callbacks type 2010-09-12 21:45:53 +02:00
Aris Adamantiadis
49f57a8d0d Implemented the noop and native pointers 2010-09-06 16:52:14 +02:00
Aris Adamantiadis
2cca490076 Moved pthread specific code in src/threads/pthread.c
pthread example doesn't compile du to the lack of
libssh_threads_native.so library
2010-09-06 14:51:01 +02:00
Andreas Schneider
f7842e3a4b misc: Rename libssh/ to src/ 2010-09-06 14:28:38 +02:00