1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-21 14:00:51 +03:00

build: be friendly with 3rd-party build tools

After recent build changes, 3rd party build that took the list of
C source to compile them as-is, stopped working as expected, due to
`blowfish.c` and crypto-backend C sources no longer expected to compile
separately but via `bcrypt_pbkdf.c` and `crypto.c`, respectively.

This patch ensures that compiling these files directly result in an
empty object instead of redundant code and duplicated symbols.

Also:
- add a compile-time error if none of the supported crypto backends
  are enabled.
- fix `libssh2_crypto_engine()` for wolfSSL and os400qc3.
  Rearrange code to avoid a hard-to-find copy of crypto-backend
  selection guards.

Follow-up to 4f0f4bff5a
Follow-up to ff3c774e03

Closes #951
This commit is contained in:
Viktor Szakats
2023-04-12 09:17:10 +00:00
parent fe02bd2b2d
commit 73d95a055c
16 changed files with 38 additions and 47 deletions

View File

@@ -35,9 +35,7 @@
* OF SUCH DAMAGE.
*/
#include "libssh2_priv.h"
#ifdef LIBSSH2_MBEDTLS /* compile only if we build with mbedtls */
#ifdef LIBSSH2_CRYPTO_C /* Compile this via crypto.c */
#if MBEDTLS_VERSION_NUMBER < 0x03000000
#define mbedtls_cipher_info_get_key_bitlen(c) (c->key_bitlen)
@@ -1456,4 +1454,4 @@ _libssh2_supported_key_sign_algorithms(LIBSSH2_SESSION *session,
}
#endif /* LIBSSH2_ECDSA */
#endif /* LIBSSH2_MBEDTLS */
#endif /* LIBSSH2_CRYPTO_C */