summaryrefslogtreecommitdiff
path: root/libs/libssh2/src/openssl.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libssh2/src/openssl.h')
-rw-r--r--libs/libssh2/src/openssl.h35
1 files changed, 29 insertions, 6 deletions
diff --git a/libs/libssh2/src/openssl.h b/libs/libssh2/src/openssl.h
index e44c87498c..e41c1df470 100644
--- a/libs/libssh2/src/openssl.h
+++ b/libs/libssh2/src/openssl.h
@@ -48,7 +48,7 @@
#ifdef LIBSSH2_WOLFSSL
#include <wolfssl/options.h>
-#include <openssl/ecdh.h>
+#include <wolfssl/openssl/ecdh.h>
#if defined(NO_DSA) || defined(HAVE_FIPS)
#define OPENSSL_NO_DSA
@@ -76,7 +76,23 @@
/* wolfSSL has no engine framework. */
#define OPENSSL_NO_ENGINE
-#endif /* LIBSSH2_WOLFSSL */
+#include <wolfssl/openssl/opensslconf.h>
+#include <wolfssl/openssl/sha.h>
+#include <wolfssl/openssl/rsa.h>
+#ifndef OPENSSL_NO_DSA
+#include <wolfssl/openssl/dsa.h>
+#endif
+#ifndef OPENSSL_NO_MD5
+#include <wolfssl/openssl/md5.h>
+#endif
+#include <wolfssl/openssl/err.h>
+#include <wolfssl/openssl/evp.h>
+#include <wolfssl/openssl/hmac.h>
+#include <wolfssl/openssl/bn.h>
+#include <wolfssl/openssl/pem.h>
+#include <wolfssl/openssl/rand.h>
+
+#else /* !LIBSSH2_WOLFSSL */
#include <openssl/opensslconf.h>
#include <openssl/sha.h>
@@ -102,6 +118,8 @@
#include <openssl/core_names.h>
#endif
+#endif /* LIBSSH2_WOLFSSL */
+
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L && \
!defined(LIBRESSL_VERSION_NUMBER)) || defined(LIBSSH2_WOLFSSL) || \
(defined(LIBRESSL_VERSION_NUMBER) && \
@@ -167,8 +185,11 @@
# define LIBSSH2_AES_CBC 0
#endif
+/* wolfSSL v5.4.0 is required due to possibly this bug:
+ https://github.com/wolfSSL/wolfssl/pull/5205
+ Before this release, all libssh2 tests crash with AES-GCM enabled */
#if (OPENSSL_VERSION_NUMBER >= 0x01010100fL && !defined(OPENSSL_NO_AES)) || \
- (defined(LIBSSH2_WOLFSSL) && \
+ (defined(LIBSSH2_WOLFSSL) && LIBWOLFSSL_VERSION_HEX >= 0x05004000 && \
defined(HAVE_AESGCM) && defined(WOLFSSL_AESGCM_STREAM))
# define LIBSSH2_AES_GCM 1
#else
@@ -386,6 +407,7 @@ libssh2_curve_type;
#define _libssh2_cipher_arcfour EVP_rc4
#define _libssh2_cipher_cast5 EVP_cast5_cbc
#define _libssh2_cipher_3des EVP_des_ede3_cbc
+#define _libssh2_cipher_chacha20 NULL
#ifdef HAVE_OPAQUE_STRUCTS
#define _libssh2_cipher_dtor(ctx) EVP_CIPHER_CTX_free(*(ctx))
@@ -399,9 +421,10 @@ libssh2_curve_type;
#define _libssh2_bn_ctx_free(bnctx) BN_CTX_free(bnctx)
#define _libssh2_bn_init() BN_new()
#define _libssh2_bn_init_from_bin() _libssh2_bn_init()
-#define _libssh2_bn_set_word(bn, val) BN_set_word(bn, val)
-#define _libssh2_bn_from_bin(bn, len, val) BN_bin2bn(val, (int)len, bn)
-#define _libssh2_bn_to_bin(bn, val) BN_bn2bin(bn, val)
+#define _libssh2_bn_set_word(bn, val) !BN_set_word(bn, val)
+extern int _libssh2_bn_from_bin(_libssh2_bn *bn, size_t len,
+ const unsigned char *v);
+#define _libssh2_bn_to_bin(bn, val) (BN_bn2bin(bn, val) <= 0)
#define _libssh2_bn_bytes(bn) BN_num_bytes(bn)
#define _libssh2_bn_bits(bn) BN_num_bits(bn)
#define _libssh2_bn_free(bn) BN_clear_free(bn)