]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: fix ssl_sample.c when building against BoringSSL
authorIlya Shipitsin <chipitsine@gmail.com>
Sat, 20 Jun 2020 18:38:37 +0000 (23:38 +0500)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 26 Jun 2020 08:33:38 +0000 (10:33 +0200)
BoringSSL does not have X509_get_X509_PUBKEY
let our emulation level define that for BoringSSL as well

Build log:

src/ssl_sample.o: In function `smp_fetch_ssl_x_key_alg':
/home/travis/build/haproxy/haproxy/src/ssl_sample.c:592: undefined reference to `X509_get_X509_PUBKEY'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:860: recipe for target 'haproxy' failed
make: *** [haproxy] Error 1

travis-ci: https://travis-ci.com/github/haproxy/haproxy/jobs/351670996

include/haproxy/openssl-compat.h

index 34fe6cb76e75ea90bfd3c56336360ddb1928c24d..acdc9c5bcf4bc30560980b237ac8a16977dcd70b 100644 (file)
@@ -81,6 +81,9 @@ static inline void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, const void
 
 #endif // OpenSSL < 0.9.8
 
+#if (((HA_OPENSSL_VERSION_NUMBER < 0x1000000fL) || defined(OPENSSL_IS_BORINGSSL)) && !defined(X509_get_X509_PUBKEY))
+#define X509_get_X509_PUBKEY(x) ((x)->cert_info->key)
+#endif
 
 #if (HA_OPENSSL_VERSION_NUMBER < 0x1000000fL)
 /* Functions introduced in OpenSSL 1.0.0 */
@@ -98,10 +101,6 @@ static inline int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, const unsigned ch
        return 1;
 }
 
-#ifndef X509_get_X509_PUBKEY
-#define X509_get_X509_PUBKEY(x) ((x)->cert_info->key
-#endif
-
 #endif
 
 #if (HA_OPENSSL_VERSION_NUMBER < 0x1000100fL)