| 1 |
{==============================================================================| |
| 2 |
| Project : Ararat Synapse | 003.009.001 | |
| 3 |
|==============================================================================| |
| 4 |
| Content: SSL support by OpenSSL | |
| 5 |
|==============================================================================| |
| 6 |
| Copyright (c)1999-2017, 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-2017. | |
| 37 |
| Portions created by Petr Fejfar are Copyright (c)2011-2012. | |
| 38 |
| Portions created by Pepak are Copyright (c)2018. | |
| 39 |
| All Rights Reserved. | |
| 40 |
|==============================================================================| |
| 41 |
| Contributor(s): | |
| 42 |
| Tomas Hajny (OS2 support) | |
| 43 |
| Pepak (multiversion support) | |
| 44 |
|==============================================================================| |
| 45 |
| History: see HISTORY.HTM from distribution package | |
| 46 |
| (Found at URL: http://www.ararat.cz/synapse/) | |
| 47 |
|==============================================================================} |
| 48 |
|
| 49 |
{ |
| 50 |
Special thanks to Gregor Ibic <[email protected]> |
| 51 |
(Intelicom d.o.o., http://www.intelicom.si) |
| 52 |
for good inspiration about begin with SSL programming. |
| 53 |
} |
| 54 |
|
| 55 |
{$IFDEF FPC} |
| 56 |
{$MODE DELPHI} |
| 57 |
{$ENDIF} |
| 58 |
{$H+} |
| 59 |
{$IFDEF VER125} |
| 60 |
{$DEFINE BCB} |
| 61 |
{$ENDIF} |
| 62 |
{$IFDEF BCB} |
| 63 |
{$ObjExportAll On} |
| 64 |
(*$HPPEMIT 'namespace ssl_openssl_lib { using System::Shortint; }' *) |
| 65 |
{$ENDIF} |
| 66 |
|
| 67 |
//old Delphi does not have MSWINDOWS define. |
| 68 |
{$IFDEF WIN32} |
| 69 |
{$IFNDEF MSWINDOWS} |
| 70 |
{$DEFINE MSWINDOWS} |
| 71 |
{$ENDIF} |
| 72 |
{$ENDIF} |
| 73 |
|
| 74 |
{:@abstract(OpenSSL support) |
| 75 |
|
| 76 |
This unit is Pascal interface to OpenSSL library (used by @link(ssl_openssl) unit). |
| 77 |
OpenSSL is loaded dynamicly on-demand. If this library is not found in system, |
| 78 |
requested OpenSSL function just return errorcode. |
| 79 |
} |
| 80 |
unit ssl_openssl_lib; |
| 81 |
|
| 82 |
interface |
| 83 |
|
| 84 |
uses |
| 85 |
{$IFDEF CIL} |
| 86 |
System.Runtime.InteropServices, |
| 87 |
System.Text, |
| 88 |
{$ENDIF} |
| 89 |
Classes, |
| 90 |
synafpc, |
| 91 |
{$IFNDEF MSWINDOWS} |
| 92 |
{$IFDEF FPC} |
| 93 |
{$IFDEF UNIX} |
| 94 |
BaseUnix, |
| 95 |
{$ENDIF UNIX} |
| 96 |
{$ELSE} |
| 97 |
Libc, |
| 98 |
{$ENDIF} |
| 99 |
SysUtils; |
| 100 |
{$ELSE} |
| 101 |
SysUtils, |
| 102 |
Windows; |
| 103 |
{$ENDIF} |
| 104 |
|
| 105 |
|
| 106 |
{$IFDEF CIL} |
| 107 |
const |
| 108 |
{$IFDEF LINUX} |
| 109 |
DLLSSLName = 'libssl.so'; |
| 110 |
DLLUtilName = 'libcrypto.so'; |
| 111 |
{$ELSE} |
| 112 |
DLLSSLName = 'ssleay32.dll'; |
| 113 |
DLLUtilName = 'libeay32.dll'; |
| 114 |
{$ENDIF} |
| 115 |
{$ELSE} |
| 116 |
var |
| 117 |
{$IFNDEF MSWINDOWS} |
| 118 |
{$IFDEF DARWIN} |
| 119 |
DLLSSLName: string = 'libssl.dylib'; |
| 120 |
DLLUtilName: string = 'libcrypto.dylib'; |
| 121 |
{$ELSE} |
| 122 |
{$IFDEF OS2} |
| 123 |
{$IFDEF OS2GCC} |
| 124 |
DLLSSLName: string = 'kssl.dll'; |
| 125 |
DLLUtilName: string = 'kcrypto.dll'; |
| 126 |
{$ELSE OS2GCC} |
| 127 |
DLLSSLName: string = 'ssl.dll'; |
| 128 |
DLLUtilName: string = 'crypto.dll'; |
| 129 |
{$ENDIF OS2GCC} |
| 130 |
{$ELSE OS2} |
| 131 |
DLLSSLName: string = 'libssl.so'; |
| 132 |
DLLUtilName: string = 'libcrypto.so'; |
| 133 |
{$ENDIF OS2} |
| 134 |
{$ENDIF} |
| 135 |
{$ELSE} |
| 136 |
DLLSSLName: string = 'ssleay32.dll'; |
| 137 |
DLLSSLName2: string = 'libssl32.dll'; |
| 138 |
DLLUtilName: string = 'libeay32.dll'; |
| 139 |
{$ENDIF} |
| 140 |
{$IFDEF MSWINDOWS} |
| 141 |
const |
| 142 |
LibCount = 5; |
| 143 |
SSLLibNames: array[0..LibCount-1] of string = ( |
| 144 |
// OpenSSL v3.0 |
| 145 |
{$IFDEF WIN64} |
| 146 |
'libssl-3-x64.dll', |
| 147 |
{$ELSE} |
| 148 |
'libssl-3.dll', |
| 149 |
{$ENDIF} |
| 150 |
// OpenSSL v1.1.x |
| 151 |
{$IFDEF WIN64} |
| 152 |
'libssl-1_1-x64.dll', |
| 153 |
{$ELSE} |
| 154 |
'libssl-1_1.dll', |
| 155 |
{$ENDIF} |
| 156 |
// OpenSSL v1.0.2 distinct names for x64 and x86 |
| 157 |
{$IFDEF WIN64} |
| 158 |
'ssleay32-x64.dll', |
| 159 |
{$ELSE} |
| 160 |
'ssleay32-x86.dll', |
| 161 |
{$ENDIF} |
| 162 |
// OpenSSL v1.0.2 |
| 163 |
'ssleay32.dll', |
| 164 |
// OpenSSL (ancient) |
| 165 |
'libssl32.dll' |
| 166 |
); |
| 167 |
CryptoLibNames: array[0..LibCount-1] of string = ( |
| 168 |
// OpenSSL v3.0 |
| 169 |
{$IFDEF WIN64} |
| 170 |
'libcrypto-3-x64.dll', |
| 171 |
{$ELSE} |
| 172 |
'libcrypto-3.dll', |
| 173 |
{$ENDIF} |
| 174 |
// OpenSSL v1.1.x |
| 175 |
{$IFDEF WIN64} |
| 176 |
'libcrypto-1_1-x64.dll', |
| 177 |
{$ELSE} |
| 178 |
'libcrypto-1_1.dll', |
| 179 |
{$ENDIF} |
| 180 |
// OpenSSL v1.0.2 distinct names for x64 and x86 |
| 181 |
{$IFDEF WIN64} |
| 182 |
'libeay32-x64.dll', |
| 183 |
{$ELSE} |
| 184 |
'libeay32-x86.dll', |
| 185 |
{$ENDIF} |
| 186 |
// OpenSSL v1.0.2 |
| 187 |
'libeay32.dll', |
| 188 |
// OpenSSL (ancient) |
| 189 |
'libeay32.dll' |
| 190 |
); |
| 191 |
{$ENDIF} |
| 192 |
{$ENDIF} |
| 193 |
|
| 194 |
type |
| 195 |
{$IFDEF CIL} |
| 196 |
SslPtr = IntPtr; |
| 197 |
{$ELSE} |
| 198 |
SslPtr = Pointer; |
| 199 |
{$ENDIF} |
| 200 |
PSslPtr = ^SslPtr; |
| 201 |
PSSL_CTX = SslPtr; |
| 202 |
PSSL = SslPtr; |
| 203 |
PSSL_METHOD = SslPtr; |
| 204 |
PX509 = SslPtr; |
| 205 |
PX509_NAME = SslPtr; |
| 206 |
PEVP_MD = SslPtr; |
| 207 |
PInteger = ^Integer; |
| 208 |
PBIO_METHOD = SslPtr; |
| 209 |
PBIO = SslPtr; |
| 210 |
EVP_PKEY = SslPtr; |
| 211 |
PRSA = SslPtr; |
| 212 |
PASN1_UTCTIME = SslPtr; |
| 213 |
PASN1_INTEGER = SslPtr; |
| 214 |
PPasswdCb = SslPtr; |
| 215 |
PFunction = procedure; |
| 216 |
PSTACK = SslPtr; {pf} |
| 217 |
TSkPopFreeFunc = procedure(p:SslPtr); cdecl; {pf} |
| 218 |
TX509Free = procedure(x: PX509); cdecl; {pf} |
| 219 |
|
| 220 |
DES_cblock = array[0..7] of Byte; |
| 221 |
PDES_cblock = ^DES_cblock; |
| 222 |
des_ks_struct = packed record |
| 223 |
ks: DES_cblock; |
| 224 |
weak_key: Integer; |
| 225 |
end; |
| 226 |
des_key_schedule = array[1..16] of des_ks_struct; |
| 227 |
|
| 228 |
const |
| 229 |
EVP_MAX_MD_SIZE = 16 + 20; |
| 230 |
|
| 231 |
SSL_ERROR_NONE = 0; |
| 232 |
SSL_ERROR_SSL = 1; |
| 233 |
SSL_ERROR_WANT_READ = 2; |
| 234 |
SSL_ERROR_WANT_WRITE = 3; |
| 235 |
SSL_ERROR_WANT_X509_LOOKUP = 4; |
| 236 |
SSL_ERROR_SYSCALL = 5; //look at error stack/return value/errno |
| 237 |
SSL_ERROR_ZERO_RETURN = 6; |
| 238 |
SSL_ERROR_WANT_CONNECT = 7; |
| 239 |
SSL_ERROR_WANT_ACCEPT = 8; |
| 240 |
|
| 241 |
SSL_OP_NO_SSLv2 = $01000000; |
| 242 |
SSL_OP_NO_SSLv3 = $02000000; |
| 243 |
SSL_OP_NO_TLSv1 = $04000000; |
| 244 |
SSL_OP_ALL = $000FFFFF; |
| 245 |
SSL_VERIFY_NONE = $00; |
| 246 |
SSL_VERIFY_PEER = $01; |
| 247 |
|
| 248 |
OPENSSL_DES_DECRYPT = 0; |
| 249 |
OPENSSL_DES_ENCRYPT = 1; |
| 250 |
|
| 251 |
X509_V_OK = 0; |
| 252 |
X509_V_ILLEGAL = 1; |
| 253 |
X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT = 2; |
| 254 |
X509_V_ERR_UNABLE_TO_GET_CRL = 3; |
| 255 |
X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE = 4; |
| 256 |
X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE = 5; |
| 257 |
X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY = 6; |
| 258 |
X509_V_ERR_CERT_SIGNATURE_FAILURE = 7; |
| 259 |
X509_V_ERR_CRL_SIGNATURE_FAILURE = 8; |
| 260 |
X509_V_ERR_CERT_NOT_YET_VALID = 9; |
| 261 |
X509_V_ERR_CERT_HAS_EXPIRED = 10; |
| 262 |
X509_V_ERR_CRL_NOT_YET_VALID = 11; |
| 263 |
X509_V_ERR_CRL_HAS_EXPIRED = 12; |
| 264 |
X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD = 13; |
| 265 |
X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD = 14; |
| 266 |
X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD = 15; |
| 267 |
X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD = 16; |
| 268 |
X509_V_ERR_OUT_OF_MEM = 17; |
| 269 |
X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT = 18; |
| 270 |
X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN = 19; |
| 271 |
X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY = 20; |
| 272 |
X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE = 21; |
| 273 |
X509_V_ERR_CERT_CHAIN_TOO_LONG = 22; |
| 274 |
X509_V_ERR_CERT_REVOKED = 23; |
| 275 |
X509_V_ERR_INVALID_CA = 24; |
| 276 |
X509_V_ERR_PATH_LENGTH_EXCEEDED = 25; |
| 277 |
X509_V_ERR_INVALID_PURPOSE = 26; |
| 278 |
X509_V_ERR_CERT_UNTRUSTED = 27; |
| 279 |
X509_V_ERR_CERT_REJECTED = 28; |
| 280 |
//These are 'informational' when looking for issuer cert |
| 281 |
X509_V_ERR_SUBJECT_ISSUER_MISMATCH = 29; |
| 282 |
X509_V_ERR_AKID_SKID_MISMATCH = 30; |
| 283 |
X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH = 31; |
| 284 |
X509_V_ERR_KEYUSAGE_NO_CERTSIGN = 32; |
| 285 |
X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER = 33; |
| 286 |
X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION = 34; |
| 287 |
//The application is not happy |
| 288 |
X509_V_ERR_APPLICATION_VERIFICATION = 50; |
| 289 |
|
| 290 |
SSL_FILETYPE_ASN1 = 2; |
| 291 |
SSL_FILETYPE_PEM = 1; |
| 292 |
EVP_PKEY_RSA = 6; |
| 293 |
|
| 294 |
SSL_CTRL_SET_TLSEXT_HOSTNAME = 55; |
| 295 |
TLSEXT_NAMETYPE_host_name = 0; |
| 296 |
|
| 297 |
var |
| 298 |
SSLLibHandle: TLibHandle = 0; |
| 299 |
SSLUtilHandle: TLibHandle = 0; |
| 300 |
SSLLibFile: string = ''; |
| 301 |
SSLUtilFile: string = ''; |
| 302 |
|
| 303 |
{$IFDEF CIL} |
| 304 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 305 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 306 |
EntryPoint = 'SSL_get_error')] |
| 307 |
function SslGetError(s: PSSL; ret_code: Integer): Integer; external; |
| 308 |
|
| 309 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 310 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 311 |
EntryPoint = 'SSL_library_init')] |
| 312 |
function SslLibraryInit: Integer; external; |
| 313 |
|
| 314 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 315 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 316 |
EntryPoint = 'SSL_load_error_strings')] |
| 317 |
procedure SslLoadErrorStrings; external; |
| 318 |
|
| 319 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 320 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 321 |
EntryPoint = 'SSL_CTX_set_cipher_list')] |
| 322 |
function SslCtxSetCipherList(arg0: PSSL_CTX; var str: String): Integer; external; |
| 323 |
|
| 324 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 325 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 326 |
EntryPoint = 'SSL_CTX_new')] |
| 327 |
function SslCtxNew(meth: PSSL_METHOD):PSSL_CTX; external; |
| 328 |
|
| 329 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 330 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 331 |
EntryPoint = 'SSL_CTX_free')] |
| 332 |
procedure SslCtxFree (arg0: PSSL_CTX); external; |
| 333 |
|
| 334 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 335 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 336 |
EntryPoint = 'SSL_set_fd')] |
| 337 |
function SslSetFd(s: PSSL; fd: Integer):Integer; external; |
| 338 |
|
| 339 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 340 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 341 |
EntryPoint = 'SSLv2_method')] |
| 342 |
function SslMethodV2 : PSSL_METHOD; external; |
| 343 |
|
| 344 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 345 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 346 |
EntryPoint = 'SSLv3_method')] |
| 347 |
function SslMethodV3 : PSSL_METHOD; external; |
| 348 |
|
| 349 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 350 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 351 |
EntryPoint = 'TLSv1_method')] |
| 352 |
function SslMethodTLSV1:PSSL_METHOD; external; |
| 353 |
|
| 354 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 355 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 356 |
EntryPoint = 'TLSv1_1_method')] |
| 357 |
function SslMethodTLSV11:PSSL_METHOD; external; |
| 358 |
|
| 359 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 360 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 361 |
EntryPoint = 'TLSv1_2_method')] |
| 362 |
function SslMethodTLSV12:PSSL_METHOD; external; |
| 363 |
|
| 364 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 365 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 366 |
EntryPoint = 'SSLv23_method')] |
| 367 |
function SslMethodV23 : PSSL_METHOD; external; |
| 368 |
|
| 369 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 370 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 371 |
EntryPoint = 'TLS_method')] |
| 372 |
function SslMethodTLS : PSSL_METHOD; external; |
| 373 |
|
| 374 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 375 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 376 |
EntryPoint = 'SSL_CTX_use_PrivateKey')] |
| 377 |
function SslCtxUsePrivateKey(ctx: PSSL_CTX; pkey: SslPtr):Integer; external; |
| 378 |
|
| 379 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 380 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 381 |
EntryPoint = 'SSL_CTX_use_PrivateKey_ASN1')] |
| 382 |
function SslCtxUsePrivateKeyASN1(pk: integer; ctx: PSSL_CTX; d: String; len: integer):Integer; external; |
| 383 |
|
| 384 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 385 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 386 |
EntryPoint = 'SSL_CTX_use_RSAPrivateKey_file')] |
| 387 |
function SslCtxUsePrivateKeyFile(ctx: PSSL_CTX; const _file: String; _type: Integer):Integer; external; |
| 388 |
|
| 389 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 390 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 391 |
EntryPoint = 'SSL_CTX_use_certificate')] |
| 392 |
function SslCtxUseCertificate(ctx: PSSL_CTX; x: SslPtr):Integer; external; |
| 393 |
|
| 394 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 395 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 396 |
EntryPoint = 'SSL_CTX_use_certificate_ASN1')] |
| 397 |
function SslCtxUseCertificateASN1(ctx: PSSL_CTX; len: integer; d: String):Integer; external; |
| 398 |
|
| 399 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 400 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 401 |
EntryPoint = 'SSL_CTX_use_certificate_file')] |
| 402 |
function SslCtxUseCertificateFile(ctx: PSSL_CTX; const _file: String; _type: Integer):Integer;external; |
| 403 |
|
| 404 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 405 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 406 |
EntryPoint = 'SSL_CTX_use_certificate_chain_file')] |
| 407 |
function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const _file: String):Integer;external; |
| 408 |
|
| 409 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 410 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 411 |
EntryPoint = 'SSL_CTX_check_private_key')] |
| 412 |
function SslCtxCheckPrivateKeyFile(ctx: PSSL_CTX):Integer; external; |
| 413 |
|
| 414 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 415 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 416 |
EntryPoint = 'SSL_CTX_set_default_passwd_cb')] |
| 417 |
procedure SslCtxSetDefaultPasswdCb(ctx: PSSL_CTX; cb: PPasswdCb); external; |
| 418 |
|
| 419 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 420 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 421 |
EntryPoint = 'SSL_CTX_set_default_passwd_cb_userdata')] |
| 422 |
procedure SslCtxSetDefaultPasswdCbUserdata(ctx: PSSL_CTX; u: IntPtr); external; |
| 423 |
|
| 424 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 425 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 426 |
EntryPoint = 'SSL_CTX_load_verify_locations')] |
| 427 |
function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; CAfile: string; CApath: String):Integer; external; |
| 428 |
|
| 429 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 430 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 431 |
EntryPoint = 'SSL_CTX_ctrl')] |
| 432 |
function SslCtxCtrl(ctx: PSSL_CTX; cmd: integer; larg: integer; parg: IntPtr): integer; external; |
| 433 |
|
| 434 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 435 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 436 |
EntryPoint = 'SSL_new')] |
| 437 |
function SslNew(ctx: PSSL_CTX):PSSL; external; |
| 438 |
|
| 439 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 440 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 441 |
EntryPoint = 'SSL_free')] |
| 442 |
procedure SslFree(ssl: PSSL); external; |
| 443 |
|
| 444 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 445 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 446 |
EntryPoint = 'SSL_accept')] |
| 447 |
function SslAccept(ssl: PSSL):Integer; external; |
| 448 |
|
| 449 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 450 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 451 |
EntryPoint = 'SSL_connect')] |
| 452 |
function SslConnect(ssl: PSSL):Integer; external; |
| 453 |
|
| 454 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 455 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 456 |
EntryPoint = 'SSL_shutdown')] |
| 457 |
function SslShutdown(s: PSSL):Integer; external; |
| 458 |
|
| 459 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 460 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 461 |
EntryPoint = 'SSL_read')] |
| 462 |
function SslRead(ssl: PSSL; buf: StringBuilder; num: Integer):Integer; external; |
| 463 |
|
| 464 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 465 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 466 |
EntryPoint = 'SSL_peek')] |
| 467 |
function SslPeek(ssl: PSSL; buf: StringBuilder; num: Integer):Integer; external; |
| 468 |
|
| 469 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 470 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 471 |
EntryPoint = 'SSL_write')] |
| 472 |
function SslWrite(ssl: PSSL; buf: String; num: Integer):Integer; external; |
| 473 |
|
| 474 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 475 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 476 |
EntryPoint = 'SSL_pending')] |
| 477 |
function SslPending(ssl: PSSL):Integer; external; |
| 478 |
|
| 479 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 480 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 481 |
EntryPoint = 'SSL_get_version')] |
| 482 |
function SslGetVersion(ssl: PSSL):String; external; |
| 483 |
|
| 484 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 485 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 486 |
EntryPoint = 'SSL_get_peer_certificate')] |
| 487 |
function SslGetPeerCertificate(s: PSSL):PX509; external; |
| 488 |
|
| 489 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 490 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 491 |
EntryPoint = 'SSL_CTX_set_verify')] |
| 492 |
procedure SslCtxSetVerify(ctx: PSSL_CTX; mode: Integer; arg2: PFunction); external; |
| 493 |
|
| 494 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 495 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 496 |
EntryPoint = 'SSL_get_current_cipher')] |
| 497 |
function SSLGetCurrentCipher(s: PSSL): SslPtr; external; |
| 498 |
|
| 499 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 500 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 501 |
EntryPoint = 'SSL_CIPHER_get_name')] |
| 502 |
function SSLCipherGetName(c: SslPtr):String; external; |
| 503 |
|
| 504 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 505 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 506 |
EntryPoint = 'SSL_CIPHER_get_bits')] |
| 507 |
function SSLCipherGetBits(c: SslPtr; var alg_bits: Integer):Integer; external; |
| 508 |
|
| 509 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 510 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 511 |
EntryPoint = 'SSL_get_verify_result')] |
| 512 |
function SSLGetVerifyResult(ssl: PSSL):Integer;external; |
| 513 |
|
| 514 |
[DllImport(DLLSSLName, CharSet = CharSet.Ansi, |
| 515 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 516 |
EntryPoint = 'SSL_ctrl')] |
| 517 |
function SslCtrl(ssl: PSSL; cmd: integer; larg: integer; parg: IntPtr): integer; external; |
| 518 |
|
| 519 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 520 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 521 |
EntryPoint = 'X509_new')] |
| 522 |
function X509New: PX509; external; |
| 523 |
|
| 524 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 525 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 526 |
EntryPoint = 'X509_free')] |
| 527 |
procedure X509Free(x: PX509); external; |
| 528 |
|
| 529 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 530 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 531 |
EntryPoint = 'X509_NAME_oneline')] |
| 532 |
function X509NameOneline(a: PX509_NAME; buf: StringBuilder; size: Integer): String; external; |
| 533 |
|
| 534 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 535 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 536 |
EntryPoint = 'X509_get_subject_name')] |
| 537 |
function X509GetSubjectName(a: PX509):PX509_NAME; external; |
| 538 |
|
| 539 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 540 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 541 |
EntryPoint = 'X509_get_issuer_name')] |
| 542 |
function X509GetIssuerName(a: PX509):PX509_NAME; external; |
| 543 |
|
| 544 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 545 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 546 |
EntryPoint = 'X509_NAME_hash')] |
| 547 |
function X509NameHash(x: PX509_NAME):Cardinal; external; |
| 548 |
|
| 549 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 550 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 551 |
EntryPoint = 'X509_digest')] |
| 552 |
function X509Digest (data: PX509; _type: PEVP_MD; md: StringBuilder; var len: Integer):Integer; external; |
| 553 |
|
| 554 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 555 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 556 |
EntryPoint = 'X509_set_version')] |
| 557 |
function X509SetVersion(x: PX509; version: integer): integer; external; |
| 558 |
|
| 559 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 560 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 561 |
EntryPoint = 'X509_set_pubkey')] |
| 562 |
function X509SetPubkey(x: PX509; pkey: EVP_PKEY): integer; external; |
| 563 |
|
| 564 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 565 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 566 |
EntryPoint = 'X509_set_issuer_name')] |
| 567 |
function X509SetIssuerName(x: PX509; name: PX509_NAME): integer; external; |
| 568 |
|
| 569 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 570 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 571 |
EntryPoint = 'X509_NAME_add_entry_by_txt')] |
| 572 |
function X509NameAddEntryByTxt(name: PX509_NAME; field: string; _type: integer; |
| 573 |
bytes: string; len, loc, _set: integer): integer; external; |
| 574 |
|
| 575 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 576 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 577 |
EntryPoint = 'X509_sign')] |
| 578 |
function X509Sign(x: PX509; pkey: EVP_PKEY; const md: PEVP_MD): integer; external; |
| 579 |
|
| 580 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 581 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 582 |
EntryPoint = 'X509_print')] |
| 583 |
function X509print(b: PBIO; a: PX509): integer; external; |
| 584 |
|
| 585 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 586 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 587 |
EntryPoint = 'X509_gmtime_adj')] |
| 588 |
function X509GmtimeAdj(s: PASN1_UTCTIME; adj: integer): PASN1_UTCTIME; external; |
| 589 |
|
| 590 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 591 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 592 |
EntryPoint = 'X509_set_notBefore')] |
| 593 |
function X509SetNotBefore(x: PX509; tm: PASN1_UTCTIME): integer; external; |
| 594 |
|
| 595 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 596 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 597 |
EntryPoint = 'X509_set_notAfter')] |
| 598 |
function X509SetNotAfter(x: PX509; tm: PASN1_UTCTIME): integer; external; |
| 599 |
|
| 600 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 601 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 602 |
EntryPoint = 'X509_get_serialNumber')] |
| 603 |
function X509GetSerialNumber(x: PX509): PASN1_INTEGER; external; |
| 604 |
|
| 605 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 606 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 607 |
EntryPoint = 'EVP_PKEY_new')] |
| 608 |
function EvpPkeyNew: EVP_PKEY; external; |
| 609 |
|
| 610 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 611 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 612 |
EntryPoint = 'EVP_PKEY_free')] |
| 613 |
procedure EvpPkeyFree(pk: EVP_PKEY); external; |
| 614 |
|
| 615 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 616 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 617 |
EntryPoint = 'EVP_PKEY_assign')] |
| 618 |
function EvpPkeyAssign(pkey: EVP_PKEY; _type: integer; key: Prsa): integer; external; |
| 619 |
|
| 620 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 621 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 622 |
EntryPoint = 'EVP_get_digestbyname')] |
| 623 |
function EvpGetDigestByName(Name: String): PEVP_MD; external; |
| 624 |
|
| 625 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 626 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 627 |
EntryPoint = 'EVP_cleanup')] |
| 628 |
procedure EVPcleanup; external; |
| 629 |
|
| 630 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 631 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 632 |
EntryPoint = 'SSLeay_version')] |
| 633 |
function SSLeayversion(t: integer): String; external; |
| 634 |
|
| 635 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 636 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 637 |
EntryPoint = 'ERR_error_string_n')] |
| 638 |
procedure ErrErrorString(e: integer; buf: StringBuilder; len: integer); external; |
| 639 |
|
| 640 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 641 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 642 |
EntryPoint = 'ERR_get_error')] |
| 643 |
function ErrGetError: integer; external; |
| 644 |
|
| 645 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 646 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 647 |
EntryPoint = 'ERR_clear_error')] |
| 648 |
procedure ErrClearError; external; |
| 649 |
|
| 650 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 651 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 652 |
EntryPoint = 'ERR_free_strings')] |
| 653 |
procedure ErrFreeStrings; external; |
| 654 |
|
| 655 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 656 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 657 |
EntryPoint = 'ERR_remove_state')] |
| 658 |
procedure ErrRemoveState(pid: integer); external; |
| 659 |
|
| 660 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 661 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 662 |
EntryPoint = 'OPENSSL_add_all_algorithms_noconf')] |
| 663 |
procedure OPENSSLaddallalgorithms; external; |
| 664 |
|
| 665 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 666 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 667 |
EntryPoint = 'CRYPTO_cleanup_all_ex_data')] |
| 668 |
procedure CRYPTOcleanupAllExData; external; |
| 669 |
|
| 670 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 671 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 672 |
EntryPoint = 'RAND_screen')] |
| 673 |
procedure RandScreen; external; |
| 674 |
|
| 675 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 676 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 677 |
EntryPoint = 'BIO_new')] |
| 678 |
function BioNew(b: PBIO_METHOD): PBIO; external; |
| 679 |
|
| 680 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 681 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 682 |
EntryPoint = 'BIO_free_all')] |
| 683 |
procedure BioFreeAll(b: PBIO); external; |
| 684 |
|
| 685 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 686 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 687 |
EntryPoint = 'BIO_s_mem')] |
| 688 |
function BioSMem: PBIO_METHOD; external; |
| 689 |
|
| 690 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 691 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 692 |
EntryPoint = 'BIO_ctrl_pending')] |
| 693 |
function BioCtrlPending(b: PBIO): integer; external; |
| 694 |
|
| 695 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 696 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 697 |
EntryPoint = 'BIO_read')] |
| 698 |
function BioRead(b: PBIO; Buf: StringBuilder; Len: integer): integer; external; |
| 699 |
|
| 700 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 701 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 702 |
EntryPoint = 'BIO_write')] |
| 703 |
function BioWrite(b: PBIO; var Buf: String; Len: integer): integer; external; |
| 704 |
|
| 705 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 706 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 707 |
EntryPoint = 'd2i_PKCS12_bio')] |
| 708 |
function d2iPKCS12bio(b:PBIO; Pkcs12: SslPtr): SslPtr; external; |
| 709 |
|
| 710 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 711 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 712 |
EntryPoint = 'PKCS12_parse')] |
| 713 |
function PKCS12parse(p12: SslPtr; pass: string; var pkey, cert, ca: SslPtr): integer; external; |
| 714 |
|
| 715 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 716 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 717 |
EntryPoint = 'PKCS12_free')] |
| 718 |
procedure PKCS12free(p12: SslPtr); external; |
| 719 |
|
| 720 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 721 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 722 |
EntryPoint = 'RSA_generate_key')] |
| 723 |
function RsaGenerateKey(bits, e: integer; callback: PFunction; cb_arg: SslPtr): PRSA; external; |
| 724 |
|
| 725 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 726 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 727 |
EntryPoint = 'ASN1_UTCTIME_new')] |
| 728 |
function Asn1UtctimeNew: PASN1_UTCTIME; external; |
| 729 |
|
| 730 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 731 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 732 |
EntryPoint = 'ASN1_UTCTIME_free')] |
| 733 |
procedure Asn1UtctimeFree(a: PASN1_UTCTIME); external; |
| 734 |
|
| 735 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 736 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 737 |
EntryPoint = 'ASN1_INTEGER_set')] |
| 738 |
function Asn1IntegerSet(a: PASN1_INTEGER; v: integer): integer; external; |
| 739 |
|
| 740 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 741 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 742 |
EntryPoint = 'i2d_X509_bio')] |
| 743 |
function i2dX509bio(b: PBIO; x: PX509): integer; external; |
| 744 |
|
| 745 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 746 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 747 |
EntryPoint = 'i2d_PrivateKey_bio')] |
| 748 |
function i2dPrivateKeyBio(b: PBIO; pkey: EVP_PKEY): integer; external; |
| 749 |
|
| 750 |
// 3DES functions |
| 751 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 752 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 753 |
EntryPoint = 'DES_set_odd_parity')] |
| 754 |
procedure DESsetoddparity(Key: des_cblock); external; |
| 755 |
|
| 756 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 757 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 758 |
EntryPoint = 'DES_set_key_checked')] |
| 759 |
function DESsetkeychecked(key: des_cblock; schedule: des_key_schedule): Integer; external; |
| 760 |
|
| 761 |
[DllImport(DLLUtilName, CharSet = CharSet.Ansi, |
| 762 |
SetLastError = False, CallingConvention= CallingConvention.cdecl, |
| 763 |
EntryPoint = 'DES_ecb_encrypt')] |
| 764 |
procedure DESecbencrypt(Input: des_cblock; output: des_cblock; ks: des_key_schedule; enc: Integer); external; |
| 765 |
|
| 766 |
{$ELSE} |
| 767 |
// libssl.dll |
| 768 |
function SslGetError(s: PSSL; ret_code: Integer):Integer; |
| 769 |
function SslLibraryInit:Integer; |
| 770 |
procedure SslLoadErrorStrings; |
| 771 |
// function SslCtxSetCipherList(arg0: PSSL_CTX; str: PChar):Integer; |
| 772 |
function SslCtxSetCipherList(arg0: PSSL_CTX; var str: AnsiString):Integer; |
| 773 |
function SslCtxNew(meth: PSSL_METHOD):PSSL_CTX; |
| 774 |
procedure SslCtxFree(arg0: PSSL_CTX); |
| 775 |
function SslSetFd(s: PSSL; fd: Integer):Integer; |
| 776 |
function SslMethodV2:PSSL_METHOD; |
| 777 |
function SslMethodV3:PSSL_METHOD; |
| 778 |
function SslMethodTLSV1:PSSL_METHOD; |
| 779 |
function SslMethodTLSV11:PSSL_METHOD; |
| 780 |
function SslMethodTLSV12:PSSL_METHOD; |
| 781 |
function SslMethodV23:PSSL_METHOD; |
| 782 |
function SslMethodTLS:PSSL_METHOD; |
| 783 |
function SslCtxUsePrivateKey(ctx: PSSL_CTX; pkey: SslPtr):Integer; |
| 784 |
function SslCtxUsePrivateKeyASN1(pk: integer; ctx: PSSL_CTX; d: AnsiString; len: integer):Integer; |
| 785 |
// function SslCtxUsePrivateKeyFile(ctx: PSSL_CTX; const _file: PChar; _type: Integer):Integer; |
| 786 |
function SslCtxUsePrivateKeyFile(ctx: PSSL_CTX; const _file: AnsiString; _type: Integer):Integer; |
| 787 |
function SslCtxUseCertificate(ctx: PSSL_CTX; x: SslPtr):Integer; |
| 788 |
function SslCtxUseCertificateASN1(ctx: PSSL_CTX; len: integer; d: AnsiString):Integer; |
| 789 |
function SslCtxUseCertificateFile(ctx: PSSL_CTX; const _file: AnsiString; _type: Integer):Integer; |
| 790 |
// function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const _file: PChar):Integer; |
| 791 |
function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const _file: AnsiString):Integer; |
| 792 |
function SslCtxCheckPrivateKeyFile(ctx: PSSL_CTX):Integer; |
| 793 |
procedure SslCtxSetDefaultPasswdCb(ctx: PSSL_CTX; cb: PPasswdCb); |
| 794 |
procedure SslCtxSetDefaultPasswdCbUserdata(ctx: PSSL_CTX; u: SslPtr); |
| 795 |
// function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; const CAfile: PChar; const CApath: PChar):Integer; |
| 796 |
function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; const CAfile: AnsiString; const CApath: AnsiString):Integer; |
| 797 |
function SslCtxCtrl(ctx: PSSL_CTX; cmd: integer; larg: integer; parg: SslPtr): integer; |
| 798 |
function SslNew(ctx: PSSL_CTX):PSSL; |
| 799 |
procedure SslFree(ssl: PSSL); |
| 800 |
function SslAccept(ssl: PSSL):Integer; |
| 801 |
function SslConnect(ssl: PSSL):Integer; |
| 802 |
function SslShutdown(ssl: PSSL):Integer; |
| 803 |
function SslRead(ssl: PSSL; buf: SslPtr; num: Integer):Integer; |
| 804 |
function SslPeek(ssl: PSSL; buf: SslPtr; num: Integer):Integer; |
| 805 |
function SslWrite(ssl: PSSL; buf: SslPtr; num: Integer):Integer; |
| 806 |
function SslPending(ssl: PSSL):Integer; |
| 807 |
function SslGetVersion(ssl: PSSL):AnsiString; |
| 808 |
function SslGetPeerCertificate(ssl: PSSL):PX509; |
| 809 |
procedure SslCtxSetVerify(ctx: PSSL_CTX; mode: Integer; arg2: PFunction); |
| 810 |
function SSLGetCurrentCipher(s: PSSL):SslPtr; |
| 811 |
function SSLCipherGetName(c: SslPtr): AnsiString; |
| 812 |
function SSLCipherGetBits(c: SslPtr; var alg_bits: Integer):Integer; |
| 813 |
function SSLGetVerifyResult(ssl: PSSL):Integer; |
| 814 |
function SSLCtrl(ssl: PSSL; cmd: integer; larg: integer; parg: SslPtr):Integer; |
| 815 |
function SslSet1Host(ssl: PSSL; hostname: PAnsiChar):Integer; |
| 816 |
procedure SslSessionFree(session: PSslPtr); |
| 817 |
function SslGet1Session(ssl: PSSL):PSslPtr; |
| 818 |
function SslSetSession(ssl: PSSL; session: PSslPtr): Integer; |
| 819 |
|
| 820 |
// libeay.dll |
| 821 |
function X509New: PX509; |
| 822 |
procedure X509Free(x: PX509); |
| 823 |
function X509NameOneline(a: PX509_NAME; var buf: AnsiString; size: Integer):AnsiString; |
| 824 |
function X509GetSubjectName(a: PX509):PX509_NAME; |
| 825 |
function X509GetIssuerName(a: PX509):PX509_NAME; |
| 826 |
function X509NameHash(x: PX509_NAME):Cardinal; |
| 827 |
// function SslX509Digest(data: PX509; _type: PEVP_MD; md: PChar; len: PInteger):Integer; |
| 828 |
function X509Digest(data: PX509; _type: PEVP_MD; md: AnsiString; var len: Integer):Integer; |
| 829 |
function X509print(b: PBIO; a: PX509): integer; |
| 830 |
function X509SetVersion(x: PX509; version: integer): integer; |
| 831 |
function X509SetPubkey(x: PX509; pkey: EVP_PKEY): integer; |
| 832 |
function X509SetIssuerName(x: PX509; name: PX509_NAME): integer; |
| 833 |
function X509NameAddEntryByTxt(name: PX509_NAME; field: Ansistring; _type: integer; |
| 834 |
bytes: Ansistring; len, loc, _set: integer): integer; |
| 835 |
function X509Sign(x: PX509; pkey: EVP_PKEY; const md: PEVP_MD): integer; |
| 836 |
function X509GmtimeAdj(s: PASN1_UTCTIME; adj: integer): PASN1_UTCTIME; |
| 837 |
function X509SetNotBefore(x: PX509; tm: PASN1_UTCTIME): integer; |
| 838 |
function X509SetNotAfter(x: PX509; tm: PASN1_UTCTIME): integer; |
| 839 |
function X509GetSerialNumber(x: PX509): PASN1_INTEGER; |
| 840 |
function EvpPkeyNew: EVP_PKEY; |
| 841 |
procedure EvpPkeyFree(pk: EVP_PKEY); |
| 842 |
function EvpPkeyAssign(pkey: EVP_PKEY; _type: integer; key: Prsa): integer; |
| 843 |
function EvpGetDigestByName(Name: AnsiString): PEVP_MD; |
| 844 |
procedure EVPcleanup; |
| 845 |
// function ErrErrorString(e: integer; buf: PChar): PChar; |
| 846 |
function SSLeayversion(t: integer): Ansistring; |
| 847 |
procedure ErrErrorString(e: integer; var buf: Ansistring; len: integer); |
| 848 |
function ErrGetError: integer; |
| 849 |
procedure ErrClearError; |
| 850 |
procedure ErrFreeStrings; |
| 851 |
procedure ErrRemoveState(pid: integer); |
| 852 |
procedure OPENSSLaddallalgorithms; |
| 853 |
procedure CRYPTOcleanupAllExData; |
| 854 |
procedure RandScreen; |
| 855 |
function BioNew(b: PBIO_METHOD): PBIO; |
| 856 |
procedure BioFreeAll(b: PBIO); |
| 857 |
function BioSMem: PBIO_METHOD; |
| 858 |
function BioCtrlPending(b: PBIO): integer; |
| 859 |
function BioRead(b: PBIO; var Buf: AnsiString; Len: integer): integer; |
| 860 |
function BioWrite(b: PBIO; Buf: AnsiString; Len: integer): integer; |
| 861 |
function d2iPKCS12bio(b:PBIO; Pkcs12: SslPtr): SslPtr; |
| 862 |
function PKCS12parse(p12: SslPtr; pass: Ansistring; var pkey, cert, ca: SslPtr): integer; |
| 863 |
procedure PKCS12free(p12: SslPtr); |
| 864 |
function RsaGenerateKey(bits, e: integer; callback: PFunction; cb_arg: SslPtr): PRSA; |
| 865 |
function Asn1UtctimeNew: PASN1_UTCTIME; |
| 866 |
procedure Asn1UtctimeFree(a: PASN1_UTCTIME); |
| 867 |
function Asn1IntegerSet(a: PASN1_INTEGER; v: integer): integer; |
| 868 |
function Asn1IntegerGet(a: PASN1_INTEGER): integer; {pf} |
| 869 |
function i2dX509bio(b: PBIO; x: PX509): integer; |
| 870 |
function d2iX509bio(b:PBIO; x:PX509): PX509; {pf} |
| 871 |
function PEMReadBioX509(b:PBIO; {var x:PX509;}x:PSslPtr; callback:PFunction; cb_arg: SslPtr): PX509; {pf} |
| 872 |
procedure SkX509PopFree(st: PSTACK; func: TSkPopFreeFunc); {pf} |
| 873 |
|
| 874 |
|
| 875 |
function i2dPrivateKeyBio(b: PBIO; pkey: EVP_PKEY): integer; |
| 876 |
|
| 877 |
// 3DES functions |
| 878 |
procedure DESsetoddparity(Key: des_cblock); |
| 879 |
function DESsetkeychecked(key: des_cblock; schedule: des_key_schedule): Integer; |
| 880 |
procedure DESecbencrypt(Input: des_cblock; output: des_cblock; ks: des_key_schedule; enc: Integer); |
| 881 |
|
| 882 |
{$ENDIF} |
| 883 |
|
| 884 |
function IsSSLloaded: Boolean; |
| 885 |
function InitSSLInterface: Boolean; |
| 886 |
function DestroySSLInterface: Boolean; |
| 887 |
|
| 888 |
var |
| 889 |
_X509Free: TX509Free = nil; {pf} |
| 890 |
|
| 891 |
implementation |
| 892 |
|
| 893 |
uses |
| 894 |
{$IFDEF OS2} |
| 895 |
Sockets, |
| 896 |
{$ENDIF OS2} |
| 897 |
SyncObjs; |
| 898 |
|
| 899 |
{$IFNDEF CIL} |
| 900 |
type |
| 901 |
// libssl.dll |
| 902 |
TSslGetError = function(s: PSSL; ret_code: Integer):Integer; cdecl; |
| 903 |
TSslLibraryInit = function:Integer; cdecl; |
| 904 |
TSslLoadErrorStrings = procedure; cdecl; |
| 905 |
TSslCtxSetCipherList = function(arg0: PSSL_CTX; str: PAnsiChar):Integer; cdecl; |
| 906 |
TSslCtxNew = function(meth: PSSL_METHOD):PSSL_CTX; cdecl; |
| 907 |
TSslCtxFree = procedure(arg0: PSSL_CTX); cdecl; |
| 908 |
TSslSetFd = function(s: PSSL; fd: Integer):Integer; cdecl; |
| 909 |
TSslMethodV2 = function:PSSL_METHOD; cdecl; |
| 910 |
TSslMethodV3 = function:PSSL_METHOD; cdecl; |
| 911 |
TSslMethodTLSV1 = function:PSSL_METHOD; cdecl; |
| 912 |
TSslMethodTLSV11 = function:PSSL_METHOD; cdecl; |
| 913 |
TSslMethodTLSV12 = function:PSSL_METHOD; cdecl; |
| 914 |
TSslMethodV23 = function:PSSL_METHOD; cdecl; |
| 915 |
TSslMethodTLS = function:PSSL_METHOD; cdecl; |
| 916 |
TSslCtxUsePrivateKey = function(ctx: PSSL_CTX; pkey: sslptr):Integer; cdecl; |
| 917 |
TSslCtxUsePrivateKeyASN1 = function(pk: integer; ctx: PSSL_CTX; d: sslptr; len: integer):Integer; cdecl; |
| 918 |
TSslCtxUsePrivateKeyFile = function(ctx: PSSL_CTX; const _file: PAnsiChar; _type: Integer):Integer; cdecl; |
| 919 |
TSslCtxUseCertificate = function(ctx: PSSL_CTX; x: SslPtr):Integer; cdecl; |
| 920 |
TSslCtxUseCertificateASN1 = function(ctx: PSSL_CTX; len: Integer; d: SslPtr):Integer; cdecl; |
| 921 |
TSslCtxUseCertificateFile = function(ctx: PSSL_CTX; const _file: PAnsiChar; _type: Integer):Integer; cdecl; |
| 922 |
TSslCtxUseCertificateChainFile = function(ctx: PSSL_CTX; const _file: PAnsiChar):Integer; cdecl; |
| 923 |
TSslCtxCheckPrivateKeyFile = function(ctx: PSSL_CTX):Integer; cdecl; |
| 924 |
TSslCtxSetDefaultPasswdCb = procedure(ctx: PSSL_CTX; cb: SslPtr); cdecl; |
| 925 |
TSslCtxSetDefaultPasswdCbUserdata = procedure(ctx: PSSL_CTX; u: SslPtr); cdecl; |
| 926 |
TSslCtxLoadVerifyLocations = function(ctx: PSSL_CTX; const CAfile: PAnsiChar; const CApath: PAnsiChar):Integer; cdecl; |
| 927 |
TSslCtxCtrl = function(ctx: PSSL_CTX; cmd: integer; larg: integer; parg: SslPtr): integer; cdecl; |
| 928 |
TSslNew = function(ctx: PSSL_CTX):PSSL; cdecl; |
| 929 |
TSslFree = procedure(ssl: PSSL); cdecl; |
| 930 |
TSslAccept = function(ssl: PSSL):Integer; cdecl; |
| 931 |
TSslConnect = function(ssl: PSSL):Integer; cdecl; |
| 932 |
TSslShutdown = function(ssl: PSSL):Integer; cdecl; |
| 933 |
TSslRead = function(ssl: PSSL; buf: PAnsiChar; num: Integer):Integer; cdecl; |
| 934 |
TSslPeek = function(ssl: PSSL; buf: PAnsiChar; num: Integer):Integer; cdecl; |
| 935 |
TSslWrite = function(ssl: PSSL; const buf: PAnsiChar; num: Integer):Integer; cdecl; |
| 936 |
TSslPending = function(ssl: PSSL):Integer; cdecl; |
| 937 |
TSslGetVersion = function(ssl: PSSL):PAnsiChar; cdecl; |
| 938 |
TSslGetPeerCertificate = function(ssl: PSSL):PX509; cdecl; |
| 939 |
TSslCtxSetVerify = procedure(ctx: PSSL_CTX; mode: Integer; arg2: SslPtr); cdecl; |
| 940 |
TSSLGetCurrentCipher = function(s: PSSL):SslPtr; cdecl; |
| 941 |
TSSLCipherGetName = function(c: Sslptr):PAnsiChar; cdecl; |
| 942 |
TSSLCipherGetBits = function(c: SslPtr; alg_bits: PInteger):Integer; cdecl; |
| 943 |
TSSLGetVerifyResult = function(ssl: PSSL):Integer; cdecl; |
| 944 |
TSSLCtrl = function(ssl: PSSL; cmd: integer; larg: integer; parg: SslPtr):Integer; cdecl; |
| 945 |
TSslSet1Host = function(ssl: PSSL; hostname: PAnsiChar):Integer; cdecl; |
| 946 |
TSslSessionFree = procedure(session: PSslPtr); cdecl; |
| 947 |
TSslGet1Session = function(ssl: PSSL):PSslPtr; cdecl; |
| 948 |
TSslSetSession = function(ssl: PSSL; session: PSslPtr): Integer; cdecl; |
| 949 |
|
| 950 |
TSSLSetTlsextHostName = function(ssl: PSSL; buf: PAnsiChar):Integer; cdecl; |
| 951 |
|
| 952 |
// libeay.dll |
| 953 |
TX509New = function: PX509; cdecl; |
| 954 |
TX509NameOneline = function(a: PX509_NAME; buf: PAnsiChar; size: Integer):PAnsiChar; cdecl; |
| 955 |
TX509GetSubjectName = function(a: PX509):PX509_NAME; cdecl; |
| 956 |
TX509GetIssuerName = function(a: PX509):PX509_NAME; cdecl; |
| 957 |
TX509NameHash = function(x: PX509_NAME):Cardinal; cdecl; |
| 958 |
TX509Digest = function(data: PX509; _type: PEVP_MD; md: PAnsiChar; len: PInteger):Integer; cdecl; |
| 959 |
TX509print = function(b: PBIO; a: PX509): integer; cdecl; |
| 960 |
TX509SetVersion = function(x: PX509; version: integer): integer; cdecl; |
| 961 |
TX509SetPubkey = function(x: PX509; pkey: EVP_PKEY): integer; cdecl; |
| 962 |
TX509SetIssuerName = function(x: PX509; name: PX509_NAME): integer; cdecl; |
| 963 |
TX509NameAddEntryByTxt = function(name: PX509_NAME; field: PAnsiChar; _type: integer; |
| 964 |
bytes: PAnsiChar; len, loc, _set: integer): integer; cdecl; |
| 965 |
TX509Sign = function(x: PX509; pkey: EVP_PKEY; const md: PEVP_MD): integer; cdecl; |
| 966 |
TX509GmtimeAdj = function(s: PASN1_UTCTIME; adj: integer): PASN1_UTCTIME; cdecl; |
| 967 |
TX509SetNotBefore = function(x: PX509; tm: PASN1_UTCTIME): integer; cdecl; |
| 968 |
TX509SetNotAfter = function(x: PX509; tm: PASN1_UTCTIME): integer; cdecl; |
| 969 |
TX509GetSerialNumber = function(x: PX509): PASN1_INTEGER; cdecl; |
| 970 |
TEvpPkeyNew = function: EVP_PKEY; cdecl; |
| 971 |
TEvpPkeyFree = procedure(pk: EVP_PKEY); cdecl; |
| 972 |
TEvpPkeyAssign = function(pkey: EVP_PKEY; _type: integer; key: Prsa): integer; cdecl; |
| 973 |
TEvpGetDigestByName = function(Name: PAnsiChar): PEVP_MD; cdecl; |
| 974 |
TEVPcleanup = procedure; cdecl; |
| 975 |
TSSLeayversion = function(t: integer): PAnsiChar; cdecl; |
| 976 |
TErrErrorString = procedure(e: integer; buf: PAnsiChar; len: integer); cdecl; |
| 977 |
TErrGetError = function: integer; cdecl; |
| 978 |
TErrClearError = procedure; cdecl; |
| 979 |
TErrFreeStrings = procedure; cdecl; |
| 980 |
TErrRemoveState = procedure(pid: integer); cdecl; |
| 981 |
TOPENSSLaddallalgorithms = procedure; cdecl; |
| 982 |
TCRYPTOcleanupAllExData = procedure; cdecl; |
| 983 |
TRandScreen = procedure; cdecl; |
| 984 |
TBioNew = function(b: PBIO_METHOD): PBIO; cdecl; |
| 985 |
TBioFreeAll = procedure(b: PBIO); cdecl; |
| 986 |
TBioSMem = function: PBIO_METHOD; cdecl; |
| 987 |
TBioCtrlPending = function(b: PBIO): integer; cdecl; |
| 988 |
TBioRead = function(b: PBIO; Buf: PAnsiChar; Len: integer): integer; cdecl; |
| 989 |
TBioWrite = function(b: PBIO; Buf: PAnsiChar; Len: integer): integer; cdecl; |
| 990 |
Td2iPKCS12bio = function(b:PBIO; Pkcs12: SslPtr): SslPtr; cdecl; |
| 991 |
TPKCS12parse = function(p12: SslPtr; pass: PAnsiChar; var pkey, cert, ca: SslPtr): integer; cdecl; |
| 992 |
TPKCS12free = procedure(p12: SslPtr); cdecl; |
| 993 |
TRsaGenerateKey = function(bits, e: integer; callback: PFunction; cb_arg: SslPtr): PRSA; cdecl; |
| 994 |
TAsn1UtctimeNew = function: PASN1_UTCTIME; cdecl; |
| 995 |
TAsn1UtctimeFree = procedure(a: PASN1_UTCTIME); cdecl; |
| 996 |
TAsn1IntegerSet = function(a: PASN1_INTEGER; v: integer): integer; cdecl; |
| 997 |
TAsn1IntegerGet = function(a: PASN1_INTEGER): integer; cdecl; {pf} |
| 998 |
Ti2dX509bio = function(b: PBIO; x: PX509): integer; cdecl; |
| 999 |
Td2iX509bio = function(b:PBIO; x:PX509): PX509; cdecl; {pf} |
| 1000 |
TPEMReadBioX509 = function(b:PBIO; {var x:PX509;}x:PSslPtr; callback:PFunction; cb_arg:SslPtr): PX509; cdecl; {pf} |
| 1001 |
TSkX509PopFree = procedure(st: PSTACK; func: TSkPopFreeFunc); cdecl; {pf} |
| 1002 |
Ti2dPrivateKeyBio= function(b: PBIO; pkey: EVP_PKEY): integer; cdecl; |
| 1003 |
|
| 1004 |
// 3DES functions |
| 1005 |
TDESsetoddparity = procedure(Key: des_cblock); cdecl; |
| 1006 |
TDESsetkeychecked = function(key: des_cblock; schedule: des_key_schedule): Integer; cdecl; |
| 1007 |
TDESecbencrypt = procedure(Input: des_cblock; output: des_cblock; ks: des_key_schedule; enc: Integer); cdecl; |
| 1008 |
//thread lock functions |
| 1009 |
TCRYPTOnumlocks = function: integer; cdecl; |
| 1010 |
TCRYPTOSetLockingCallback = procedure(cb: Sslptr); cdecl; |
| 1011 |
|
| 1012 |
var |
| 1013 |
// libssl.dll |
| 1014 |
_SslGetError: TSslGetError = nil; |
| 1015 |
_SslLibraryInit: TSslLibraryInit = nil; |
| 1016 |
_SslLoadErrorStrings: TSslLoadErrorStrings = nil; |
| 1017 |
_SslCtxSetCipherList: TSslCtxSetCipherList = nil; |
| 1018 |
_SslCtxNew: TSslCtxNew = nil; |
| 1019 |
_SslCtxFree: TSslCtxFree = nil; |
| 1020 |
_SslSetFd: TSslSetFd = nil; |
| 1021 |
_SslMethodV2: TSslMethodV2 = nil; |
| 1022 |
_SslMethodV3: TSslMethodV3 = nil; |
| 1023 |
_SslMethodTLSV1: TSslMethodTLSV1 = nil; |
| 1024 |
_SslMethodTLSV11: TSslMethodTLSV11 = nil; |
| 1025 |
_SslMethodTLSV12: TSslMethodTLSV12 = nil; |
| 1026 |
_SslMethodV23: TSslMethodV23 = nil; |
| 1027 |
_SslMethodTLS: TSslMethodTLS = nil; |
| 1028 |
_SslCtxUsePrivateKey: TSslCtxUsePrivateKey = nil; |
| 1029 |
_SslCtxUsePrivateKeyASN1: TSslCtxUsePrivateKeyASN1 = nil; |
| 1030 |
_SslCtxUsePrivateKeyFile: TSslCtxUsePrivateKeyFile = nil; |
| 1031 |
_SslCtxUseCertificate: TSslCtxUseCertificate = nil; |
| 1032 |
_SslCtxUseCertificateASN1: TSslCtxUseCertificateASN1 = nil; |
| 1033 |
_SslCtxUseCertificateFile: TSslCtxUseCertificateFile = nil; |
| 1034 |
_SslCtxUseCertificateChainFile: TSslCtxUseCertificateChainFile = nil; |
| 1035 |
_SslCtxCheckPrivateKeyFile: TSslCtxCheckPrivateKeyFile = nil; |
| 1036 |
_SslCtxSetDefaultPasswdCb: TSslCtxSetDefaultPasswdCb = nil; |
| 1037 |
_SslCtxSetDefaultPasswdCbUserdata: TSslCtxSetDefaultPasswdCbUserdata = nil; |
| 1038 |
_SslCtxLoadVerifyLocations: TSslCtxLoadVerifyLocations = nil; |
| 1039 |
_SslCtxCtrl: TSslCtxCtrl = nil; |
| 1040 |
_SslNew: TSslNew = nil; |
| 1041 |
_SslFree: TSslFree = nil; |
| 1042 |
_SslAccept: TSslAccept = nil; |
| 1043 |
_SslConnect: TSslConnect = nil; |
| 1044 |
_SslShutdown: TSslShutdown = nil; |
| 1045 |
_SslRead: TSslRead = nil; |
| 1046 |
_SslPeek: TSslPeek = nil; |
| 1047 |
_SslWrite: TSslWrite = nil; |
| 1048 |
_SslPending: TSslPending = nil; |
| 1049 |
_SslGetVersion: TSslGetVersion = nil; |
| 1050 |
_SslGetPeerCertificate: TSslGetPeerCertificate = nil; |
| 1051 |
_SslCtxSetVerify: TSslCtxSetVerify = nil; |
| 1052 |
_SSLGetCurrentCipher: TSSLGetCurrentCipher = nil; |
| 1053 |
_SSLCipherGetName: TSSLCipherGetName = nil; |
| 1054 |
_SSLCipherGetBits: TSSLCipherGetBits = nil; |
| 1055 |
_SSLGetVerifyResult: TSSLGetVerifyResult = nil; |
| 1056 |
_SSLCtrl: TSSLCtrl = nil; |
| 1057 |
_SslSet1Host: TSslSet1Host = nil; |
| 1058 |
_SslSessionFree: TSslSessionFree = nil; |
| 1059 |
_SslGet1Session: TSslGet1Session = nil; |
| 1060 |
_SslSetSession: TSslSetSession = nil; |
| 1061 |
|
| 1062 |
// libeay.dll |
| 1063 |
_X509New: TX509New = nil; |
| 1064 |
_X509NameOneline: TX509NameOneline = nil; |
| 1065 |
_X509GetSubjectName: TX509GetSubjectName = nil; |
| 1066 |
_X509GetIssuerName: TX509GetIssuerName = nil; |
| 1067 |
_X509NameHash: TX509NameHash = nil; |
| 1068 |
_X509Digest: TX509Digest = nil; |
| 1069 |
_X509print: TX509print = nil; |
| 1070 |
_X509SetVersion: TX509SetVersion = nil; |
| 1071 |
_X509SetPubkey: TX509SetPubkey = nil; |
| 1072 |
_X509SetIssuerName: TX509SetIssuerName = nil; |
| 1073 |
_X509NameAddEntryByTxt: TX509NameAddEntryByTxt = nil; |
| 1074 |
_X509Sign: TX509Sign = nil; |
| 1075 |
_X509GmtimeAdj: TX509GmtimeAdj = nil; |
| 1076 |
_X509SetNotBefore: TX509SetNotBefore = nil; |
| 1077 |
_X509SetNotAfter: TX509SetNotAfter = nil; |
| 1078 |
_X509GetSerialNumber: TX509GetSerialNumber = nil; |
| 1079 |
_EvpPkeyNew: TEvpPkeyNew = nil; |
| 1080 |
_EvpPkeyFree: TEvpPkeyFree = nil; |
| 1081 |
_EvpPkeyAssign: TEvpPkeyAssign = nil; |
| 1082 |
_EvpGetDigestByName: TEvpGetDigestByName = nil; |
| 1083 |
_EVPcleanup: TEVPcleanup = nil; |
| 1084 |
_SSLeayversion: TSSLeayversion = nil; |
| 1085 |
_ErrErrorString: TErrErrorString = nil; |
| 1086 |
_ErrGetError: TErrGetError = nil; |
| 1087 |
_ErrClearError: TErrClearError = nil; |
| 1088 |
_ErrFreeStrings: TErrFreeStrings = nil; |
| 1089 |
_ErrRemoveState: TErrRemoveState = nil; |
| 1090 |
_OPENSSLaddallalgorithms: TOPENSSLaddallalgorithms = nil; |
| 1091 |
_CRYPTOcleanupAllExData: TCRYPTOcleanupAllExData = nil; |
| 1092 |
_RandScreen: TRandScreen = nil; |
| 1093 |
_BioNew: TBioNew = nil; |
| 1094 |
_BioFreeAll: TBioFreeAll = nil; |
| 1095 |
_BioSMem: TBioSMem = nil; |
| 1096 |
_BioCtrlPending: TBioCtrlPending = nil; |
| 1097 |
_BioRead: TBioRead = nil; |
| 1098 |
_BioWrite: TBioWrite = nil; |
| 1099 |
_d2iPKCS12bio: Td2iPKCS12bio = nil; |
| 1100 |
_PKCS12parse: TPKCS12parse = nil; |
| 1101 |
_PKCS12free: TPKCS12free = nil; |
| 1102 |
_RsaGenerateKey: TRsaGenerateKey = nil; |
| 1103 |
_Asn1UtctimeNew: TAsn1UtctimeNew = nil; |
| 1104 |
_Asn1UtctimeFree: TAsn1UtctimeFree = nil; |
| 1105 |
_Asn1IntegerSet: TAsn1IntegerSet = nil; |
| 1106 |
_Asn1IntegerGet: TAsn1IntegerGet = nil; {pf} |
| 1107 |
_i2dX509bio: Ti2dX509bio = nil; |
| 1108 |
_d2iX509bio: Td2iX509bio = nil; {pf} |
| 1109 |
_PEMReadBioX509: TPEMReadBioX509 = nil; {pf} |
| 1110 |
_SkX509PopFree: TSkX509PopFree = nil; {pf} |
| 1111 |
_i2dPrivateKeyBio: Ti2dPrivateKeyBio = nil; |
| 1112 |
|
| 1113 |
// 3DES functions |
| 1114 |
_DESsetoddparity: TDESsetoddparity = nil; |
| 1115 |
_DESsetkeychecked: TDESsetkeychecked = nil; |
| 1116 |
_DESecbencrypt: TDESecbencrypt = nil; |
| 1117 |
//thread lock functions |
| 1118 |
_CRYPTOnumlocks: TCRYPTOnumlocks = nil; |
| 1119 |
_CRYPTOSetLockingCallback: TCRYPTOSetLockingCallback = nil; |
| 1120 |
{$ENDIF} |
| 1121 |
|
| 1122 |
var |
| 1123 |
SSLCS: TCriticalSection; |
| 1124 |
SSLloaded: boolean = false; |
| 1125 |
{$IFNDEF CIL} |
| 1126 |
Locks: TList; |
| 1127 |
{$ENDIF} |
| 1128 |
|
| 1129 |
{$IFNDEF CIL} |
| 1130 |
// libssl.dll |
| 1131 |
function SslGetError(s: PSSL; ret_code: Integer):Integer; |
| 1132 |
begin |
| 1133 |
if InitSSLInterface and Assigned(_SslGetError) then |
| 1134 |
Result := _SslGetError(s, ret_code) |
| 1135 |
else |
| 1136 |
Result := SSL_ERROR_SSL; |
| 1137 |
end; |
| 1138 |
|
| 1139 |
function SslLibraryInit:Integer; |
| 1140 |
begin |
| 1141 |
if InitSSLInterface and Assigned(_SslLibraryInit) then |
| 1142 |
Result := _SslLibraryInit |
| 1143 |
else |
| 1144 |
Result := 1; |
| 1145 |
end; |
| 1146 |
|
| 1147 |
procedure SslLoadErrorStrings; |
| 1148 |
begin |
| 1149 |
if InitSSLInterface and Assigned(_SslLoadErrorStrings) then |
| 1150 |
_SslLoadErrorStrings; |
| 1151 |
end; |
| 1152 |
|
| 1153 |
//function SslCtxSetCipherList(arg0: PSSL_CTX; str: PChar):Integer; |
| 1154 |
function SslCtxSetCipherList(arg0: PSSL_CTX; var str: AnsiString):Integer; |
| 1155 |
begin |
| 1156 |
if InitSSLInterface and Assigned(_SslCtxSetCipherList) then |
| 1157 |
Result := _SslCtxSetCipherList(arg0, PAnsiChar(str)) |
| 1158 |
else |
| 1159 |
Result := 0; |
| 1160 |
end; |
| 1161 |
|
| 1162 |
function SslCtxNew(meth: PSSL_METHOD):PSSL_CTX; |
| 1163 |
begin |
| 1164 |
if InitSSLInterface and Assigned(_SslCtxNew) then |
| 1165 |
Result := _SslCtxNew(meth) |
| 1166 |
else |
| 1167 |
Result := nil; |
| 1168 |
end; |
| 1169 |
|
| 1170 |
procedure SslCtxFree(arg0: PSSL_CTX); |
| 1171 |
begin |
| 1172 |
if InitSSLInterface and Assigned(_SslCtxFree) then |
| 1173 |
_SslCtxFree(arg0); |
| 1174 |
end; |
| 1175 |
|
| 1176 |
function SslSetFd(s: PSSL; fd: Integer):Integer; |
| 1177 |
begin |
| 1178 |
if InitSSLInterface and Assigned(_SslSetFd) then |
| 1179 |
Result := _SslSetFd(s, fd) |
| 1180 |
else |
| 1181 |
Result := 0; |
| 1182 |
end; |
| 1183 |
|
| 1184 |
function SslMethodV2:PSSL_METHOD; |
| 1185 |
begin |
| 1186 |
if InitSSLInterface and Assigned(_SslMethodV2) then |
| 1187 |
Result := _SslMethodV2 |
| 1188 |
else |
| 1189 |
Result := nil; |
| 1190 |
end; |
| 1191 |
|
| 1192 |
function SslMethodV3:PSSL_METHOD; |
| 1193 |
begin |
| 1194 |
if InitSSLInterface and Assigned(_SslMethodV3) then |
| 1195 |
Result := _SslMethodV3 |
| 1196 |
else |
| 1197 |
Result := nil; |
| 1198 |
end; |
| 1199 |
|
| 1200 |
function SslMethodTLSV1:PSSL_METHOD; |
| 1201 |
begin |
| 1202 |
if InitSSLInterface and Assigned(_SslMethodTLSV1) then |
| 1203 |
Result := _SslMethodTLSV1 |
| 1204 |
else |
| 1205 |
Result := nil; |
| 1206 |
end; |
| 1207 |
|
| 1208 |
function SslMethodTLSV11:PSSL_METHOD; |
| 1209 |
begin |
| 1210 |
if InitSSLInterface and Assigned(_SslMethodTLSV11) then |
| 1211 |
Result := _SslMethodTLSV11 |
| 1212 |
else |
| 1213 |
Result := nil; |
| 1214 |
end; |
| 1215 |
|
| 1216 |
function SslMethodTLSV12:PSSL_METHOD; |
| 1217 |
begin |
| 1218 |
if InitSSLInterface and Assigned(_SslMethodTLSV12) then |
| 1219 |
Result := _SslMethodTLSV12 |
| 1220 |
else |
| 1221 |
Result := nil; |
| 1222 |
end; |
| 1223 |
|
| 1224 |
function SslMethodV23:PSSL_METHOD; |
| 1225 |
begin |
| 1226 |
if InitSSLInterface and Assigned(_SslMethodV23) then |
| 1227 |
Result := _SslMethodV23 |
| 1228 |
else |
| 1229 |
Result := nil; |
| 1230 |
end; |
| 1231 |
|
| 1232 |
function SslMethodTLS:PSSL_METHOD; |
| 1233 |
begin |
| 1234 |
if InitSSLInterface and Assigned(_SslMethodTLS) then |
| 1235 |
Result := _SslMethodTLS |
| 1236 |
else |
| 1237 |
Result := nil; |
| 1238 |
end; |
| 1239 |
|
| 1240 |
function SslCtxUsePrivateKey(ctx: PSSL_CTX; pkey: SslPtr):Integer; |
| 1241 |
begin |
| 1242 |
if InitSSLInterface and Assigned(_SslCtxUsePrivateKey) then |
| 1243 |
Result := _SslCtxUsePrivateKey(ctx, pkey) |
| 1244 |
else |
| 1245 |
Result := 0; |
| 1246 |
end; |
| 1247 |
|
| 1248 |
function SslCtxUsePrivateKeyASN1(pk: integer; ctx: PSSL_CTX; d: AnsiString; len: integer):Integer; |
| 1249 |
begin |
| 1250 |
if InitSSLInterface and Assigned(_SslCtxUsePrivateKeyASN1) then |
| 1251 |
Result := _SslCtxUsePrivateKeyASN1(pk, ctx, Sslptr(d), len) |
| 1252 |
else |
| 1253 |
Result := 0; |
| 1254 |
end; |
| 1255 |
|
| 1256 |
//function SslCtxUsePrivateKeyFile(ctx: PSSL_CTX; const _file: PChar; _type: Integer):Integer; |
| 1257 |
function SslCtxUsePrivateKeyFile(ctx: PSSL_CTX; const _file: AnsiString; _type: Integer):Integer; |
| 1258 |
begin |
| 1259 |
if InitSSLInterface and Assigned(_SslCtxUsePrivateKeyFile) then |
| 1260 |
Result := _SslCtxUsePrivateKeyFile(ctx, PAnsiChar(_file), _type) |
| 1261 |
else |
| 1262 |
Result := 0; |
| 1263 |
end; |
| 1264 |
|
| 1265 |
function SslCtxUseCertificate(ctx: PSSL_CTX; x: SslPtr):Integer; |
| 1266 |
begin |
| 1267 |
if InitSSLInterface and Assigned(_SslCtxUseCertificate) then |
| 1268 |
Result := _SslCtxUseCertificate(ctx, x) |
| 1269 |
else |
| 1270 |
Result := 0; |
| 1271 |
end; |
| 1272 |
|
| 1273 |
function SslCtxUseCertificateASN1(ctx: PSSL_CTX; len: integer; d: AnsiString):Integer; |
| 1274 |
begin |
| 1275 |
if InitSSLInterface and Assigned(_SslCtxUseCertificateASN1) then |
| 1276 |
Result := _SslCtxUseCertificateASN1(ctx, len, SslPtr(d)) |
| 1277 |
else |
| 1278 |
Result := 0; |
| 1279 |
end; |
| 1280 |
|
| 1281 |
function SslCtxUseCertificateFile(ctx: PSSL_CTX; const _file: AnsiString; _type: Integer):Integer; |
| 1282 |
begin |
| 1283 |
if InitSSLInterface and Assigned(_SslCtxUseCertificateFile) then |
| 1284 |
Result := _SslCtxUseCertificateFile(ctx, PAnsiChar(_file), _type) |
| 1285 |
else |
| 1286 |
Result := 0; |
| 1287 |
end; |
| 1288 |
|
| 1289 |
//function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const _file: PChar):Integer; |
| 1290 |
function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const _file: AnsiString):Integer; |
| 1291 |
begin |
| 1292 |
if InitSSLInterface and Assigned(_SslCtxUseCertificateChainFile) then |
| 1293 |
Result := _SslCtxUseCertificateChainFile(ctx, PAnsiChar(_file)) |
| 1294 |
else |
| 1295 |
Result := 0; |
| 1296 |
end; |
| 1297 |
|
| 1298 |
function SslCtxCheckPrivateKeyFile(ctx: PSSL_CTX):Integer; |
| 1299 |
begin |
| 1300 |
if InitSSLInterface and Assigned(_SslCtxCheckPrivateKeyFile) then |
| 1301 |
Result := _SslCtxCheckPrivateKeyFile(ctx) |
| 1302 |
else |
| 1303 |
Result := 0; |
| 1304 |
end; |
| 1305 |
|
| 1306 |
procedure SslCtxSetDefaultPasswdCb(ctx: PSSL_CTX; cb: PPasswdCb); |
| 1307 |
begin |
| 1308 |
if InitSSLInterface and Assigned(_SslCtxSetDefaultPasswdCb) then |
| 1309 |
_SslCtxSetDefaultPasswdCb(ctx, cb); |
| 1310 |
end; |
| 1311 |
|
| 1312 |
procedure SslCtxSetDefaultPasswdCbUserdata(ctx: PSSL_CTX; u: SslPtr); |
| 1313 |
begin |
| 1314 |
if InitSSLInterface and Assigned(_SslCtxSetDefaultPasswdCbUserdata) then |
| 1315 |
_SslCtxSetDefaultPasswdCbUserdata(ctx, u); |
| 1316 |
end; |
| 1317 |
|
| 1318 |
//function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; const CAfile: PChar; const CApath: PChar):Integer; |
| 1319 |
function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; const CAfile: AnsiString; const CApath: AnsiString):Integer; |
| 1320 |
begin |
| 1321 |
if InitSSLInterface and Assigned(_SslCtxLoadVerifyLocations) then |
| 1322 |
Result := _SslCtxLoadVerifyLocations(ctx, SslPtr(CAfile), SslPtr(CApath)) |
| 1323 |
else |
| 1324 |
Result := 0; |
| 1325 |
end; |
| 1326 |
|
| 1327 |
function SslCtxCtrl(ctx: PSSL_CTX; cmd: integer; larg: integer; parg: SslPtr): integer; |
| 1328 |
begin |
| 1329 |
if InitSSLInterface and Assigned(_SslCtxCtrl) then |
| 1330 |
Result := _SslCtxCtrl(ctx, cmd, larg, parg) |
| 1331 |
else |
| 1332 |
Result := 0; |
| 1333 |
end; |
| 1334 |
|
| 1335 |
function SslNew(ctx: PSSL_CTX):PSSL; |
| 1336 |
begin |
| 1337 |
if InitSSLInterface and Assigned(_SslNew) then |
| 1338 |
Result := _SslNew(ctx) |
| 1339 |
else |
| 1340 |
Result := nil; |
| 1341 |
end; |
| 1342 |
|
| 1343 |
procedure SslFree(ssl: PSSL); |
| 1344 |
begin |
| 1345 |
if InitSSLInterface and Assigned(_SslFree) then |
| 1346 |
_SslFree(ssl); |
| 1347 |
end; |
| 1348 |
|
| 1349 |
function SslAccept(ssl: PSSL):Integer; |
| 1350 |
begin |
| 1351 |
if InitSSLInterface and Assigned(_SslAccept) then |
| 1352 |
Result := _SslAccept(ssl) |
| 1353 |
else |
| 1354 |
Result := -1; |
| 1355 |
end; |
| 1356 |
|
| 1357 |
function SslConnect(ssl: PSSL):Integer; |
| 1358 |
begin |
| 1359 |
if InitSSLInterface and Assigned(_SslConnect) then |
| 1360 |
Result := _SslConnect(ssl) |
| 1361 |
else |
| 1362 |
Result := -1; |
| 1363 |
end; |
| 1364 |
|
| 1365 |
function SslShutdown(ssl: PSSL):Integer; |
| 1366 |
begin |
| 1367 |
if InitSSLInterface and Assigned(_SslShutdown) then |
| 1368 |
Result := _SslShutdown(ssl) |
| 1369 |
else |
| 1370 |
Result := -1; |
| 1371 |
end; |
| 1372 |
|
| 1373 |
//function SslRead(ssl: PSSL; buf: PChar; num: Integer):Integer; |
| 1374 |
function SslRead(ssl: PSSL; buf: SslPtr; num: Integer):Integer; |
| 1375 |
begin |
| 1376 |
if InitSSLInterface and Assigned(_SslRead) then |
| 1377 |
Result := _SslRead(ssl, PAnsiChar(buf), num) |
| 1378 |
else |
| 1379 |
Result := -1; |
| 1380 |
end; |
| 1381 |
|
| 1382 |
//function SslPeek(ssl: PSSL; buf: PChar; num: Integer):Integer; |
| 1383 |
function SslPeek(ssl: PSSL; buf: SslPtr; num: Integer):Integer; |
| 1384 |
begin |
| 1385 |
if InitSSLInterface and Assigned(_SslPeek) then |
| 1386 |
Result := _SslPeek(ssl, PAnsiChar(buf), num) |
| 1387 |
else |
| 1388 |
Result := -1; |
| 1389 |
end; |
| 1390 |
|
| 1391 |
//function SslWrite(ssl: PSSL; const buf: PChar; num: Integer):Integer; |
| 1392 |
function SslWrite(ssl: PSSL; buf: SslPtr; num: Integer):Integer; |
| 1393 |
begin |
| 1394 |
if InitSSLInterface and Assigned(_SslWrite) then |
| 1395 |
Result := _SslWrite(ssl, PAnsiChar(buf), num) |
| 1396 |
else |
| 1397 |
Result := -1; |
| 1398 |
end; |
| 1399 |
|
| 1400 |
function SslPending(ssl: PSSL):Integer; |
| 1401 |
begin |
| 1402 |
if InitSSLInterface and Assigned(_SslPending) then |
| 1403 |
Result := _SslPending(ssl) |
| 1404 |
else |
| 1405 |
Result := 0; |
| 1406 |
end; |
| 1407 |
|
| 1408 |
//function SslGetVersion(ssl: PSSL):PChar; |
| 1409 |
function SslGetVersion(ssl: PSSL):AnsiString; |
| 1410 |
begin |
| 1411 |
if InitSSLInterface and Assigned(_SslGetVersion) then |
| 1412 |
Result := _SslGetVersion(ssl) |
| 1413 |
else |
| 1414 |
Result := ''; |
| 1415 |
end; |
| 1416 |
|
| 1417 |
function SslGetPeerCertificate(ssl: PSSL):PX509; |
| 1418 |
begin |
| 1419 |
if InitSSLInterface and Assigned(_SslGetPeerCertificate) then |
| 1420 |
Result := _SslGetPeerCertificate(ssl) |
| 1421 |
else |
| 1422 |
Result := nil; |
| 1423 |
end; |
| 1424 |
|
| 1425 |
//procedure SslCtxSetVerify(ctx: PSSL_CTX; mode: Integer; arg2: SslPtr); |
| 1426 |
procedure SslCtxSetVerify(ctx: PSSL_CTX; mode: Integer; arg2: PFunction); |
| 1427 |
begin |
| 1428 |
if InitSSLInterface and Assigned(_SslCtxSetVerify) then |
| 1429 |
_SslCtxSetVerify(ctx, mode, @arg2); |
| 1430 |
end; |
| 1431 |
|
| 1432 |
function SSLGetCurrentCipher(s: PSSL):SslPtr; |
| 1433 |
begin |
| 1434 |
if InitSSLInterface and Assigned(_SSLGetCurrentCipher) then |
| 1435 |
{$IFDEF CIL} |
| 1436 |
{$ELSE} |
| 1437 |
Result := _SSLGetCurrentCipher(s) |
| 1438 |
{$ENDIF} |
| 1439 |
else |
| 1440 |
Result := nil; |
| 1441 |
end; |
| 1442 |
|
| 1443 |
//function SSLCipherGetName(c: SslPtr):PChar; |
| 1444 |
function SSLCipherGetName(c: SslPtr):AnsiString; |
| 1445 |
begin |
| 1446 |
if InitSSLInterface and Assigned(_SSLCipherGetName) then |
| 1447 |
Result := _SSLCipherGetName(c) |
| 1448 |
else |
| 1449 |
Result := ''; |
| 1450 |
end; |
| 1451 |
|
| 1452 |
//function SSLCipherGetBits(c: SslPtr; alg_bits: PInteger):Integer; |
| 1453 |
function SSLCipherGetBits(c: SslPtr; var alg_bits: Integer):Integer; |
| 1454 |
begin |
| 1455 |
if InitSSLInterface and Assigned(_SSLCipherGetBits) then |
| 1456 |
Result := _SSLCipherGetBits(c, @alg_bits) |
| 1457 |
else |
| 1458 |
Result := 0; |
| 1459 |
end; |
| 1460 |
|
| 1461 |
function SSLGetVerifyResult(ssl: PSSL):Integer; |
| 1462 |
begin |
| 1463 |
if InitSSLInterface and Assigned(_SSLGetVerifyResult) then |
| 1464 |
Result := _SSLGetVerifyResult(ssl) |
| 1465 |
else |
| 1466 |
Result := X509_V_ERR_APPLICATION_VERIFICATION; |
| 1467 |
end; |
| 1468 |
|
| 1469 |
|
| 1470 |
function SSLCtrl(ssl: PSSL; cmd: integer; larg: integer; parg: SslPtr):Integer; |
| 1471 |
begin |
| 1472 |
if InitSSLInterface and Assigned(_SSLCtrl) then |
| 1473 |
Result := _SSLCtrl(ssl, cmd, larg, parg) |
| 1474 |
else |
| 1475 |
Result := X509_V_ERR_APPLICATION_VERIFICATION; |
| 1476 |
end; |
| 1477 |
|
| 1478 |
function SslSet1Host(ssl: PSSL; hostname: PAnsiChar):Integer; |
| 1479 |
begin |
| 1480 |
if InitSSLInterface and Assigned(_SslSet1Host) then |
| 1481 |
Result := _SslSet1Host(ssl, hostname) |
| 1482 |
else |
| 1483 |
Result := 0; |
| 1484 |
end; |
| 1485 |
|
| 1486 |
procedure SslSessionFree(session: PSslPtr); |
| 1487 |
begin |
| 1488 |
if InitSSLInterface and Assigned(_SslSessionFree) then |
| 1489 |
_SslSessionFree(session); |
| 1490 |
end; |
| 1491 |
|
| 1492 |
function SslGet1Session(ssl: PSSL): PSslPtr; |
| 1493 |
begin |
| 1494 |
if InitSSLInterface and Assigned(_SslGet1Session) then |
| 1495 |
Result := _SslGet1Session(ssl) |
| 1496 |
else |
| 1497 |
Result := nil; |
| 1498 |
end; |
| 1499 |
|
| 1500 |
function SslSetSession(ssl: PSSL; session: PSslPtr): Integer; |
| 1501 |
begin |
| 1502 |
if InitSSLInterface and Assigned(_SslSetSession) then |
| 1503 |
Result := _SslSetSession(ssl, session) |
| 1504 |
else |
| 1505 |
Result := 0; |
| 1506 |
end; |
| 1507 |
|
| 1508 |
// libeay.dll |
| 1509 |
function X509New: PX509; |
| 1510 |
begin |
| 1511 |
if InitSSLInterface and Assigned(_X509New) then |
| 1512 |
Result := _X509New |
| 1513 |
else |
| 1514 |
Result := nil; |
| 1515 |
end; |
| 1516 |
|
| 1517 |
procedure X509Free(x: PX509); |
| 1518 |
begin |
| 1519 |
if InitSSLInterface and Assigned(_X509Free) then |
| 1520 |
_X509Free(x); |
| 1521 |
end; |
| 1522 |
|
| 1523 |
//function SslX509NameOneline(a: PX509_NAME; buf: PChar; size: Integer):PChar; |
| 1524 |
function X509NameOneline(a: PX509_NAME; var buf: AnsiString; size: Integer):AnsiString; |
| 1525 |
begin |
| 1526 |
if InitSSLInterface and Assigned(_X509NameOneline) then |
| 1527 |
Result := _X509NameOneline(a, PAnsiChar(buf),size) |
| 1528 |
else |
| 1529 |
Result := ''; |
| 1530 |
end; |
| 1531 |
|
| 1532 |
function X509GetSubjectName(a: PX509):PX509_NAME; |
| 1533 |
begin |
| 1534 |
if InitSSLInterface and Assigned(_X509GetSubjectName) then |
| 1535 |
Result := _X509GetSubjectName(a) |
| 1536 |
else |
| 1537 |
Result := nil; |
| 1538 |
end; |
| 1539 |
|
| 1540 |
function X509GetIssuerName(a: PX509):PX509_NAME; |
| 1541 |
begin |
| 1542 |
if InitSSLInterface and Assigned(_X509GetIssuerName) then |
| 1543 |
Result := _X509GetIssuerName(a) |
| 1544 |
else |
| 1545 |
Result := nil; |
| 1546 |
end; |
| 1547 |
|
| 1548 |
function X509NameHash(x: PX509_NAME):Cardinal; |
| 1549 |
begin |
| 1550 |
if InitSSLInterface and Assigned(_X509NameHash) then |
| 1551 |
Result := _X509NameHash(x) |
| 1552 |
else |
| 1553 |
Result := 0; |
| 1554 |
end; |
| 1555 |
|
| 1556 |
//function SslX509Digest(data: PX509; _type: PEVP_MD; md: PChar; len: PInteger):Integer; |
| 1557 |
function X509Digest(data: PX509; _type: PEVP_MD; md: AnsiString; var len: Integer):Integer; |
| 1558 |
begin |
| 1559 |
if InitSSLInterface and Assigned(_X509Digest) then |
| 1560 |
Result := _X509Digest(data, _type, PAnsiChar(md), @len) |
| 1561 |
else |
| 1562 |
Result := 0; |
| 1563 |
end; |
| 1564 |
|
| 1565 |
function EvpPkeyNew: EVP_PKEY; |
| 1566 |
begin |
| 1567 |
if InitSSLInterface and Assigned(_EvpPkeyNew) then |
| 1568 |
Result := _EvpPkeyNew |
| 1569 |
else |
| 1570 |
Result := nil; |
| 1571 |
end; |
| 1572 |
|
| 1573 |
procedure EvpPkeyFree(pk: EVP_PKEY); |
| 1574 |
begin |
| 1575 |
if InitSSLInterface and Assigned(_EvpPkeyFree) then |
| 1576 |
_EvpPkeyFree(pk); |
| 1577 |
end; |
| 1578 |
|
| 1579 |
function SSLeayversion(t: integer): Ansistring; |
| 1580 |
begin |
| 1581 |
if InitSSLInterface and Assigned(_SSLeayversion) then |
| 1582 |
Result := PAnsiChar(_SSLeayversion(t)) |
| 1583 |
else |
| 1584 |
Result := ''; |
| 1585 |
end; |
| 1586 |
|
| 1587 |
procedure ErrErrorString(e: integer; var buf: Ansistring; len: integer); |
| 1588 |
begin |
| 1589 |
if InitSSLInterface and Assigned(_ErrErrorString) then |
| 1590 |
_ErrErrorString(e, Pointer(buf), len); |
| 1591 |
buf := PAnsiChar(Buf); |
| 1592 |
end; |
| 1593 |
|
| 1594 |
function ErrGetError: integer; |
| 1595 |
begin |
| 1596 |
if InitSSLInterface and Assigned(_ErrGetError) then |
| 1597 |
Result := _ErrGetError |
| 1598 |
else |
| 1599 |
Result := SSL_ERROR_SSL; |
| 1600 |
end; |
| 1601 |
|
| 1602 |
procedure ErrClearError; |
| 1603 |
begin |
| 1604 |
if InitSSLInterface and Assigned(_ErrClearError) then |
| 1605 |
_ErrClearError; |
| 1606 |
end; |
| 1607 |
|
| 1608 |
procedure ErrFreeStrings; |
| 1609 |
begin |
| 1610 |
if InitSSLInterface and Assigned(_ErrFreeStrings) then |
| 1611 |
_ErrFreeStrings; |
| 1612 |
end; |
| 1613 |
|
| 1614 |
procedure ErrRemoveState(pid: integer); |
| 1615 |
begin |
| 1616 |
if InitSSLInterface and Assigned(_ErrRemoveState) then |
| 1617 |
_ErrRemoveState(pid); |
| 1618 |
end; |
| 1619 |
|
| 1620 |
procedure OPENSSLaddallalgorithms; |
| 1621 |
begin |
| 1622 |
if InitSSLInterface and Assigned(_OPENSSLaddallalgorithms) then |
| 1623 |
_OPENSSLaddallalgorithms; |
| 1624 |
end; |
| 1625 |
|
| 1626 |
procedure EVPcleanup; |
| 1627 |
begin |
| 1628 |
if InitSSLInterface and Assigned(_EVPcleanup) then |
| 1629 |
_EVPcleanup; |
| 1630 |
end; |
| 1631 |
|
| 1632 |
procedure CRYPTOcleanupAllExData; |
| 1633 |
begin |
| 1634 |
if InitSSLInterface and Assigned(_CRYPTOcleanupAllExData) then |
| 1635 |
_CRYPTOcleanupAllExData; |
| 1636 |
end; |
| 1637 |
|
| 1638 |
procedure RandScreen; |
| 1639 |
begin |
| 1640 |
if InitSSLInterface and Assigned(_RandScreen) then |
| 1641 |
_RandScreen; |
| 1642 |
end; |
| 1643 |
|
| 1644 |
function BioNew(b: PBIO_METHOD): PBIO; |
| 1645 |
begin |
| 1646 |
if InitSSLInterface and Assigned(_BioNew) then |
| 1647 |
Result := _BioNew(b) |
| 1648 |
else |
| 1649 |
Result := nil; |
| 1650 |
end; |
| 1651 |
|
| 1652 |
procedure BioFreeAll(b: PBIO); |
| 1653 |
begin |
| 1654 |
if InitSSLInterface and Assigned(_BioFreeAll) then |
| 1655 |
_BioFreeAll(b); |
| 1656 |
end; |
| 1657 |
|
| 1658 |
function BioSMem: PBIO_METHOD; |
| 1659 |
begin |
| 1660 |
if InitSSLInterface and Assigned(_BioSMem) then |
| 1661 |
Result := _BioSMem |
| 1662 |
else |
| 1663 |
Result := nil; |
| 1664 |
end; |
| 1665 |
|
| 1666 |
function BioCtrlPending(b: PBIO): integer; |
| 1667 |
begin |
| 1668 |
if InitSSLInterface and Assigned(_BioCtrlPending) then |
| 1669 |
Result := _BioCtrlPending(b) |
| 1670 |
else |
| 1671 |
Result := 0; |
| 1672 |
end; |
| 1673 |
|
| 1674 |
//function BioRead(b: PBIO; Buf: PChar; Len: integer): integer; |
| 1675 |
function BioRead(b: PBIO; var Buf: AnsiString; Len: integer): integer; |
| 1676 |
begin |
| 1677 |
if InitSSLInterface and Assigned(_BioRead) then |
| 1678 |
Result := _BioRead(b, PAnsiChar(Buf), Len) |
| 1679 |
else |
| 1680 |
Result := -2; |
| 1681 |
end; |
| 1682 |
|
| 1683 |
//function BioWrite(b: PBIO; Buf: PChar; Len: integer): integer; |
| 1684 |
function BioWrite(b: PBIO; Buf: AnsiString; Len: integer): integer; |
| 1685 |
begin |
| 1686 |
if InitSSLInterface and Assigned(_BioWrite) then |
| 1687 |
Result := _BioWrite(b, PAnsiChar(Buf), Len) |
| 1688 |
else |
| 1689 |
Result := -2; |
| 1690 |
end; |
| 1691 |
|
| 1692 |
function X509print(b: PBIO; a: PX509): integer; |
| 1693 |
begin |
| 1694 |
if InitSSLInterface and Assigned(_X509print) then |
| 1695 |
Result := _X509print(b, a) |
| 1696 |
else |
| 1697 |
Result := 0; |
| 1698 |
end; |
| 1699 |
|
| 1700 |
function d2iPKCS12bio(b:PBIO; Pkcs12: SslPtr): SslPtr; |
| 1701 |
begin |
| 1702 |
if InitSSLInterface and Assigned(_d2iPKCS12bio) then |
| 1703 |
Result := _d2iPKCS12bio(b, Pkcs12) |
| 1704 |
else |
| 1705 |
Result := nil; |
| 1706 |
end; |
| 1707 |
|
| 1708 |
function PKCS12parse(p12: SslPtr; pass: Ansistring; var pkey, cert, ca: SslPtr): integer; |
| 1709 |
begin |
| 1710 |
if InitSSLInterface and Assigned(_PKCS12parse) then |
| 1711 |
Result := _PKCS12parse(p12, SslPtr(pass), pkey, cert, ca) |
| 1712 |
else |
| 1713 |
Result := 0; |
| 1714 |
end; |
| 1715 |
|
| 1716 |
procedure PKCS12free(p12: SslPtr); |
| 1717 |
begin |
| 1718 |
if InitSSLInterface and Assigned(_PKCS12free) then |
| 1719 |
_PKCS12free(p12); |
| 1720 |
end; |
| 1721 |
|
| 1722 |
function RsaGenerateKey(bits, e: integer; callback: PFunction; cb_arg: SslPtr): PRSA; |
| 1723 |
begin |
| 1724 |
if InitSSLInterface and Assigned(_RsaGenerateKey) then |
| 1725 |
Result := _RsaGenerateKey(bits, e, callback, cb_arg) |
| 1726 |
else |
| 1727 |
Result := nil; |
| 1728 |
end; |
| 1729 |
|
| 1730 |
function EvpPkeyAssign(pkey: EVP_PKEY; _type: integer; key: Prsa): integer; |
| 1731 |
begin |
| 1732 |
if InitSSLInterface and Assigned(_EvpPkeyAssign) then |
| 1733 |
Result := _EvpPkeyAssign(pkey, _type, key) |
| 1734 |
else |
| 1735 |
Result := 0; |
| 1736 |
end; |
| 1737 |
|
| 1738 |
function X509SetVersion(x: PX509; version: integer): integer; |
| 1739 |
begin |
| 1740 |
if InitSSLInterface and Assigned(_X509SetVersion) then |
| 1741 |
Result := _X509SetVersion(x, version) |
| 1742 |
else |
| 1743 |
Result := 0; |
| 1744 |
end; |
| 1745 |
|
| 1746 |
function X509SetPubkey(x: PX509; pkey: EVP_PKEY): integer; |
| 1747 |
begin |
| 1748 |
if InitSSLInterface and Assigned(_X509SetPubkey) then |
| 1749 |
Result := _X509SetPubkey(x, pkey) |
| 1750 |
else |
| 1751 |
Result := 0; |
| 1752 |
end; |
| 1753 |
|
| 1754 |
function X509SetIssuerName(x: PX509; name: PX509_NAME): integer; |
| 1755 |
begin |
| 1756 |
if InitSSLInterface and Assigned(_X509SetIssuerName) then |
| 1757 |
Result := _X509SetIssuerName(x, name) |
| 1758 |
else |
| 1759 |
Result := 0; |
| 1760 |
end; |
| 1761 |
|
| 1762 |
function X509NameAddEntryByTxt(name: PX509_NAME; field: Ansistring; _type: integer; |
| 1763 |
bytes: Ansistring; len, loc, _set: integer): integer; |
| 1764 |
begin |
| 1765 |
if InitSSLInterface and Assigned(_X509NameAddEntryByTxt) then |
| 1766 |
Result := _X509NameAddEntryByTxt(name, PAnsiChar(field), _type, PAnsiChar(Bytes), len, loc, _set) |
| 1767 |
else |
| 1768 |
Result := 0; |
| 1769 |
end; |
| 1770 |
|
| 1771 |
function X509Sign(x: PX509; pkey: EVP_PKEY; const md: PEVP_MD): integer; |
| 1772 |
begin |
| 1773 |
if InitSSLInterface and Assigned(_X509Sign) then |
| 1774 |
Result := _X509Sign(x, pkey, md) |
| 1775 |
else |
| 1776 |
Result := 0; |
| 1777 |
end; |
| 1778 |
|
| 1779 |
function Asn1UtctimeNew: PASN1_UTCTIME; |
| 1780 |
begin |
| 1781 |
if InitSSLInterface and Assigned(_Asn1UtctimeNew) then |
| 1782 |
Result := _Asn1UtctimeNew |
| 1783 |
else |
| 1784 |
Result := nil; |
| 1785 |
end; |
| 1786 |
|
| 1787 |
procedure Asn1UtctimeFree(a: PASN1_UTCTIME); |
| 1788 |
begin |
| 1789 |
if InitSSLInterface and Assigned(_Asn1UtctimeFree) then |
| 1790 |
_Asn1UtctimeFree(a); |
| 1791 |
end; |
| 1792 |
|
| 1793 |
function X509GmtimeAdj(s: PASN1_UTCTIME; adj: integer): PASN1_UTCTIME; |
| 1794 |
begin |
| 1795 |
if InitSSLInterface and Assigned(_X509GmtimeAdj) then |
| 1796 |
Result := _X509GmtimeAdj(s, adj) |
| 1797 |
else |
| 1798 |
Result := nil; |
| 1799 |
end; |
| 1800 |
|
| 1801 |
function X509SetNotBefore(x: PX509; tm: PASN1_UTCTIME): integer; |
| 1802 |
begin |
| 1803 |
if InitSSLInterface and Assigned(_X509SetNotBefore) then |
| 1804 |
Result := _X509SetNotBefore(x, tm) |
| 1805 |
else |
| 1806 |
Result := 0; |
| 1807 |
end; |
| 1808 |
|
| 1809 |
function X509SetNotAfter(x: PX509; tm: PASN1_UTCTIME): integer; |
| 1810 |
begin |
| 1811 |
if InitSSLInterface and Assigned(_X509SetNotAfter) then |
| 1812 |
Result := _X509SetNotAfter(x, tm) |
| 1813 |
else |
| 1814 |
Result := 0; |
| 1815 |
end; |
| 1816 |
|
| 1817 |
function i2dX509bio(b: PBIO; x: PX509): integer; |
| 1818 |
begin |
| 1819 |
if InitSSLInterface and Assigned(_i2dX509bio) then |
| 1820 |
Result := _i2dX509bio(b, x) |
| 1821 |
else |
| 1822 |
Result := 0; |
| 1823 |
end; |
| 1824 |
|
| 1825 |
function d2iX509bio(b: PBIO; x: PX509): PX509; {pf} |
| 1826 |
begin |
| 1827 |
if InitSSLInterface and Assigned(_d2iX509bio) then |
| 1828 |
Result := _d2iX509bio(b, x) |
| 1829 |
else |
| 1830 |
Result := nil; |
| 1831 |
end; |
| 1832 |
|
| 1833 |
function PEMReadBioX509(b:PBIO; {var x:PX509;}x:PSslPtr; callback:PFunction; cb_arg: SslPtr): PX509; {pf} |
| 1834 |
begin |
| 1835 |
if InitSSLInterface and Assigned(_PEMReadBioX509) then |
| 1836 |
Result := _PEMReadBioX509(b,x,callback,cb_arg) |
| 1837 |
else |
| 1838 |
Result := nil; |
| 1839 |
end; |
| 1840 |
|
| 1841 |
procedure SkX509PopFree(st: PSTACK; func:TSkPopFreeFunc); {pf} |
| 1842 |
begin |
| 1843 |
if InitSSLInterface and Assigned(_SkX509PopFree) then |
| 1844 |
_SkX509PopFree(st,func); |
| 1845 |
end; |
| 1846 |
|
| 1847 |
function i2dPrivateKeyBio(b: PBIO; pkey: EVP_PKEY): integer; |
| 1848 |
begin |
| 1849 |
if InitSSLInterface and Assigned(_i2dPrivateKeyBio) then |
| 1850 |
Result := _i2dPrivateKeyBio(b, pkey) |
| 1851 |
else |
| 1852 |
Result := 0; |
| 1853 |
end; |
| 1854 |
|
| 1855 |
function EvpGetDigestByName(Name: AnsiString): PEVP_MD; |
| 1856 |
begin |
| 1857 |
if InitSSLInterface and Assigned(_EvpGetDigestByName) then |
| 1858 |
Result := _EvpGetDigestByName(PAnsiChar(Name)) |
| 1859 |
else |
| 1860 |
Result := nil; |
| 1861 |
end; |
| 1862 |
|
| 1863 |
function Asn1IntegerSet(a: PASN1_INTEGER; v: integer): integer; |
| 1864 |
begin |
| 1865 |
if InitSSLInterface and Assigned(_Asn1IntegerSet) then |
| 1866 |
Result := _Asn1IntegerSet(a, v) |
| 1867 |
else |
| 1868 |
Result := 0; |
| 1869 |
end; |
| 1870 |
|
| 1871 |
function Asn1IntegerGet(a: PASN1_INTEGER): integer; {pf} |
| 1872 |
begin |
| 1873 |
if InitSSLInterface and Assigned(_Asn1IntegerGet) then |
| 1874 |
Result := _Asn1IntegerGet(a) |
| 1875 |
else |
| 1876 |
Result := 0; |
| 1877 |
end; |
| 1878 |
|
| 1879 |
function X509GetSerialNumber(x: PX509): PASN1_INTEGER; |
| 1880 |
begin |
| 1881 |
if InitSSLInterface and Assigned(_X509GetSerialNumber) then |
| 1882 |
Result := _X509GetSerialNumber(x) |
| 1883 |
else |
| 1884 |
Result := nil; |
| 1885 |
end; |
| 1886 |
|
| 1887 |
// 3DES functions |
| 1888 |
procedure DESsetoddparity(Key: des_cblock); |
| 1889 |
begin |
| 1890 |
if InitSSLInterface and Assigned(_DESsetoddparity) then |
| 1891 |
_DESsetoddparity(Key); |
| 1892 |
end; |
| 1893 |
|
| 1894 |
function DESsetkeychecked(key: des_cblock; schedule: des_key_schedule): Integer; |
| 1895 |
begin |
| 1896 |
if InitSSLInterface and Assigned(_DESsetkeychecked) then |
| 1897 |
Result := _DESsetkeychecked(key, schedule) |
| 1898 |
else |
| 1899 |
Result := -1; |
| 1900 |
end; |
| 1901 |
|
| 1902 |
procedure DESecbencrypt(Input: des_cblock; output: des_cblock; ks: des_key_schedule; enc: Integer); |
| 1903 |
begin |
| 1904 |
if InitSSLInterface and Assigned(_DESecbencrypt) then |
| 1905 |
_DESecbencrypt(Input, output, ks, enc); |
| 1906 |
end; |
| 1907 |
|
| 1908 |
procedure locking_callback(mode, ltype: integer; lfile: PChar; line: integer); cdecl; |
| 1909 |
begin |
| 1910 |
if (mode and 1) > 0 then |
| 1911 |
TCriticalSection(Locks[ltype]).Enter |
| 1912 |
else |
| 1913 |
TCriticalSection(Locks[ltype]).Leave; |
| 1914 |
end; |
| 1915 |
|
| 1916 |
procedure InitLocks; |
| 1917 |
var |
| 1918 |
n: integer; |
| 1919 |
max: integer; |
| 1920 |
begin |
| 1921 |
Locks := TList.Create; |
| 1922 |
max := _CRYPTOnumlocks; |
| 1923 |
for n := 1 to max do |
| 1924 |
Locks.Add(TCriticalSection.Create); |
| 1925 |
_CRYPTOsetlockingcallback(@locking_callback); |
| 1926 |
end; |
| 1927 |
|
| 1928 |
procedure FreeLocks; |
| 1929 |
var |
| 1930 |
n: integer; |
| 1931 |
begin |
| 1932 |
_CRYPTOsetlockingcallback(nil); |
| 1933 |
for n := 0 to Locks.Count - 1 do |
| 1934 |
TCriticalSection(Locks[n]).Free; |
| 1935 |
Locks.Free; |
| 1936 |
end; |
| 1937 |
|
| 1938 |
{$ENDIF} |
| 1939 |
|
| 1940 |
function LoadLib(const Value: String): HModule; |
| 1941 |
begin |
| 1942 |
{$IFDEF CIL} |
| 1943 |
Result := LoadLibrary(Value); |
| 1944 |
{$ELSE} |
| 1945 |
Result := LoadLibrary(PChar(Value)); |
| 1946 |
{$ENDIF} |
| 1947 |
end; |
| 1948 |
|
| 1949 |
function GetProcAddr(module: HModule; const ProcName: string): SslPtr; |
| 1950 |
begin |
| 1951 |
{$IFDEF CIL} |
| 1952 |
Result := GetProcAddress(module, ProcName); |
| 1953 |
{$ELSE} |
| 1954 |
Result := GetProcAddress(module, PChar(ProcName)); |
| 1955 |
{$ENDIF} |
| 1956 |
end; |
| 1957 |
|
| 1958 |
function GetLibFileName(Handle: TLibHandle): string; |
| 1959 |
var |
| 1960 |
n: integer; |
| 1961 |
begin |
| 1962 |
n := MAX_PATH + 1024; |
| 1963 |
SetLength(Result, n); |
| 1964 |
n := GetModuleFilename(Handle, PChar(Result), n); |
| 1965 |
SetLength(Result, n); |
| 1966 |
end; |
| 1967 |
|
| 1968 |
function InitSSLInterface: Boolean; |
| 1969 |
var |
| 1970 |
s: string; |
| 1971 |
i: integer; |
| 1972 |
begin |
| 1973 |
{pf} |
| 1974 |
if SSLLoaded then |
| 1975 |
begin |
| 1976 |
Result := TRUE; |
| 1977 |
exit; |
| 1978 |
end; |
| 1979 |
{/pf} |
| 1980 |
SSLCS.Enter; |
| 1981 |
try |
| 1982 |
if not IsSSLloaded then |
| 1983 |
begin |
| 1984 |
{$IFDEF CIL} |
| 1985 |
SSLLibHandle := 1; |
| 1986 |
SSLUtilHandle := 1; |
| 1987 |
{$ELSE} |
| 1988 |
// Note: It's important to ensure that the libraries both come from the |
| 1989 |
// same directory, preferably the one of the executable. Otherwise a |
| 1990 |
// version mismatch could easily occur. |
| 1991 |
{$IFDEF MSWINDOWS} |
| 1992 |
for i := 0 to Pred(LibCount) do |
| 1993 |
begin |
| 1994 |
SSLUtilHandle := LoadLib(CryptoLibNames[i]); |
| 1995 |
if SSLUtilHandle <> 0 then |
| 1996 |
begin |
| 1997 |
s := ExtractFilePath(GetLibFileName(SSLUtilHandle)); |
| 1998 |
SSLLibHandle := LoadLib(s + SSLLibNames[i]); |
| 1999 |
Break; |
| 2000 |
end; |
| 2001 |
end; |
| 2002 |
{$ELSE} |
| 2003 |
SSLUtilHandle := LoadLib(DLLUtilName); |
| 2004 |
SSLLibHandle := LoadLib(DLLSSLName); |
| 2005 |
{$ENDIF} |
| 2006 |
{$ENDIF} |
| 2007 |
if (SSLLibHandle <> 0) and (SSLUtilHandle <> 0) then |
| 2008 |
begin |
| 2009 |
{$IFNDEF CIL} |
| 2010 |
_SslGetError := GetProcAddr(SSLLibHandle, 'SSL_get_error'); |
| 2011 |
_SslLibraryInit := GetProcAddr(SSLLibHandle, 'SSL_library_init'); |
| 2012 |
_SslLoadErrorStrings := GetProcAddr(SSLLibHandle, 'SSL_load_error_strings'); |
| 2013 |
_SslCtxSetCipherList := GetProcAddr(SSLLibHandle, 'SSL_CTX_set_cipher_list'); |
| 2014 |
_SslCtxNew := GetProcAddr(SSLLibHandle, 'SSL_CTX_new'); |
| 2015 |
_SslCtxFree := GetProcAddr(SSLLibHandle, 'SSL_CTX_free'); |
| 2016 |
_SslSetFd := GetProcAddr(SSLLibHandle, 'SSL_set_fd'); |
| 2017 |
_SslMethodV2 := GetProcAddr(SSLLibHandle, 'SSLv2_method'); |
| 2018 |
_SslMethodV3 := GetProcAddr(SSLLibHandle, 'SSLv3_method'); |
| 2019 |
_SslMethodTLSV1 := GetProcAddr(SSLLibHandle, 'TLSv1_method'); |
| 2020 |
_SslMethodTLSV11 := GetProcAddr(SSLLibHandle, 'TLSv1_1_method'); |
| 2021 |
_SslMethodTLSV12 := GetProcAddr(SSLLibHandle, 'TLSv1_2_method'); |
| 2022 |
_SslMethodV23 := GetProcAddr(SSLLibHandle, 'SSLv23_method'); |
| 2023 |
_SslMethodTLS := GetProcAddr(SSLLibHandle, 'TLS_method'); |
| 2024 |
_SslCtxUsePrivateKey := GetProcAddr(SSLLibHandle, 'SSL_CTX_use_PrivateKey'); |
| 2025 |
_SslCtxUsePrivateKeyASN1 := GetProcAddr(SSLLibHandle, 'SSL_CTX_use_PrivateKey_ASN1'); |
| 2026 |
//use SSL_CTX_use_RSAPrivateKey_file instead SSL_CTX_use_PrivateKey_file, |
| 2027 |
//because SSL_CTX_use_PrivateKey_file not support DER format. :-O |
| 2028 |
_SslCtxUsePrivateKeyFile := GetProcAddr(SSLLibHandle, 'SSL_CTX_use_RSAPrivateKey_file'); |
| 2029 |
_SslCtxUseCertificate := GetProcAddr(SSLLibHandle, 'SSL_CTX_use_certificate'); |
| 2030 |
_SslCtxUseCertificateASN1 := GetProcAddr(SSLLibHandle, 'SSL_CTX_use_certificate_ASN1'); |
| 2031 |
_SslCtxUseCertificateFile := GetProcAddr(SSLLibHandle, 'SSL_CTX_use_certificate_file'); |
| 2032 |
_SslCtxUseCertificateChainFile := GetProcAddr(SSLLibHandle, 'SSL_CTX_use_certificate_chain_file'); |
| 2033 |
_SslCtxCheckPrivateKeyFile := GetProcAddr(SSLLibHandle, 'SSL_CTX_check_private_key'); |
| 2034 |
_SslCtxSetDefaultPasswdCb := GetProcAddr(SSLLibHandle, 'SSL_CTX_set_default_passwd_cb'); |
| 2035 |
_SslCtxSetDefaultPasswdCbUserdata := GetProcAddr(SSLLibHandle, 'SSL_CTX_set_default_passwd_cb_userdata'); |
| 2036 |
_SslCtxLoadVerifyLocations := GetProcAddr(SSLLibHandle, 'SSL_CTX_load_verify_locations'); |
| 2037 |
_SslCtxCtrl := GetProcAddr(SSLLibHandle, 'SSL_CTX_ctrl'); |
| 2038 |
_SslNew := GetProcAddr(SSLLibHandle, 'SSL_new'); |
| 2039 |
_SslFree := GetProcAddr(SSLLibHandle, 'SSL_free'); |
| 2040 |
_SslAccept := GetProcAddr(SSLLibHandle, 'SSL_accept'); |
| 2041 |
_SslConnect := GetProcAddr(SSLLibHandle, 'SSL_connect'); |
| 2042 |
_SslShutdown := GetProcAddr(SSLLibHandle, 'SSL_shutdown'); |
| 2043 |
_SslRead := GetProcAddr(SSLLibHandle, 'SSL_read'); |
| 2044 |
_SslPeek := GetProcAddr(SSLLibHandle, 'SSL_peek'); |
| 2045 |
_SslWrite := GetProcAddr(SSLLibHandle, 'SSL_write'); |
| 2046 |
_SslPending := GetProcAddr(SSLLibHandle, 'SSL_pending'); |
| 2047 |
_SslGetPeerCertificate := GetProcAddr(SSLLibHandle, 'SSL_get_peer_certificate'); |
| 2048 |
_SslGetVersion := GetProcAddr(SSLLibHandle, 'SSL_get_version'); |
| 2049 |
_SslCtxSetVerify := GetProcAddr(SSLLibHandle, 'SSL_CTX_set_verify'); |
| 2050 |
_SslGetCurrentCipher := GetProcAddr(SSLLibHandle, 'SSL_get_current_cipher'); |
| 2051 |
_SslCipherGetName := GetProcAddr(SSLLibHandle, 'SSL_CIPHER_get_name'); |
| 2052 |
_SslCipherGetBits := GetProcAddr(SSLLibHandle, 'SSL_CIPHER_get_bits'); |
| 2053 |
_SslGetVerifyResult := GetProcAddr(SSLLibHandle, 'SSL_get_verify_result'); |
| 2054 |
_SslCtrl := GetProcAddr(SSLLibHandle, 'SSL_ctrl'); |
| 2055 |
_SslSet1Host := GetProcAddr(SSLLibHandle, 'SSL_set1_host'); |
| 2056 |
_SslSessionFree := GetProcAddr(SSLLibHandle, 'SSL_SESSION_free'); |
| 2057 |
_SslGet1Session := GetProcAddr(SSLLibHandle, 'SSL_get1_session'); |
| 2058 |
_SslSetSession := GetProcAddr(SSLLibHandle, 'SSL_set_session'); |
| 2059 |
|
| 2060 |
_X509New := GetProcAddr(SSLUtilHandle, 'X509_new'); |
| 2061 |
_X509Free := GetProcAddr(SSLUtilHandle, 'X509_free'); |
| 2062 |
_X509NameOneline := GetProcAddr(SSLUtilHandle, 'X509_NAME_oneline'); |
| 2063 |
_X509GetSubjectName := GetProcAddr(SSLUtilHandle, 'X509_get_subject_name'); |
| 2064 |
_X509GetIssuerName := GetProcAddr(SSLUtilHandle, 'X509_get_issuer_name'); |
| 2065 |
_X509NameHash := GetProcAddr(SSLUtilHandle, 'X509_NAME_hash'); |
| 2066 |
_X509Digest := GetProcAddr(SSLUtilHandle, 'X509_digest'); |
| 2067 |
_X509print := GetProcAddr(SSLUtilHandle, 'X509_print'); |
| 2068 |
_X509SetVersion := GetProcAddr(SSLUtilHandle, 'X509_set_version'); |
| 2069 |
_X509SetPubkey := GetProcAddr(SSLUtilHandle, 'X509_set_pubkey'); |
| 2070 |
_X509SetIssuerName := GetProcAddr(SSLUtilHandle, 'X509_set_issuer_name'); |
| 2071 |
_X509NameAddEntryByTxt := GetProcAddr(SSLUtilHandle, 'X509_NAME_add_entry_by_txt'); |
| 2072 |
_X509Sign := GetProcAddr(SSLUtilHandle, 'X509_sign'); |
| 2073 |
_X509GmtimeAdj := GetProcAddr(SSLUtilHandle, 'X509_gmtime_adj'); |
| 2074 |
_X509SetNotBefore := GetProcAddr(SSLUtilHandle, 'X509_set_notBefore'); |
| 2075 |
_X509SetNotAfter := GetProcAddr(SSLUtilHandle, 'X509_set_notAfter'); |
| 2076 |
_X509GetSerialNumber := GetProcAddr(SSLUtilHandle, 'X509_get_serialNumber'); |
| 2077 |
_EvpPkeyNew := GetProcAddr(SSLUtilHandle, 'EVP_PKEY_new'); |
| 2078 |
_EvpPkeyFree := GetProcAddr(SSLUtilHandle, 'EVP_PKEY_free'); |
| 2079 |
_EvpPkeyAssign := GetProcAddr(SSLUtilHandle, 'EVP_PKEY_assign'); |
| 2080 |
_EVPCleanup := GetProcAddr(SSLUtilHandle, 'EVP_cleanup'); |
| 2081 |
_EvpGetDigestByName := GetProcAddr(SSLUtilHandle, 'EVP_get_digestbyname'); |
| 2082 |
_SSLeayversion := GetProcAddr(SSLUtilHandle, 'SSLeay_version'); |
| 2083 |
_ErrErrorString := GetProcAddr(SSLUtilHandle, 'ERR_error_string_n'); |
| 2084 |
_ErrGetError := GetProcAddr(SSLUtilHandle, 'ERR_get_error'); |
| 2085 |
_ErrClearError := GetProcAddr(SSLUtilHandle, 'ERR_clear_error'); |
| 2086 |
_ErrFreeStrings := GetProcAddr(SSLUtilHandle, 'ERR_free_strings'); |
| 2087 |
_ErrRemoveState := GetProcAddr(SSLUtilHandle, 'ERR_remove_state'); |
| 2088 |
_OPENSSLaddallalgorithms := GetProcAddr(SSLUtilHandle, 'OPENSSL_add_all_algorithms_noconf'); |
| 2089 |
_CRYPTOcleanupAllExData := GetProcAddr(SSLUtilHandle, 'CRYPTO_cleanup_all_ex_data'); |
| 2090 |
_RandScreen := GetProcAddr(SSLUtilHandle, 'RAND_screen'); |
| 2091 |
_BioNew := GetProcAddr(SSLUtilHandle, 'BIO_new'); |
| 2092 |
_BioFreeAll := GetProcAddr(SSLUtilHandle, 'BIO_free_all'); |
| 2093 |
_BioSMem := GetProcAddr(SSLUtilHandle, 'BIO_s_mem'); |
| 2094 |
_BioCtrlPending := GetProcAddr(SSLUtilHandle, 'BIO_ctrl_pending'); |
| 2095 |
_BioRead := GetProcAddr(SSLUtilHandle, 'BIO_read'); |
| 2096 |
_BioWrite := GetProcAddr(SSLUtilHandle, 'BIO_write'); |
| 2097 |
_d2iPKCS12bio := GetProcAddr(SSLUtilHandle, 'd2i_PKCS12_bio'); |
| 2098 |
_PKCS12parse := GetProcAddr(SSLUtilHandle, 'PKCS12_parse'); |
| 2099 |
_PKCS12free := GetProcAddr(SSLUtilHandle, 'PKCS12_free'); |
| 2100 |
_RsaGenerateKey := GetProcAddr(SSLUtilHandle, 'RSA_generate_key'); |
| 2101 |
_Asn1UtctimeNew := GetProcAddr(SSLUtilHandle, 'ASN1_UTCTIME_new'); |
| 2102 |
_Asn1UtctimeFree := GetProcAddr(SSLUtilHandle, 'ASN1_UTCTIME_free'); |
| 2103 |
_Asn1IntegerSet := GetProcAddr(SSLUtilHandle, 'ASN1_INTEGER_set'); |
| 2104 |
_Asn1IntegerGet := GetProcAddr(SSLUtilHandle, 'ASN1_INTEGER_get'); {pf} |
| 2105 |
_i2dX509bio := GetProcAddr(SSLUtilHandle, 'i2d_X509_bio'); |
| 2106 |
_d2iX509bio := GetProcAddr(SSLUtilHandle, 'd2i_X509_bio'); {pf} |
| 2107 |
_PEMReadBioX509 := GetProcAddr(SSLUtilHandle, 'PEM_read_bio_X509'); {pf} |
| 2108 |
_SkX509PopFree := GetProcAddr(SSLUtilHandle, 'SK_X509_POP_FREE'); {pf} |
| 2109 |
_i2dPrivateKeyBio := GetProcAddr(SSLUtilHandle, 'i2d_PrivateKey_bio'); |
| 2110 |
|
| 2111 |
// 3DES functions |
| 2112 |
_DESsetoddparity := GetProcAddr(SSLUtilHandle, 'DES_set_odd_parity'); |
| 2113 |
_DESsetkeychecked := GetProcAddr(SSLUtilHandle, 'DES_set_key_checked'); |
| 2114 |
_DESecbencrypt := GetProcAddr(SSLUtilHandle, 'DES_ecb_encrypt'); |
| 2115 |
// |
| 2116 |
_CRYPTOnumlocks := GetProcAddr(SSLUtilHandle, 'CRYPTO_num_locks'); |
| 2117 |
_CRYPTOsetlockingcallback := GetProcAddr(SSLUtilHandle, 'CRYPTO_set_locking_callback'); |
| 2118 |
{$ENDIF} |
| 2119 |
{$IFDEF CIL} |
| 2120 |
SslLibraryInit; |
| 2121 |
SslLoadErrorStrings; |
| 2122 |
OPENSSLaddallalgorithms; |
| 2123 |
RandScreen; |
| 2124 |
{$ELSE} |
| 2125 |
SSLLibFile := GetLibFileName(SSLLibHandle); |
| 2126 |
SSLUtilFile := GetLibFileName(SSLUtilHandle); |
| 2127 |
//init library |
| 2128 |
if assigned(_SslLibraryInit) then |
| 2129 |
_SslLibraryInit; |
| 2130 |
if assigned(_SslLoadErrorStrings) then |
| 2131 |
_SslLoadErrorStrings; |
| 2132 |
if assigned(_OPENSSLaddallalgorithms) then |
| 2133 |
_OPENSSLaddallalgorithms; |
| 2134 |
if assigned(_RandScreen) then |
| 2135 |
_RandScreen; |
| 2136 |
if assigned(_CRYPTOnumlocks) and assigned(_CRYPTOsetlockingcallback) then |
| 2137 |
InitLocks; |
| 2138 |
{$ENDIF} |
| 2139 |
SSLloaded := True; |
| 2140 |
{$IFDEF OS2} |
| 2141 |
Result := InitEMXHandles; |
| 2142 |
{$ELSE OS2} |
| 2143 |
Result := True; |
| 2144 |
{$ENDIF OS2} |
| 2145 |
end |
| 2146 |
else |
| 2147 |
begin |
| 2148 |
//load failed! |
| 2149 |
if SSLLibHandle <> 0 then |
| 2150 |
begin |
| 2151 |
{$IFNDEF CIL} |
| 2152 |
FreeLibrary(SSLLibHandle); |
| 2153 |
{$ENDIF} |
| 2154 |
SSLLibHandle := 0; |
| 2155 |
end; |
| 2156 |
if SSLUtilHandle <> 0 then |
| 2157 |
begin |
| 2158 |
{$IFNDEF CIL} |
| 2159 |
FreeLibrary(SSLUtilHandle); |
| 2160 |
{$ENDIF} |
| 2161 |
SSLLibHandle := 0; |
| 2162 |
end; |
| 2163 |
Result := False; |
| 2164 |
end; |
| 2165 |
end |
| 2166 |
else |
| 2167 |
//loaded before... |
| 2168 |
Result := true; |
| 2169 |
finally |
| 2170 |
SSLCS.Leave; |
| 2171 |
end; |
| 2172 |
end; |
| 2173 |
|
| 2174 |
function DestroySSLInterface: Boolean; |
| 2175 |
begin |
| 2176 |
SSLCS.Enter; |
| 2177 |
try |
| 2178 |
if IsSSLLoaded then |
| 2179 |
begin |
| 2180 |
//deinit library |
| 2181 |
{$IFNDEF CIL} |
| 2182 |
if assigned(_CRYPTOnumlocks) and assigned(_CRYPTOsetlockingcallback) then |
| 2183 |
FreeLocks; |
| 2184 |
{$ENDIF} |
| 2185 |
EVPCleanup; |
| 2186 |
CRYPTOcleanupAllExData; |
| 2187 |
ErrRemoveState(0); |
| 2188 |
end; |
| 2189 |
SSLloaded := false; |
| 2190 |
if SSLLibHandle <> 0 then |
| 2191 |
begin |
| 2192 |
{$IFNDEF CIL} |
| 2193 |
FreeLibrary(SSLLibHandle); |
| 2194 |
{$ENDIF} |
| 2195 |
SSLLibHandle := 0; |
| 2196 |
end; |
| 2197 |
if SSLUtilHandle <> 0 then |
| 2198 |
begin |
| 2199 |
{$IFNDEF CIL} |
| 2200 |
FreeLibrary(SSLUtilHandle); |
| 2201 |
{$ENDIF} |
| 2202 |
SSLLibHandle := 0; |
| 2203 |
end; |
| 2204 |
|
| 2205 |
{$IFNDEF CIL} |
| 2206 |
_SslGetError := nil; |
| 2207 |
_SslLibraryInit := nil; |
| 2208 |
_SslLoadErrorStrings := nil; |
| 2209 |
_SslCtxSetCipherList := nil; |
| 2210 |
_SslCtxNew := nil; |
| 2211 |
_SslCtxFree := nil; |
| 2212 |
_SslSetFd := nil; |
| 2213 |
_SslMethodV2 := nil; |
| 2214 |
_SslMethodV3 := nil; |
| 2215 |
_SslMethodTLSV1 := nil; |
| 2216 |
_SslMethodTLSV11 := nil; |
| 2217 |
_SslMethodTLSV12 := nil; |
| 2218 |
_SslMethodV23 := nil; |
| 2219 |
_SslMethodTLS := nil; |
| 2220 |
_SslCtxUsePrivateKey := nil; |
| 2221 |
_SslCtxUsePrivateKeyASN1 := nil; |
| 2222 |
_SslCtxUsePrivateKeyFile := nil; |
| 2223 |
_SslCtxUseCertificate := nil; |
| 2224 |
_SslCtxUseCertificateASN1 := nil; |
| 2225 |
_SslCtxUseCertificateFile := nil; |
| 2226 |
_SslCtxUseCertificateChainFile := nil; |
| 2227 |
_SslCtxCheckPrivateKeyFile := nil; |
| 2228 |
_SslCtxSetDefaultPasswdCb := nil; |
| 2229 |
_SslCtxSetDefaultPasswdCbUserdata := nil; |
| 2230 |
_SslCtxLoadVerifyLocations := nil; |
| 2231 |
_SslCtxCtrl := nil; |
| 2232 |
_SslNew := nil; |
| 2233 |
_SslFree := nil; |
| 2234 |
_SslAccept := nil; |
| 2235 |
_SslConnect := nil; |
| 2236 |
_SslShutdown := nil; |
| 2237 |
_SslRead := nil; |
| 2238 |
_SslPeek := nil; |
| 2239 |
_SslWrite := nil; |
| 2240 |
_SslPending := nil; |
| 2241 |
_SslGetPeerCertificate := nil; |
| 2242 |
_SslGetVersion := nil; |
| 2243 |
_SslCtxSetVerify := nil; |
| 2244 |
_SslGetCurrentCipher := nil; |
| 2245 |
_SslCipherGetName := nil; |
| 2246 |
_SslCipherGetBits := nil; |
| 2247 |
_SslGetVerifyResult := nil; |
| 2248 |
_SslCtrl := nil; |
| 2249 |
_SslSet1Host := nil; |
| 2250 |
_SslSessionFree := nil; |
| 2251 |
_SslGet1Session := nil; |
| 2252 |
_SslSetSession := nil; |
| 2253 |
|
| 2254 |
_X509New := nil; |
| 2255 |
_X509Free := nil; |
| 2256 |
_X509NameOneline := nil; |
| 2257 |
_X509GetSubjectName := nil; |
| 2258 |
_X509GetIssuerName := nil; |
| 2259 |
_X509NameHash := nil; |
| 2260 |
_X509Digest := nil; |
| 2261 |
_X509print := nil; |
| 2262 |
_X509SetVersion := nil; |
| 2263 |
_X509SetPubkey := nil; |
| 2264 |
_X509SetIssuerName := nil; |
| 2265 |
_X509NameAddEntryByTxt := nil; |
| 2266 |
_X509Sign := nil; |
| 2267 |
_X509GmtimeAdj := nil; |
| 2268 |
_X509SetNotBefore := nil; |
| 2269 |
_X509SetNotAfter := nil; |
| 2270 |
_X509GetSerialNumber := nil; |
| 2271 |
_EvpPkeyNew := nil; |
| 2272 |
_EvpPkeyFree := nil; |
| 2273 |
_EvpPkeyAssign := nil; |
| 2274 |
_EVPCleanup := nil; |
| 2275 |
_EvpGetDigestByName := nil; |
| 2276 |
_SSLeayversion := nil; |
| 2277 |
_ErrErrorString := nil; |
| 2278 |
_ErrGetError := nil; |
| 2279 |
_ErrClearError := nil; |
| 2280 |
_ErrFreeStrings := nil; |
| 2281 |
_ErrRemoveState := nil; |
| 2282 |
_OPENSSLaddallalgorithms := nil; |
| 2283 |
_CRYPTOcleanupAllExData := nil; |
| 2284 |
_RandScreen := nil; |
| 2285 |
_BioNew := nil; |
| 2286 |
_BioFreeAll := nil; |
| 2287 |
_BioSMem := nil; |
| 2288 |
_BioCtrlPending := nil; |
| 2289 |
_BioRead := nil; |
| 2290 |
_BioWrite := nil; |
| 2291 |
_d2iPKCS12bio := nil; |
| 2292 |
_PKCS12parse := nil; |
| 2293 |
_PKCS12free := nil; |
| 2294 |
_RsaGenerateKey := nil; |
| 2295 |
_Asn1UtctimeNew := nil; |
| 2296 |
_Asn1UtctimeFree := nil; |
| 2297 |
_Asn1IntegerSet := nil; |
| 2298 |
_Asn1IntegerGet := nil; {pf} |
| 2299 |
_SkX509PopFree := nil; {pf} |
| 2300 |
_i2dX509bio := nil; |
| 2301 |
_i2dPrivateKeyBio := nil; |
| 2302 |
|
| 2303 |
// 3DES functions |
| 2304 |
_DESsetoddparity := nil; |
| 2305 |
_DESsetkeychecked := nil; |
| 2306 |
_DESecbencrypt := nil; |
| 2307 |
// |
| 2308 |
_CRYPTOnumlocks := nil; |
| 2309 |
_CRYPTOsetlockingcallback := nil; |
| 2310 |
{$ENDIF} |
| 2311 |
finally |
| 2312 |
SSLCS.Leave; |
| 2313 |
end; |
| 2314 |
Result := True; |
| 2315 |
end; |
| 2316 |
|
| 2317 |
function IsSSLloaded: Boolean; |
| 2318 |
begin |
| 2319 |
Result := SSLLoaded; |
| 2320 |
end; |
| 2321 |
|
| 2322 |
initialization |
| 2323 |
begin |
| 2324 |
SSLCS:= TCriticalSection.Create; |
| 2325 |
end; |
| 2326 |
|
| 2327 |
finalization |
| 2328 |
begin |
| 2329 |
{$IFNDEF CIL} |
| 2330 |
DestroySSLInterface; |
| 2331 |
{$ENDIF} |
| 2332 |
SSLCS.Free; |
| 2333 |
end; |
| 2334 |
|
| 2335 |
end. |