OpenSSL 1.1.0 support (thanks to Patrick Chevalley)
git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@206 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
parent
dbaca3710a
commit
b8086a995c
@ -1,9 +1,9 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 001.002.001 |
|
||||
| Project : Ararat Synapse | 001.003.000 |
|
||||
|==============================================================================|
|
||||
| Content: SSL support by OpenSSL |
|
||||
|==============================================================================|
|
||||
| Copyright (c)1999-2012, Lukas Gebauer |
|
||||
| Copyright (c)1999-2017, Lukas Gebauer |
|
||||
| All rights reserved. |
|
||||
| |
|
||||
| Redistribution and use in source and binary forms, with or without |
|
||||
@ -33,7 +33,7 @@
|
||||
| DAMAGE. |
|
||||
|==============================================================================|
|
||||
| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
|
||||
| Portions created by Lukas Gebauer are Copyright (c)2005-2012. |
|
||||
| Portions created by Lukas Gebauer are Copyright (c)2005-2017. |
|
||||
| Portions created by Petr Fejfar are Copyright (c)2011-2012. |
|
||||
| All Rights Reserved. |
|
||||
|==============================================================================|
|
||||
@ -47,12 +47,12 @@
|
||||
|
||||
{:@abstract(SSL plugin for OpenSSL)
|
||||
|
||||
You need OpenSSL libraries version 0.9.7. It can work with 0.9.6 too, but
|
||||
application mysteriously crashing when you are using freePascal on Linux.
|
||||
Use Kylix on Linux is OK! If you have version 0.9.7 on Linux, then I not see
|
||||
any problems with FreePascal.
|
||||
Compatibility with OpenSSL versions:
|
||||
0.9.6 should work, known mysterious crashing on FreePascal and Linux platform.
|
||||
0.9.7 - 1.0.0 working fine.
|
||||
1.1.0 should work, under testing.
|
||||
|
||||
OpenSSL libraries are loaded dynamicly - you not need OpenSSl librares even you
|
||||
OpenSSL libraries are loaded dynamicly - you not need OpenSSL librares even you
|
||||
compile your application with this unit. SSL just not working when you not have
|
||||
OpenSSL libraries.
|
||||
|
||||
@ -431,7 +431,13 @@ begin
|
||||
LT_TLSv1_2:
|
||||
Fctx := SslCtxNew(SslMethodTLSV12);
|
||||
LT_all:
|
||||
Fctx := SslCtxNew(SslMethodV23);
|
||||
begin
|
||||
//try new call for OpenSSL 1.1.0 first
|
||||
Fctx := SslCtxNew(SslMethodTLS);
|
||||
if Fctx=nil then
|
||||
//callback to previous versions
|
||||
Fctx := SslCtxNew(SslMethodV23);
|
||||
end;
|
||||
else
|
||||
Exit;
|
||||
end;
|
||||
|
@ -1,9 +1,9 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 003.007.002 |
|
||||
| Project : Ararat Synapse | 003.008.000 |
|
||||
|==============================================================================|
|
||||
| Content: SSL support by OpenSSL |
|
||||
|==============================================================================|
|
||||
| Copyright (c)1999-2013, Lukas Gebauer |
|
||||
| Copyright (c)1999-2017, Lukas Gebauer |
|
||||
| All rights reserved. |
|
||||
| |
|
||||
| Redistribution and use in source and binary forms, with or without |
|
||||
@ -33,7 +33,7 @@
|
||||
| DAMAGE. |
|
||||
|==============================================================================|
|
||||
| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
|
||||
| Portions created by Lukas Gebauer are Copyright (c)2002-2013. |
|
||||
| Portions created by Lukas Gebauer are Copyright (c)2002-2017. |
|
||||
| Portions created by Petr Fejfar are Copyright (c)2011-2012. |
|
||||
| All Rights Reserved. |
|
||||
|==============================================================================|
|
||||
@ -311,6 +311,11 @@ var
|
||||
EntryPoint = 'SSLv23_method')]
|
||||
function SslMethodV23 : PSSL_METHOD; external;
|
||||
|
||||
[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')]
|
||||
@ -719,6 +724,7 @@ var
|
||||
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 @@ type
|
||||
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 @@ var
|
||||
_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 @@ begin
|
||||
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
|
||||
@ -1885,6 +1901,7 @@ begin
|
||||
_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,
|
||||
@ -2082,6 +2099,7 @@ begin
|
||||
_SslMethodTLSV11 := nil;
|
||||
_SslMethodTLSV12 := nil;
|
||||
_SslMethodV23 := nil;
|
||||
_SslMethodTLS := nil;
|
||||
_SslCtxUsePrivateKey := nil;
|
||||
_SslCtxUsePrivateKeyASN1 := nil;
|
||||
_SslCtxUsePrivateKeyFile := nil;
|
||||
|
Loading…
x
Reference in New Issue
Block a user