[packages/stunserver] - release 3 (openssl buildfix)

adamg adamg at pld-linux.org
Wed Sep 26 14:42:42 CEST 2018


commit b11f12112ce2ea0f3554ca82d2f4361c041fd036
Author: Adam Gołębiowski <adamg at pld-linux.org>
Date:   Wed Sep 26 14:42:03 2018 +0200

    - release 3 (openssl buildfix)

 stunserver-openssl.patch | 112 +++++++++++++++++++++++++++++++++++++++++++++++
 stunserver.spec          |   4 +-
 2 files changed, 115 insertions(+), 1 deletion(-)
---
diff --git a/stunserver.spec b/stunserver.spec
index 9d5a965..a4b48f5 100644
--- a/stunserver.spec
+++ b/stunserver.spec
@@ -5,13 +5,14 @@
 Summary:	STUNTMAN STUN server
 Name:		stunserver
 Version:	1.2.9
-Release:	2
+Release:	3
 License:	Apache v2.0
 Group:		Networking/Daemons
 Source0:	http://www.stunprotocol.org/%{name}-%{version}.tgz
 # Source0-md5:	cfd13029362997c1d6e3299b38d520d6
 Source1:	%{name}.service
 Source2:	%{name}.sysconfig
+Patch0:		%{name}-openssl.patch
 URL:		http://www.stunprotocol.org/
 BuildRequires:	rpmbuild(macros) >= 1.647
 Requires(post,preun,postun):	systemd-units >= 38
@@ -39,6 +40,7 @@ This package contains the client application.
 
 %prep
 %setup -qn %{name}
+%patch0 -p1
 
 %build
 %{__make} \
diff --git a/stunserver-openssl.patch b/stunserver-openssl.patch
new file mode 100644
index 0000000..ea09a25
--- /dev/null
+++ b/stunserver-openssl.patch
@@ -0,0 +1,112 @@
+From 0503e128de001b8f8a180f14d4599c4a608c72a8 Mon Sep 17 00:00:00 2001
+From: mkm85 <mkm85 at users.noreply.github.com>
+Date: Fri, 5 May 2017 08:21:57 +0200
+Subject: [PATCH] made it possible to compile with openssl 1.0.2 (#21)
+
+* made it possible to compile with openssl 1.1
+
+* Initiated variables to something default
+---
+ stuncore/stunreader.cpp | 45 ++++++++++++++++++++++++++++-------------
+ 1 file changed, 31 insertions(+), 14 deletions(-)
+
+diff --git a/stuncore/stunreader.cpp b/stuncore/stunreader.cpp
+index adbe66b..cff1c2e 100644
+--- a/stuncore/stunreader.cpp
++++ b/stuncore/stunreader.cpp
+@@ -153,9 +153,19 @@ HRESULT CStunMessageReader::ValidateMessageIntegrity(uint8_t* key, size_t keylen
+     uint8_t hmaccomputed[c_hmacsize] = {}; // zero-init
+     unsigned int hmaclength = c_hmacsize;
+ #ifndef __APPLE__
+-    HMAC_CTX ctx = {};
++    HMAC_CTX* ctx = NULL;
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
++    HMAC_CTX ctxData = {};
++    ctx = &ctxData;
++    HMAC_CTX_init(ctx);
+ #else
+-    CCHmacContext ctx = {};
++    ctx = HMAC_CTX_new();
++#endif
++#else
++    CCHmacContext* ctx = NULL;
++    CCHmacContext ctxData = {};
++    ctx = &ctxData;
++    
+     UNREFERENCED_VARIABLE(hmaclength);
+ #endif
+     uint32_t chunk32;
+@@ -195,19 +205,22 @@ HRESULT CStunMessageReader::ValidateMessageIntegrity(uint8_t* key, size_t keylen
+     
+     // Here comes the fun part.  If there is a fingerprint attribute, we have to adjust the length header in computing the hash
+ #ifndef __APPLE__
+-    HMAC_CTX_init(&ctx);
+-    HMAC_Init(&ctx, key, keylength, EVP_sha1());
++#if OPENSSL_VERSION_NUMBER < 0x10100000L // could be lower!
++    HMAC_Init(ctx, key, keylength, EVP_sha1());
+ #else
+-    CCHmacInit(&ctx, kCCHmacAlgSHA1, key, keylength);
++    HMAC_Init_ex(ctx, key, keylength, EVP_sha1(), NULL);
++#endif
++#else
++    CCHmacInit(ctx, kCCHmacAlgSHA1, key, keylength);
+ #endif
+     fContextInit = true;
+     
+     // message type
+     Chk(stream.ReadUint16(&chunk16));
+ #ifndef __APPLE__
+-    HMAC_Update(&ctx, (unsigned char*)&chunk16, sizeof(chunk16));
++    HMAC_Update(ctx, (unsigned char*)&chunk16, sizeof(chunk16));
+ #else
+-    CCHmacUpdate(&ctx, &chunk16, sizeof(chunk16));
++    CCHmacUpdate(ctx, &chunk16, sizeof(chunk16));
+ #endif
+     
+     // message length
+@@ -225,9 +238,9 @@ HRESULT CStunMessageReader::ValidateMessageIntegrity(uint8_t* key, size_t keylen
+     }
+     
+ #ifndef __APPLE__
+-    HMAC_Update(&ctx, (unsigned char*)&chunk16, sizeof(chunk16));
++    HMAC_Update(ctx, (unsigned char*)&chunk16, sizeof(chunk16));
+ #else
+-    CCHmacUpdate(&ctx, &chunk16, sizeof(chunk16));
++    CCHmacUpdate(ctx, &chunk16, sizeof(chunk16));
+ #endif
+     
+     // now include everything up to the hash attribute itself.
+@@ -243,16 +256,16 @@ HRESULT CStunMessageReader::ValidateMessageIntegrity(uint8_t* key, size_t keylen
+     {
+         Chk(stream.ReadUint32(&chunk32));
+ #ifndef __APPLE__
+-        HMAC_Update(&ctx, (unsigned char*)&chunk32, sizeof(chunk32));
++        HMAC_Update(ctx, (unsigned char*)&chunk32, sizeof(chunk32));
+ #else
+-        CCHmacUpdate(&ctx, &chunk32, sizeof(chunk32));
++        CCHmacUpdate(ctx, &chunk32, sizeof(chunk32));
+ #endif
+     }
+     
+ #ifndef __APPLE__
+-    HMAC_Final(&ctx, hmaccomputed, &hmaclength);
++    HMAC_Final(ctx, hmaccomputed, &hmaclength);
+ #else
+-    CCHmacFinal(&ctx, hmaccomputed);
++    CCHmacFinal(ctx, hmaccomputed);
+ #endif
+     
+     
+@@ -265,7 +278,11 @@ HRESULT CStunMessageReader::ValidateMessageIntegrity(uint8_t* key, size_t keylen
+     if (fContextInit)
+     {
+ #ifndef __APPLE__
+-        HMAC_CTX_cleanup(&ctx);
++#if OPENSSL_VERSION_NUMBER < 0x10100000L
++        HMAC_CTX_cleanup(ctx);
++#else
++        HMAC_CTX_free(ctx);
++#endif
+ #else
+         UNREFERENCED_VARIABLE(fContextInit);
+ #endif
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/stunserver.git/commitdiff/b11f12112ce2ea0f3554ca82d2f4361c041fd036



More information about the pld-cvs-commit mailing list