From b5ea440ddf1e0366e7dffdf5a929e34eac628363 Mon Sep 17 00:00:00 2001
From: Emmanuel Hocdet <manu@gandi.net>
Date: Mon, 18 Jun 2018 11:04:19 +0200
Subject: [PATCH] MINOR: ssl: BoringSSL matches OpenSSL 1.1.0

Since BoringSSL 3b2ff028, API now correctly match OpenSSL 1.1.0.
The patch revert part of haproxy 019f9b10: "Fix BoringSSL call and
openssl-compat.h/#define occordingly.".
This will not break openssl/libressl compat.
---
 include/proto/openssl-compat.h | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/include/proto/openssl-compat.h b/include/proto/openssl-compat.h
index b6fe1d2c1..8fe1c183c 100644
--- a/include/proto/openssl-compat.h
+++ b/include/proto/openssl-compat.h
@@ -89,9 +89,9 @@ static inline int SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned cha
 }
 #endif
 
-#if (OPENSSL_VERSION_NUMBER < 0x1010000fL) || defined(LIBRESSL_VERSION_NUMBER) || defined(OPENSSL_IS_BORINGSSL)
+#if (OPENSSL_VERSION_NUMBER < 0x1010000fL) || defined(LIBRESSL_VERSION_NUMBER)
 /*
- * Functions introduced in OpenSSL 1.1.0 and not yet present in LibreSSL / BoringSSL
+ * Functions introduced in OpenSSL 1.1.0 and not yet present in LibreSSL
  */
 
 static inline const unsigned char *SSL_SESSION_get0_id_context(const SSL_SESSION *sess, unsigned int *sid_ctx_length)
@@ -107,11 +107,6 @@ static inline int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid,
 	return 1;
 }
 
-static inline X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x)
-{
-	return x->cert_info->signature;
-}
-
 #if (!defined OPENSSL_NO_OCSP)
 static inline const OCSP_CERTID *OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *single)
 {
@@ -119,13 +114,6 @@ static inline const OCSP_CERTID *OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *
 }
 #endif
 
-#endif
-
-#if (OPENSSL_VERSION_NUMBER < 0x1010000fL) || defined(LIBRESSL_VERSION_NUMBER)
-/*
- * Functions introduced in OpenSSL 1.1.0 and not yet present in LibreSSL
- */
-
 static inline pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx)
 {
 	return ctx->default_passwd_callback;
@@ -151,6 +139,11 @@ static inline const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x)
 	return x->data;
 }
 
+static inline X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x)
+{
+	return x->cert_info->signature;
+}
+
 #endif
 
 #if (OPENSSL_VERSION_NUMBER >= 0x1010000fL)
-- 
2.11.0

