diff -U 3 -dHrN -- a/configure b/configure --- a/configure 2014-12-18 20:10:07.000000000 +0100 +++ b/configure 2017-04-18 18:18:13.352468714 +0200 @@ -3,7 +3,7 @@ # create freepascal Makefile to build skychart # # syntaxe : -# ./configure [fpcbin=path_to_fpc_binaries] [fpc=path_to_fpc_units] [lazarus=path_to_lazarus] [prefix=install_path] [target=fpcmake_target] +# ./configure [fpcbin=path_to_fpc_binaries] [fpc=path_to_fpc_units] [lazarus=path_to_lazarus] [prefix=install_path] [target=fpcmake_target] [withSSL=SSL_library_name] [withCrypto=Crypto_library_name] # # set parameters @@ -142,6 +142,28 @@ sed "s#%PREFIX%#$prefix#" Makefile.in > Makefile cd $basedir +# Check OpenSSL version installed +OPENSSL_VER="$(eval openssl version)" + +if [[ ${OPENSSL_VER} == *"OpenSSL 1.1"* ]]; then + sed -i "s/{{V23orTLS}}/SslMethodTLS/" skychart/component/synapse/source/lib/ssl_openssl.pas +else + sed -i "s/{{V23orTLS}}/SslMethodV23/" skychart/component/synapse/source/lib/ssl_openssl.pas +fi +echo using ${OPENSSL_VER} + +# OpenSSL library filenames +if [ "$withSSL" ]; then + sed -i "s/libssl.so/$withSSL/" skychart/component/synapse/source/lib/ssl_openssl_lib.pas + echo using $withSSL as DLLSSLName +fi + +if [ "$withCrypto" ]; then + sed -i "s/libcrypto.so/$withCrypto/" skychart/component/synapse/source/lib/ssl_openssl_lib.pas + echo using $withCrypto as DLLUtilName +fi + + echo echo You can now build with: echo make clean all diff -U 3 -dHrN -- a/skychart/component/synapse/source/lib/blcksock.pas b/skychart/component/synapse/source/lib/blcksock.pas --- a/skychart/component/synapse/source/lib/blcksock.pas 2015-07-31 10:48:21.000000000 +0200 +++ b/skychart/component/synapse/source/lib/blcksock.pas 2017-04-18 18:18:49.008477059 +0200 @@ -240,8 +240,10 @@ {:Specify requested SSL/TLS version for secure connection.} TSSLType = ( LT_all, + LT_SSLv23, LT_SSLv2, LT_SSLv3, + LT_TLS, LT_TLSv1, LT_TLSv1_1, LT_TLSv1_2, diff -U 3 -dHrN -- a/skychart/component/synapse/source/lib/ssl_openssl_lib.pas b/skychart/component/synapse/source/lib/ssl_openssl_lib.pas --- a/skychart/component/synapse/source/lib/ssl_openssl_lib.pas 2017-03-05 10:27:48.000000000 +0100 +++ b/skychart/component/synapse/source/lib/ssl_openssl_lib.pas 2017-04-18 18:22:09.316476706 +0200 @@ -313,6 +313,11 @@ [DllImport(DLLSSLName, CharSet = CharSet.Ansi, SetLastError = False, CallingConvention= CallingConvention.cdecl, + EntryPoint = 'TLS_method')] + function SslMethodTLS : PSSL_METHOD; external; + + [DllImport(DLLSSLName, CharSet = CharSet.Ansi, + SetLastError = False, CallingConvention= CallingConvention.cdecl, EntryPoint = 'SSL_CTX_use_PrivateKey')] function SslCtxUsePrivateKey(ctx: PSSL_CTX; pkey: SslPtr):Integer; external; @@ -719,6 +724,7 @@ function SslMethodTLSV11:PSSL_METHOD; function SslMethodTLSV12:PSSL_METHOD; function SslMethodV23:PSSL_METHOD; + function SslMethodTLS:PSSL_METHOD; function SslCtxUsePrivateKey(ctx: PSSL_CTX; pkey: SslPtr):Integer; function SslCtxUsePrivateKeyASN1(pk: integer; ctx: PSSL_CTX; d: AnsiString; len: integer):Integer; // function SslCtxUsePrivateKeyFile(ctx: PSSL_CTX; const _file: PChar; _type: Integer):Integer; @@ -847,6 +853,7 @@ TSslMethodTLSV11 = function:PSSL_METHOD; cdecl; TSslMethodTLSV12 = function:PSSL_METHOD; cdecl; TSslMethodV23 = function:PSSL_METHOD; cdecl; + TSslMethodTLS = function:PSSL_METHOD; cdecl; TSslCtxUsePrivateKey = function(ctx: PSSL_CTX; pkey: sslptr):Integer; cdecl; TSslCtxUsePrivateKeyASN1 = function(pk: integer; ctx: PSSL_CTX; d: sslptr; len: integer):Integer; cdecl; TSslCtxUsePrivateKeyFile = function(ctx: PSSL_CTX; const _file: PAnsiChar; _type: Integer):Integer; cdecl; @@ -954,6 +961,7 @@ _SslMethodTLSV11: TSslMethodTLSV11 = nil; _SslMethodTLSV12: TSslMethodTLSV12 = nil; _SslMethodV23: TSslMethodV23 = nil; + _SslMethodTLS: TSslMethodTLS = nil; _SslCtxUsePrivateKey: TSslCtxUsePrivateKey = nil; _SslCtxUsePrivateKeyASN1: TSslCtxUsePrivateKeyASN1 = nil; _SslCtxUsePrivateKeyFile: TSslCtxUsePrivateKeyFile = nil; @@ -1154,6 +1162,14 @@ Result := nil; end; +function SslMethodTLS:PSSL_METHOD; +begin + if InitSSLInterface and Assigned(_SslMethodTLS) then + Result := _SslMethodTLS + else + Result := nil; +end; + function SslCtxUsePrivateKey(ctx: PSSL_CTX; pkey: SslPtr):Integer; begin if InitSSLInterface and Assigned(_SslCtxUsePrivateKey) then @@ -1907,6 +1923,7 @@ _SslMethodTLSV11 := GetProcAddr(SSLLibHandle, 'TLSv1_1_method'); _SslMethodTLSV12 := GetProcAddr(SSLLibHandle, 'TLSv1_2_method'); _SslMethodV23 := GetProcAddr(SSLLibHandle, 'SSLv23_method'); + _SslMethodTLS := GetProcAddr(SSLLibHandle, 'TLS_method'); _SslCtxUsePrivateKey := GetProcAddr(SSLLibHandle, 'SSL_CTX_use_PrivateKey'); _SslCtxUsePrivateKeyASN1 := GetProcAddr(SSLLibHandle, 'SSL_CTX_use_PrivateKey_ASN1'); //use SSL_CTX_use_RSAPrivateKey_file instead SSL_CTX_use_PrivateKey_file, @@ -2104,6 +2121,7 @@ _SslMethodTLSV11 := nil; _SslMethodTLSV12 := nil; _SslMethodV23 := nil; + _SslMethodTLS := nil; _SslCtxUsePrivateKey := nil; _SslCtxUsePrivateKeyASN1 := nil; _SslCtxUsePrivateKeyFile := nil; diff -U 3 -dHrN -- a/skychart/component/synapse/source/lib/ssl_openssl.pas b/skychart/component/synapse/source/lib/ssl_openssl.pas --- a/skychart/component/synapse/source/lib/ssl_openssl.pas 2015-07-31 10:48:21.000000000 +0200 +++ b/skychart/component/synapse/source/lib/ssl_openssl.pas 2017-04-18 17:43:59.300144692 +0200 @@ -424,14 +424,18 @@ Fctx := SslCtxNew(SslMethodV2); LT_SSLv3: Fctx := SslCtxNew(SslMethodV3); + LT_SSLv23: + Fctx := SslCtxNew(SslMethodV23); LT_TLSv1: Fctx := SslCtxNew(SslMethodTLSV1); LT_TLSv1_1: Fctx := SslCtxNew(SslMethodTLSV11); LT_TLSv1_2: Fctx := SslCtxNew(SslMethodTLSV12); + LT_TLS: + Fctx := SslCtxNew(SslMethodTLS); LT_all: - Fctx := SslCtxNew(SslMethodV23); + Fctx := SslCtxNew({{V23orTLS}}); else Exit; end;