Skip to content

Commit

Permalink
Merge pull request #46 from AlwinEsch/Matrix-change
Browse files Browse the repository at this point in the history
[Matrix] cleanup and depends updates
  • Loading branch information
AlwinEsch committed Jan 8, 2020
2 parents 40e4a41 + ce4aded commit c738ea4
Show file tree
Hide file tree
Showing 31 changed files with 239 additions and 344 deletions.
9 changes: 1 addition & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
cmake_minimum_required(VERSION 3.5)
project(vfs.sftp)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})

find_package(Kodi REQUIRED)
find_package(p8-platform REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(SSH REQUIRED)
find_package(ZLIB REQUIRED)

include_directories(${KODI_INCLUDE_DIR}/..
${p8-platform_INCLUDE_DIRS}
${SSH_INCLUDE_DIRS})

set(SFTP_SOURCES src/SFTPSession.cpp
src/SFTPFile.cpp)

set(SFTP_HEADERS src/SFTPSession.h)

set(DEPLIBS ${p8-platform_LIBRARIES}
set(DEPLIBS ${OPENSSL_LIBRARIES}
${SSH_LIBRARIES}
${OPENSSL_LIBRARIES}
${ZLIB_LIBRARIES})

add_definitions( -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
Expand Down
3 changes: 2 additions & 1 deletion depends/common/libssh/01-removelegacy.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -134,7 +134,6 @@
@@ -114,7 +114,6 @@ set(libssh_SRCS
kex.c
known_hosts.c
knownhosts.c
- legacy.c
log.c
match.c
messages.c

18 changes: 0 additions & 18 deletions depends/common/libssh/02-build-static.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/include/libssh/wrapper.h
+++ b/include/libssh/wrapper.h
@@ -74,7 +74,7 @@
@@ -66,7 +66,7 @@ struct ssh_cipher_struct;
struct ssh_crypto_struct;

typedef struct ssh_mac_ctx_struct *ssh_mac_ctx;
Expand All @@ -11,7 +11,7 @@

--- a/src/libcrypto.c
+++ b/src/libcrypto.c
@@ -316,7 +316,7 @@
@@ -316,7 +316,7 @@ void sha512(const unsigned char *digest, int len, unsigned char *hash)
}
}

Expand All @@ -22,7 +22,7 @@
MD5CTX c = EVP_MD_CTX_create();
--- a/src/libgcrypt.c
+++ b/src/libgcrypt.c
@@ -198,7 +198,7 @@
@@ -198,7 +198,7 @@ void sha512(const unsigned char *digest, int len, unsigned char *hash) {
gcry_md_hash_buffer(GCRY_MD_SHA512, hash, digest, len);
}

Expand All @@ -33,7 +33,7 @@

--- a/src/libmbedcrypto.c
+++ b/src/libmbedcrypto.c
@@ -338,7 +338,7 @@
@@ -338,7 +338,7 @@ void sha512(const unsigned char *digest, int len, unsigned char *hash)
}
}

Expand All @@ -44,7 +44,7 @@
int rc;
--- a/src/pki_gcrypt.c
+++ b/src/pki_gcrypt.c
@@ -256,7 +256,7 @@
@@ -256,7 +256,7 @@ static int passphrase_to_key(char *data, unsigned int datalen,
unsigned int md_not_empty;

for (j = 0, md_not_empty = 0; j < keylen; ) {
Expand All @@ -55,7 +55,7 @@
}
--- a/src/session.c
+++ b/src/session.c
@@ -987,7 +987,7 @@
@@ -1003,7 +1003,7 @@ int ssh_get_pubkey_hash(ssh_session session, unsigned char **hash)
return SSH_ERROR;
}

Expand All @@ -64,7 +64,7 @@
if (ctx == NULL) {
SAFE_FREE(h);
return SSH_ERROR;
@@ -1177,7 +1177,7 @@
@@ -1193,7 +1193,7 @@ int ssh_get_publickey_hash(const ssh_key key,
goto out;
}

Expand All @@ -73,3 +73,4 @@
if (ctx == NULL) {
free(h);
rc = -1;

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/CompilerChecks.cmake
+++ b/CompilerChecks.cmake
@@ -66,20 +66,20 @@
@@ -67,20 +67,20 @@ if (UNIX)
endif()
endif()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/src/misc.c
+++ b/src/misc.c
@@ -215,6 +215,9 @@
@@ -240,6 +240,9 @@ int ssh_is_ipaddr(const char *str) {

char *ssh_get_user_home_dir(void)
{
Expand All @@ -10,15 +10,15 @@
char *szPath = NULL;
struct passwd pwd;
struct passwd *pwdbuf = NULL;
@@ -235,6 +238,7 @@
@@ -260,6 +263,7 @@ char *ssh_get_user_home_dir(void)
szPath = strdup(pwd.pw_dir);

return szPath;
+#endif
}

/* we have read access on file */
@@ -249,6 +253,17 @@
@@ -299,6 +303,17 @@ int ssh_dir_writeable(const char *path)

char *ssh_get_local_username(void)
{
Expand All @@ -36,7 +36,7 @@
struct passwd pwd;
struct passwd *pwdbuf = NULL;
char buf[NSS_BUFLEN_PASSWD];
@@ -262,6 +277,7 @@
@@ -312,6 +327,7 @@ char *ssh_get_local_username(void)

name = strdup(pwd.pw_name);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/include/libssh/sftp.h
+++ b/include/libssh/sftp.h
@@ -57,7 +57,7 @@
@@ -57,7 +57,7 @@ extern "C" {
# ifndef _SSIZE_T_DEFINED
# undef ssize_t
# include <BaseTsd.h>
Expand All @@ -11,8 +11,8 @@

--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -372,7 +372,7 @@
-D_GNU_SOURCE)
@@ -384,7 +384,7 @@ if (BUILD_STATIC_LIB)
add_library(ssh::static ALIAS ssh-static)

if (MSVC)
- set(OUTPUT_SUFFIX static)
Expand Down Expand Up @@ -48,3 +48,4 @@
#include <winsock2.h>
#include <ws2tcpip.h>
#if _MSC_VER >= 1400

Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
--- a/CompilerChecks.cmake
+++ b/CompilerChecks.cmake
@@ -105,6 +105,7 @@
add_c_compiler_flag("/D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("/D _CRT_NONSTDC_NO_WARNINGS=1" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("/D _CRT_SECURE_NO_WARNINGS=1" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("/D _WINSOCK_DEPRECATED_NO_WARNINGS=1" SUPPORTED_COMPILER_FLAGS)
endif()

# This removes this annoying warning
--- a/src/external/curve25519_ref.c
+++ b/src/external/curve25519_ref.c
@@ -61,7 +61,14 @@
@@ -61,7 +61,14 @@ static void freeze(unsigned int a[32])

for (j = 0;j < 32;++j) aorig[j] = a[j];
add(a,a,minusp);
Expand All @@ -27,7 +17,7 @@

--- a/src/external/fe25519.c
+++ b/src/external/fe25519.c
@@ -87,7 +87,14 @@
@@ -87,7 +87,14 @@ void fe25519_freeze(fe25519 *r)
}
m &= ge(r->v[0],237);

Expand All @@ -42,7 +32,7 @@

r->v[31] -= m&127;
for (i = 30; i > 0; i--) {
@@ -159,7 +166,14 @@
@@ -159,7 +166,14 @@ void fe25519_cmov(fe25519 *r, const fe25519 *x, unsigned char b)
int i;
uint32_t mask = b;

Expand Down Expand Up @@ -78,23 +68,23 @@
char tmp[MAX_PATH] = {0};
char *szPath = NULL;

@@ -117,6 +122,7 @@
@@ -117,6 +122,7 @@ char *ssh_get_user_home_dir(void) {
strcpy(szPath, tmp);
return szPath;
}
+#endif

return NULL;
}
@@ -147,6 +153,7 @@
@@ -172,6 +178,7 @@ int gettimeofday(struct timeval *__p, void *__t) {
}

char *ssh_get_local_username(void) {
+#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_APP)
DWORD size = 0;
char *user;

@@ -161,6 +168,7 @@
@@ -186,6 +193,7 @@ char *ssh_get_local_username(void) {
if (GetUserName(user, &size)) {
return user;
}
Expand All @@ -104,7 +94,7 @@
}
--- a/src/options.c
+++ b/src/options.c
@@ -1667,7 +1667,7 @@
@@ -1674,7 +1674,7 @@ int ssh_bind_options_set(ssh_bind sshbind, enum ssh_bind_options_e type,
int key_type;
ssh_key key;
ssh_key *bind_key_loc = NULL;
Expand All @@ -113,14 +103,4 @@

rc = ssh_pki_import_privkey_file(value, NULL, NULL, NULL, &key);
if (rc != SSH_OK) {
--- a/src/pki_container_openssh.c
+++ b/src/pki_container_openssh.c
@@ -112,7 +112,7 @@
char passphrase_buffer[128];
size_t key_material_len;
ssh_buffer buffer;
- ssh_string salt;
+ ssh_string salt = NULL;
uint32_t rounds;
int cmp;
int rc;

Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
--- a/CompilerChecks.cmake
+++ b/CompilerChecks.cmake
@@ -106,6 +106,7 @@ if (MSVC)
add_c_compiler_flag("/D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("/D _CRT_NONSTDC_NO_WARNINGS=1" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("/D _CRT_SECURE_NO_WARNINGS=1" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("/D _WINSOCK_DEPRECATED_NO_WARNINGS=1" SUPPORTED_COMPILER_FLAGS)
endif()

# This removes this annoying warning
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -77,6 +77,15 @@
@@ -74,6 +74,15 @@ if (WIN32)
endif (WIN32)

if (OPENSSL_FOUND)
Expand All @@ -16,7 +26,7 @@
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
check_include_file(openssl/des.h HAVE_OPENSSL_DES_H)
if (NOT HAVE_OPENSSL_DES_H)
@@ -104,35 +113,35 @@
@@ -101,53 +110,53 @@ if (OPENSSL_FOUND)
check_include_file(openssl/ecdsa.h HAVE_OPENSSL_ECDSA_H)

set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
Expand Down Expand Up @@ -56,7 +66,39 @@

set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
+ set(CMAKE_REQUIRED_LIBRARIES ${LIBSSH_LINK_LIBRARIES})
check_function_exists(FIPS_mode HAVE_OPENSSL_FIPS_MODE)

set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
+ set(CMAKE_REQUIRED_LIBRARIES ${LIBSSH_LINK_LIBRARIES})
check_function_exists(RAND_priv_bytes HAVE_OPENSSL_RAND_PRIV_BYTES)

set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
+ set(CMAKE_REQUIRED_LIBRARIES ${LIBSSH_LINK_LIBRARIES})
check_function_exists(EVP_DigestSign HAVE_OPENSSL_EVP_DIGESTSIGN)

set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
+ set(CMAKE_REQUIRED_LIBRARIES ${LIBSSH_LINK_LIBRARIES})
check_function_exists(EVP_DigestVerify HAVE_OPENSSL_EVP_DIGESTVERIFY)

check_function_exists(OPENSSL_ia32cap_loc HAVE_OPENSSL_IA32CAP_LOC)

set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
+ set(CMAKE_REQUIRED_LIBRARIES ${LIBSSH_LINK_LIBRARIES})
check_symbol_exists(EVP_PKEY_ED25519 "openssl/evp.h" FOUND_OPENSSL_ED25519)

if (HAVE_OPENSSL_EVP_DIGESTSIGN AND HAVE_OPENSSL_EVP_DIGESTVERIFY AND
@@ -156,7 +165,7 @@ if (OPENSSL_FOUND)
endif()

set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
+ set(CMAKE_REQUIRED_LIBRARIES ${LIBSSH_LINK_LIBRARIES})
check_symbol_exists(EVP_PKEY_X25519 "openssl/evp.h" HAVE_OPENSSL_X25519)

unset(CMAKE_REQUIRED_INCLUDES)

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -380,6 +380,9 @@
@@ -402,6 +402,9 @@ if (NOT WIN32)
}" HAVE_UNUSED_ATTRIBUTE)
endif()

Expand All @@ -10,7 +10,7 @@
check_c_source_compiles("
#include <string.h>

@@ -418,9 +421,6 @@
@@ -440,9 +443,6 @@ int main(void) {
}" HAVE_GCC_BOUNDED_ATTRIBUTE)
endif(OPENBSD)

Expand All @@ -20,3 +20,4 @@
# Check for version script support
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 {
global: sym;

0 comments on commit c738ea4

Please sign in to comment.