mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-20 02:42:09 +03:00
Add support for a wolfSSL crypto backend. (#629)
It uses wolfSSL's OpenSSL compatibility layer, so rather than introduce new wolfssl.h/c files, the new backend just reuses openssl.h/c. Additionally, replace EVP_Cipher() calls with EVP_CipherUpdate(), since EVP_Cipher() is not recommended. Credit: Hayden Roche
This commit is contained in:
@@ -39,6 +39,43 @@
|
||||
* OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef LIBSSH2_WOLFSSL
|
||||
|
||||
#include <wolfssl/options.h>
|
||||
#include <openssl/ecdh.h>
|
||||
|
||||
#if defined(NO_DSA) || defined(HAVE_FIPS)
|
||||
#define OPENSSL_NO_DSA
|
||||
#endif
|
||||
|
||||
#if defined(NO_MD5) || defined(HAVE_FIPS)
|
||||
#define OPENSSL_NO_MD5
|
||||
#endif
|
||||
|
||||
#if !defined(WOLFSSL_RIPEMD) || defined(HAVE_FIPS)
|
||||
#define OPENSSL_NO_RIPEMD
|
||||
#endif
|
||||
|
||||
#if defined(NO_RC4) || defined(HAVE_FIPS)
|
||||
#define OPENSSL_NO_RC4
|
||||
#endif
|
||||
|
||||
#ifdef NO_DES3
|
||||
#define OPENSSL_NO_DES
|
||||
#endif
|
||||
|
||||
#ifdef EVP_aes_128_ctr
|
||||
#define HAVE_EVP_AES_128_CTR
|
||||
#endif
|
||||
|
||||
/* wolfSSL doesn't support Blowfish or CAST. */
|
||||
#define OPENSSL_NO_BF
|
||||
#define OPENSSL_NO_CAST
|
||||
/* wolfSSL has no engine framework. */
|
||||
#define OPENSSL_NO_ENGINE
|
||||
|
||||
#endif /* LIBSSH2_WOLFSSL */
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/rsa.h>
|
||||
@@ -57,8 +94,10 @@
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \
|
||||
!defined(LIBRESSL_VERSION_NUMBER)
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L && \
|
||||
!defined(LIBRESSL_VERSION_NUMBER)) || defined(LIBSSH2_WOLFSSL)
|
||||
/* For wolfSSL, whether the structs are truly opaque or not, it's best to not
|
||||
* rely on their internal data members being exposed publicly. */
|
||||
# define HAVE_OPAQUE_STRUCTS 1
|
||||
#endif
|
||||
|
||||
@@ -105,7 +144,8 @@
|
||||
#define LIBSSH2_HMAC_SHA256 1
|
||||
#define LIBSSH2_HMAC_SHA512 1
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x00907000L && !defined(OPENSSL_NO_AES)
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x00907000L && !defined(OPENSSL_NO_AES)) || \
|
||||
(defined(LIBSSH2_WOLFSSL) && defined(WOLFSSL_AES_COUNTER))
|
||||
# define LIBSSH2_AES_CTR 1
|
||||
# define LIBSSH2_AES 1
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user