]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: ssl: fix build on OpenSSL 1.0.0
authorWilly Tarreau <w@1wt.eu>
Thu, 19 Jan 2017 16:04:02 +0000 (17:04 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 Jan 2017 16:27:57 +0000 (17:27 +0100)
After the code was ported to support 1.1.0, this one broke on 1.0.0 :

  src/shctx.c:406: undefined reference to `SSL_SESSION_set1_id_context'

The function was indeed introduced only in 1.0.1. The build was validated
with 0.9.8, 1.0.0, 1.0.1, 1.0.2 and 1.1.0.

This fix must be backported to 1.7.

include/proto/openssl-compat.h

index 645c9b71558ed3c0799b44b48b2cd17904f0290b..e2154f7efb1c28f73ad97586db1879be727360cd 100644 (file)
@@ -56,16 +56,7 @@ static inline void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, const void
 
 
 #if (OPENSSL_VERSION_NUMBER < 0x1000000fL)
-/*
- * Functions introduced in OpenSSL 1.0.1
- */
-static inline int SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx, unsigned int sid_ctx_len)
-{
-       s->sid_ctx_length = sid_ctx_len;
-       memcpy(s->sid_ctx, sid_ctx, sid_ctx_len);
-       return 1;
-}
-
+/* Functions introduced in OpenSSL 1.0.0 */
 static inline int EVP_PKEY_base_id(const EVP_PKEY *pkey)
 {
        return EVP_PKEY_type(pkey->type);
@@ -86,6 +77,18 @@ static inline int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, const unsigned ch
 
 #endif
 
+#if (OPENSSL_VERSION_NUMBER < 0x1000100fL)
+/*
+ * Functions introduced in OpenSSL 1.0.1
+ */
+static inline int SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx, unsigned int sid_ctx_len)
+{
+       s->sid_ctx_length = sid_ctx_len;
+       memcpy(s->sid_ctx, sid_ctx, sid_ctx_len);
+       return 1;
+}
+#endif
+
 #if (OPENSSL_VERSION_NUMBER < 0x1010000fL) || defined(LIBRESSL_VERSION_NUMBER)
 /*
  * Functions introduced in OpenSSL 1.1.0 and not yet present in LibreSSL