Debian Codegraph @

plugins/wfx/ftp/synapse/ssl_openssl_ver.pas

raw
1 {==============================================================================|
2 | Project : Ararat Synapse | 003.004.001 |
3 |==============================================================================|
4 | Content: SSL support by OpenSSL |
5 |==============================================================================|
6 | Copyright (c)1999-2005, Lukas Gebauer |
7 | All rights reserved. |
8 | |
9 | Redistribution and use in source and binary forms, with or without |
10 | modification, are permitted provided that the following conditions are met: |
11 | |
12 | Redistributions of source code must retain the above copyright notice, this |
13 | list of conditions and the following disclaimer. |
14 | |
15 | Redistributions in binary form must reproduce the above copyright notice, |
16 | this list of conditions and the following disclaimer in the documentation |
17 | and/or other materials provided with the distribution. |
18 | |
19 | Neither the name of Lukas Gebauer nor the names of its contributors may |
20 | be used to endorse or promote products derived from this software without |
21 | specific prior written permission. |
22 | |
23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
26 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR |
27 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
28 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
29 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
30 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
31 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
32 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
33 | DAMAGE. |
34 |==============================================================================|
35 | The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
36 | Portions created by Lukas Gebauer are Copyright (c)2002-2005. |
37 | All Rights Reserved. |
38 |==============================================================================|
39 | Contributor(s): |
40 | Alexander Koblov |
41 | Ales Katona (Try to load all library versions until you find or run out) |
42 |==============================================================================|
43 | History: see HISTORY.HTM from distribution package |
44 | (Found at URL: http://www.ararat.cz/synapse/) |
45 |==============================================================================}
46
47 unit ssl_openssl_ver;
48
49 {$mode delphi}
50
51 interface
52
53 implementation
54
55 uses
56 blcksock, ssl_openssl_lib;
57
58 const
59 LibSSLName = 'libssl';
60 LibUtilName = 'libcrypto';
61
62 { ADD NEW ONES WHEN THEY APPEAR!
63 Always make .so/dylib last (Darwin won't load unversioned), then versions,
64 in descending order! Add "." .before the version}
65 {$IFDEF DARWIN}
66 LibVersions: array[1..10] of String = ('.48', '.47', '.46', '.45', '.44',
67 '.43', '.42', '.41', '.39', '.35'
68 );
69 {Always make .so/dylib first, then versions, in descending order!
70 Add "." .before the version, first is always just "" }
71 {$ELSE}
72 LibVersions: array[1..10] of String = ('', '.3', '.111', '.1.1.1',
73 '.11', '.1.1', '.1.1.0',
74 '.10', '.1.0.2', '.1.0.1'
75 );
76 {$ENDIF}
77
78 function GetLibraryName(const Value: String; Index: Integer): String;
79 begin
80 {$IFDEF DARWIN}
81 Result := Value + LibVersions[Index] + '.dylib';
82 {$ELSE}
83 Result := Value + '.so' + LibVersions[Index];
84 {$ENDIF}
85 end;
86
87 var
88 Index: Integer;
89 begin
90 if not IsSSLloaded then
91 begin
92 for Index := Low(LibVersions) to High(LibVersions) do
93 begin
94 DLLSSLName := GetLibraryName(LibSSLName, Index);
95 DLLUtilName := GetLibraryName(LibUtilName, Index);
96
97 if InitSSLInterface then
98 Break;
99 end;
100 end;
101 end.