[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 03/11] build: omit libcrypto-compat.{c,h} when OPENSSL_IS_BORINGSSL
[Thread Prev] | [Thread Next]
- Subject: [PATCH 03/11] build: omit libcrypto-compat.{c,h} when OPENSSL_IS_BORINGSSL
- From: Jon Simons <jon@xxxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Sat, 9 Sep 2017 20:12:46 -0700
- To: libssh@xxxxxxxxxx
- Cc: Jon Simons <jon@xxxxxxxxxxxxx>
The libcrypto-compat.{c,h} files should never be used when building with BoringSSL, so ensure to error out if they are ever used when OPENSSL_IS_BORINGSSL is set. Signed-off-by: Jon Simons <jon@xxxxxxxxxxxxx> --- src/CMakeLists.txt | 4 +++- src/libcrypto-compat.c | 4 ++++ src/libcrypto-compat.h | 4 ++++ src/libcrypto.c | 3 +++ src/pki_crypto.c | 3 +++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e5a93538..489e4ab4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -168,7 +168,9 @@ else (WITH_GCRYPT) libcrypto.c ) if(OPENSSL_VERSION VERSION_LESS "1.1.0") - set(libssh_SRCS ${libssh_SRCS} libcrypto-compat.c) + if (NOT WITH_BORINGSSL) + set(libssh_SRCS ${libssh_SRCS} libcrypto-compat.c) + endif (NOT WITH_BORINGSSL) endif() endif (WITH_GCRYPT) diff --git a/src/libcrypto-compat.c b/src/libcrypto-compat.c index 45dffbb4..e0de8fce 100644 --- a/src/libcrypto-compat.c +++ b/src/libcrypto-compat.c @@ -13,6 +13,10 @@ #include <openssl/engine.h> #include "libcrypto-compat.h" +#if defined(OPENSSL_IS_BORINGSSL) +#error "OpenSSL libcrypto compat used for BoringSSL build" +#endif /* defined(OPENSSL_IS_BORINGSSL) */ + static void *OPENSSL_zalloc(size_t num) { void *ret = OPENSSL_malloc(num); diff --git a/src/libcrypto-compat.h b/src/libcrypto-compat.h index 21542c65..dd04e739 100644 --- a/src/libcrypto-compat.h +++ b/src/libcrypto-compat.h @@ -4,6 +4,10 @@ #include <openssl/opensslv.h> #if OPENSSL_VERSION_NUMBER < 0x10100000L +#if defined(OPENSSL_IS_BORINGSSL) +#error "OpenSSL libcrypto compat header used for BoringSSL build" +#endif /* defined(OPENSSL_IS_BORINGSSL) */ + #include <openssl/rsa.h> #include <openssl/dsa.h> #include <openssl/ecdsa.h> diff --git a/src/libcrypto.c b/src/libcrypto.c index 59c99568..59f87e0c 100644 --- a/src/libcrypto.c +++ b/src/libcrypto.c @@ -43,7 +43,10 @@ #include <openssl/hmac.h> #include <openssl/opensslv.h> #include <openssl/rand.h> + +#if !defined(OPENSSL_IS_BORINGSSL) #include "libcrypto-compat.h" +#endif /* !defined(OPENSSL_IS_BORINGSSL) */ #ifdef HAVE_OPENSSL_AES_H #define HAS_AES diff --git a/src/pki_crypto.c b/src/pki_crypto.c index 70ac6854..f5e8fb09 100644 --- a/src/pki_crypto.c +++ b/src/pki_crypto.c @@ -31,7 +31,10 @@ #include <openssl/dsa.h> #include <openssl/err.h> #include <openssl/rsa.h> + +#if !defined(OPENSSL_IS_BORINGSSL) #include "libcrypto-compat.h" +#endif /* !defined(OPENSSL_IS_BORINGSSL) */ #ifdef HAVE_OPENSSL_EC_H #include <openssl/ec.h> -- 2.14.1
[PATCH 00/11] libssh: enable building with BoringSSL | Jon Simons <jon@xxxxxxxxxxxxx> |