mirror of
https://github.com/libssh2/libssh2.git
synced 2025-07-29 13:01:14 +03:00
build: drop crypto.c
umbrella source
Instead build all crypto backend sources always, and exclude inactive
ones with guards.
To play better with code checkers and compilers that are blind to
included C sources, e.g. clang with certain compiler warnings and
clang-tidy.
We continue to include `blowfish.c`.
Follow-up to 4f0f4bff5a
#941
Cherry-picked from #1561
This commit is contained in:
@ -33,16 +33,14 @@ LTLIBNEWNAME variable on success.
|
||||
|
||||
0.3) Add new header to src/Makefile.inc
|
||||
|
||||
0.4) Include new source in src/crypto.c
|
||||
|
||||
0.5) Add a new block in configure.ac
|
||||
0.4) Add a new block in configure.ac
|
||||
|
||||
```
|
||||
elif test "$found_crypto" = "newname"; then
|
||||
LIBS="${LIBS} ${LTLIBNEWNAME}"
|
||||
```
|
||||
|
||||
0.6) Add CMake detection logic to CMakeLists.txt
|
||||
0.5) Add CMake detection logic to CMakeLists.txt
|
||||
|
||||
1) Crypto library initialization/termination.
|
||||
|
||||
|
@ -3,19 +3,22 @@
|
||||
CSOURCES = \
|
||||
agent.c \
|
||||
bcrypt_pbkdf.c \
|
||||
channel.c \
|
||||
comp.c \
|
||||
chacha.c \
|
||||
channel.c \
|
||||
cipher-chachapoly.c \
|
||||
comp.c \
|
||||
crypt.c \
|
||||
crypto.c \
|
||||
global.c \
|
||||
hostkey.c \
|
||||
keepalive.c \
|
||||
kex.c \
|
||||
knownhost.c \
|
||||
libgcrypt.c \
|
||||
mac.c \
|
||||
mbedtls.c \
|
||||
misc.c \
|
||||
openssl.c \
|
||||
os400qc3.c \
|
||||
packet.c \
|
||||
pem.c \
|
||||
poly1305.c \
|
||||
@ -26,7 +29,8 @@ CSOURCES = \
|
||||
transport.c \
|
||||
userauth.c \
|
||||
userauth_kbd_packet.c \
|
||||
version.c
|
||||
version.c \
|
||||
wincng.c
|
||||
|
||||
HHEADERS = \
|
||||
chacha.h \
|
||||
@ -53,9 +57,4 @@ HHEADERS = \
|
||||
wincng.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
blowfish.c \
|
||||
libgcrypt.c \
|
||||
mbedtls.c \
|
||||
openssl.c \
|
||||
os400qc3.c \
|
||||
wincng.c
|
||||
blowfish.c
|
||||
|
19
src/crypto.c
19
src/crypto.c
@ -1,19 +0,0 @@
|
||||
/* Copyright (C) Viktor Szakats
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#define LIBSSH2_CRYPTO_C
|
||||
#include "libssh2_priv.h"
|
||||
|
||||
#if defined(LIBSSH2_OPENSSL) || defined(LIBSSH2_WOLFSSL)
|
||||
#include "openssl.c"
|
||||
#elif defined(LIBSSH2_LIBGCRYPT)
|
||||
#include "libgcrypt.c"
|
||||
#elif defined(LIBSSH2_MBEDTLS)
|
||||
#include "mbedtls.c"
|
||||
#elif defined(LIBSSH2_OS400QC3)
|
||||
#include "os400qc3.c"
|
||||
#elif defined(LIBSSH2_WINCNG)
|
||||
#include "wincng.c"
|
||||
#endif
|
@ -38,7 +38,9 @@
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifdef LIBSSH2_CRYPTO_C /* Compile this via crypto.c */
|
||||
#include "libssh2_priv.h"
|
||||
|
||||
#ifdef LIBSSH2_LIBGCRYPT
|
||||
|
||||
int _libssh2_hmac_ctx_init(libssh2_hmac_ctx *ctx)
|
||||
{
|
||||
@ -860,4 +862,4 @@ _libssh2_supported_key_sign_algorithms(LIBSSH2_SESSION *session,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* LIBSSH2_CRYPTO_C */
|
||||
#endif /* LIBSSH2_LIBGCRYPT */
|
||||
|
@ -37,7 +37,9 @@
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifdef LIBSSH2_CRYPTO_C /* Compile this via crypto.c */
|
||||
#include "libssh2_priv.h"
|
||||
|
||||
#ifdef LIBSSH2_MBEDTLS
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -1532,4 +1534,4 @@ _libssh2_supported_key_sign_algorithms(LIBSSH2_SESSION *session,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* LIBSSH2_CRYPTO_C */
|
||||
#endif /* LIBSSH2_MBEDTLS */
|
||||
|
@ -39,7 +39,9 @@
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifdef LIBSSH2_CRYPTO_C /* Compile this via crypto.c */
|
||||
#include "libssh2_priv.h"
|
||||
|
||||
#if defined(LIBSSH2_OPENSSL) || defined(LIBSSH2_WOLFSSL)
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
@ -5237,4 +5239,4 @@ _libssh2_supported_key_sign_algorithms(LIBSSH2_SESSION *session,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* LIBSSH2_CRYPTO_C */
|
||||
#endif /* LIBSSH2_OPENSSL || LIBSSH2_WOLFSSL */
|
||||
|
@ -38,7 +38,9 @@
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifdef LIBSSH2_CRYPTO_C /* Compile this via crypto.c */
|
||||
#include "libssh2_priv.h"
|
||||
|
||||
#ifdef LIBSSH2_OS400QC3
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -2530,6 +2532,6 @@ _libssh2_supported_key_sign_algorithms(LIBSSH2_SESSION *session,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* LIBSSH2_CRYPTO_C */
|
||||
#endif /* LIBSSH2_OS400QC3 */
|
||||
|
||||
/* vim: set expandtab ts=4 sw=4: */
|
||||
|
@ -38,7 +38,9 @@
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifdef LIBSSH2_CRYPTO_C /* Compile this via crypto.c */
|
||||
#include "libssh2_priv.h"
|
||||
|
||||
#ifdef LIBSSH2_WINCNG
|
||||
|
||||
/* required for cross-compilation against the w64 mingw-runtime package */
|
||||
#if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0600)
|
||||
@ -4201,4 +4203,4 @@ _libssh2_supported_key_sign_algorithms(LIBSSH2_SESSION *session,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* LIBSSH2_CRYPTO_C */
|
||||
#endif /* LIBSSH2_WINCNG */
|
||||
|
Reference in New Issue
Block a user