Unverified Commit d7455447 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

wolfSSH: support for new SSH backend

parent c9c5304d
Loading
Loading
Loading
Loading
+36 −4
Original line number Original line Diff line number Diff line
@@ -2853,17 +2853,23 @@ dnl **********************************************************************
dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
OPT_LIBSSH2=off
OPT_LIBSSH2=off
AC_ARG_WITH(libssh2,dnl
AC_ARG_WITH(libssh2,dnl
AC_HELP_STRING([--with-libssh2=PATH],[Where to look for libssh2, PATH points to the LIBSSH2 installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
AC_HELP_STRING([--with-libssh2=PATH],[Where to look for libssh2, PATH points to the libssh2 installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
AC_HELP_STRING([--with-libssh2], [enable LIBSSH2]),
AC_HELP_STRING([--with-libssh2], [enable libssh2]),
  OPT_LIBSSH2=$withval, OPT_LIBSSH2=no)
  OPT_LIBSSH2=$withval, OPT_LIBSSH2=no)




OPT_LIBSSH=off
OPT_LIBSSH=off
AC_ARG_WITH(libssh,dnl
AC_ARG_WITH(libssh,dnl
AC_HELP_STRING([--with-libssh=PATH],[Where to look for libssh, PATH points to the LIBSSH installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
AC_HELP_STRING([--with-libssh=PATH],[Where to look for libssh, PATH points to the libssh installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
AC_HELP_STRING([--with-libssh], [enable LIBSSH]),
AC_HELP_STRING([--with-libssh], [enable libssh]),
  OPT_LIBSSH=$withval, OPT_LIBSSH=no)
  OPT_LIBSSH=$withval, OPT_LIBSSH=no)


OPT_WOLFSSH=off
AC_ARG_WITH(wolfssh,dnl
AC_HELP_STRING([--with-wolfssh=PATH],[Where to look for wolfssh, PATH points to the wolfSSH installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
AC_HELP_STRING([--with-wolfssh], [enable wolfssh]),
  OPT_WOLFSSH=$withval, OPT_WOLFSSH=no)

if test X"$OPT_LIBSSH2" != Xno; then
if test X"$OPT_LIBSSH2" != Xno; then
  dnl backup the pre-libssh2 variables
  dnl backup the pre-libssh2 variables
  CLEANLDFLAGS="$LDFLAGS"
  CLEANLDFLAGS="$LDFLAGS"
@@ -3010,6 +3016,28 @@ elif test X"$OPT_LIBSSH" != Xno; then
    CPPFLAGS=$CLEANCPPFLAGS
    CPPFLAGS=$CLEANCPPFLAGS
    LIBS=$CLEANLIBS
    LIBS=$CLEANLIBS
  fi
  fi
elif test X"$OPT_WOLFSSH" != Xno; then
  dnl backup the pre-wolfssh variables
  CLEANLDFLAGS="$LDFLAGS"
  CLEANCPPFLAGS="$CPPFLAGS"
  CLEANLIBS="$LIBS"


  if test "$OPT_WOLFSSH" != yes; then
     WOLFCONFIG="$OPT_WOLFSSH/bin/wolfssh-config"
     LDFLAGS="$LDFLAGS `$WOLFCONFIG --libs`"
     CPPFLAGS="$CPPFLAGS `$WOLFCONFIG --cflags`"
  fi

  AC_CHECK_LIB(wolfssh, wolfSSH_Init)

  AC_CHECK_HEADERS(wolfssh/ssh.h,
    curl_ssh_msg="enabled (wolfSSH)"
    WOLFSSH_ENABLED=1
    AC_DEFINE(USE_WOLFSSH, 1, [if wolfSSH is in use])
    AC_SUBST(USE_WOLFSSH, [1])
  )

fi
fi


dnl **********************************************************************
dnl **********************************************************************
@@ -4338,6 +4366,10 @@ if test "x$USE_LIBSSH" = "x1"; then
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
fi
fi
if test "x$USE_WOLFSSH" = "x1"; then
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
fi
if test "x$CURL_DISABLE_RTSP" != "x1"; then
if test "x$CURL_DISABLE_RTSP" != "x1"; then
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
fi
fi
+1 −1
Original line number Original line Diff line number Diff line
@@ -55,7 +55,7 @@ LIB_CFILES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
  curl_multibyte.c hostcheck.c conncache.c dotdot.c                     \
  curl_multibyte.c hostcheck.c conncache.c dotdot.c                     \
  x509asn1.c http2.c smb.c curl_endian.c curl_des.c system_win32.c      \
  x509asn1.c http2.c smb.c curl_endian.c curl_des.c system_win32.c      \
  mime.c sha256.c setopt.c curl_path.c curl_ctype.c curl_range.c psl.c  \
  mime.c sha256.c setopt.c curl_path.c curl_ctype.c curl_range.c psl.c  \
  doh.c urlapi.c curl_get_line.c altsvc.c
  doh.c urlapi.c curl_get_line.c altsvc.c wolfssh.c


LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
  formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h if2ip.h         \
  formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h if2ip.h         \
+11 −0
Original line number Original line Diff line number Diff line
@@ -201,6 +201,13 @@ static CURLcode global_init(long flags, bool memoryfuncs)
  }
  }
#endif
#endif


#ifdef USE_WOLFSSH
  if(WS_SUCCESS != wolfSSH_Init()) {
    DEBUGF(fprintf(stderr, "Error: wolfSSH_Init failed\n"));
    return CURLE_FAILED_INIT;
  }
#endif

  if(flags & CURL_GLOBAL_ACK_EINTR)
  if(flags & CURL_GLOBAL_ACK_EINTR)
    Curl_ack_eintr = 1;
    Curl_ack_eintr = 1;


@@ -282,6 +289,10 @@ void curl_global_cleanup(void)
  (void)ssh_finalize();
  (void)ssh_finalize();
#endif
#endif


#ifdef USE_WOLFSSH
  (void)wolfSSH_Cleanup();
#endif

  init_flags  = 0;
  init_flags  = 0;
}
}


+11 −2
Original line number Original line Diff line number Diff line
@@ -7,7 +7,7 @@
 *                            | (__| |_| |  _ <| |___
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *                             \___|\___/|_| \_\_____|
 *
 *
 * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
 * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 *
 * This software is licensed as described in the file COPYING, which
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
 * you should have received as part of this distribution. The terms
@@ -30,7 +30,11 @@
#elif defined(HAVE_LIBSSH_LIBSSH_H)
#elif defined(HAVE_LIBSSH_LIBSSH_H)
#include <libssh/libssh.h>
#include <libssh/libssh.h>
#include <libssh/sftp.h>
#include <libssh/sftp.h>
#endif /* HAVE_LIBSSH2_H */
#elif defined(USE_WOLFSSH)
#include <wolfssh/ssh.h>
#include <wolfssh/wolfsftp.h>
#include "wolfssh.h"
#endif


/****************************************************************************
/****************************************************************************
 * SSH unique setup
 * SSH unique setup
@@ -188,6 +192,11 @@ struct ssh_conn {
#ifdef HAVE_LIBSSH2_KNOWNHOST_API
#ifdef HAVE_LIBSSH2_KNOWNHOST_API
  LIBSSH2_KNOWNHOSTS *kh;
  LIBSSH2_KNOWNHOSTS *kh;
#endif
#endif
#elif defined(USE_WOLFSSH)
  WOLFSSH *ssh_session;
  WOLFSSH_CTX *ctx;
  word32 handleSz;
  byte handle[WOLFSSH_MAX_HANDLE];
#endif /* USE_LIBSSH */
#endif /* USE_LIBSSH */
};
};


+5 −0
Original line number Original line Diff line number Diff line
@@ -182,6 +182,11 @@ char *curl_version(void)
  left -= len;
  left -= len;
  ptr += len;
  ptr += len;
#endif
#endif
#ifdef USE_WOLFSSH
  len = msnprintf(ptr, left, " wolfssh/%s", LIBWOLFSSH_VERSION_STRING);
  left -= len;
  ptr += len;
#endif
#ifdef USE_NGHTTP2
#ifdef USE_NGHTTP2
  len = Curl_http2_ver(ptr, left);
  len = Curl_http2_ver(ptr, left);
  left -= len;
  left -= len;
Loading