Skip to content

Commit f4d1675

Browse files
committed
Further Updates for Delphi on Linux compatibility
1 parent 93c756b commit f4d1675

File tree

81 files changed

+29766
-41924
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+29766
-41924
lines changed

src/opensslHdrs/IdOpenSSLHeaders_aes.pas

Lines changed: 124 additions & 173 deletions
Large diffs are not rendered by default.

src/opensslHdrs/IdOpenSSLHeaders_asn1.pas

Lines changed: 1444 additions & 1988 deletions
Large diffs are not rendered by default.

src/opensslHdrs/IdOpenSSLHeaders_asn1_mac.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ interface
4444
{$IFDEF OPENSSL_STATIC_LINK_MODEL}
4545

4646
{$ELSE}
47+
4748
{$ENDIF}
4849

4950
implementation

src/opensslHdrs/IdOpenSSLHeaders_asn1err.pas

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,13 @@ interface
277277
function ERR_load_ASN1_strings: TOpenSSL_C_INT; cdecl; external CLibCrypto;
278278

279279
{$ELSE}
280+
281+
{Declare external function initialisers - should not be called directly}
282+
283+
function Load_ERR_load_ASN1_strings: TOpenSSL_C_INT; cdecl;
284+
280285
var
281-
ERR_load_ASN1_strings: function : TOpenSSL_C_INT; cdecl = nil;
286+
ERR_load_ASN1_strings: function : TOpenSSL_C_INT; cdecl = Load_ERR_load_ASN1_strings;
282287
{$ENDIF}
283288

284289
implementation
@@ -296,36 +301,24 @@ implementation
296301
{$IFNDEF OPENSSL_STATIC_LINK_MODEL}
297302
{$IFNDEF OPENSSL_NO_LEGACY_SUPPORT}
298303
{$ENDIF} { End of OPENSSL_NO_LEGACY_SUPPORT}
299-
300-
{$WARN NO_RETVAL OFF}
301-
function ERROR_ERR_load_ASN1_strings: TOpenSSL_C_INT; cdecl;
302-
begin
303-
EOpenSSLAPIFunctionNotPresent.RaiseException('ERR_load_ASN1_strings');
304-
end;
305-
306-
{$WARN NO_RETVAL ON}
307-
procedure Load(LibVersion: TOpenSSL_C_UINT; const AFailed: TStringList);
308-
var FuncLoadError: boolean;
304+
function Load_ERR_load_ASN1_strings: TOpenSSL_C_INT; cdecl;
309305
begin
310306
ERR_load_ASN1_strings := LoadLibCryptoFunction('ERR_load_ASN1_strings');
311-
FuncLoadError := not assigned(ERR_load_ASN1_strings);
312-
if FuncLoadError then
313-
begin
314-
ERR_load_ASN1_strings := @ERROR_ERR_load_ASN1_strings;
315-
end;
316-
307+
if not assigned(ERR_load_ASN1_strings) then
308+
EOpenSSLAPIFunctionNotPresent.RaiseException('ERR_load_ASN1_strings');
309+
Result := ERR_load_ASN1_strings();
317310
end;
318311

312+
319313
procedure UnLoad;
320314
begin
321-
ERR_load_ASN1_strings := nil;
315+
ERR_load_ASN1_strings := Load_ERR_load_ASN1_strings;
322316
end;
323317
{$ENDIF}
324318

325319
initialization
326320

327321
{$IFNDEF OPENSSL_STATIC_LINK_MODEL}
328-
Register_SSLLoader(@Load);
329322
Register_SSLUnloader(@Unload);
330323
{$ENDIF}
331324
finalization

src/opensslHdrs/IdOpenSSLHeaders_asn1t.pas

Lines changed: 36 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -993,11 +993,19 @@ function ASN1_item_ex_d2i(pval: PPASN1_VALUE; const AIn: PPByte; len: TOpenSSL_C
993993
function ASN1_item_ex_i2d(pval: PPASN1_VALUE; AOut: PPByte; const it: PASN1_ITEM; tag: TOpenSSL_C_INT; aclass: TOpenSSL_C_INT): TOpenSSL_C_INT; cdecl; external CLibCrypto;
994994

995995
{$ELSE}
996+
997+
{Declare external function initialisers - should not be called directly}
998+
999+
function Load_ASN1_item_ex_new(pval: PPASN1_VALUE; const it: PASN1_ITEM): TOpenSSL_C_INT; cdecl;
1000+
procedure Load_ASN1_item_ex_free(pval: PPASN1_VALUE; const it: PASN1_ITEM); cdecl;
1001+
function Load_ASN1_item_ex_d2i(pval: PPASN1_VALUE; const AIn: PPByte; len: TOpenSSL_C_LONG; const it: PASN1_ITEM; tag: TOpenSSL_C_INT; aclass: TOpenSSL_C_INT; opt: AnsiChar; ctx: PASN1_TLC): TOpenSSL_C_INT; cdecl;
1002+
function Load_ASN1_item_ex_i2d(pval: PPASN1_VALUE; AOut: PPByte; const it: PASN1_ITEM; tag: TOpenSSL_C_INT; aclass: TOpenSSL_C_INT): TOpenSSL_C_INT; cdecl;
1003+
9961004
var
997-
ASN1_item_ex_new: function (pval: PPASN1_VALUE; const it: PASN1_ITEM): TOpenSSL_C_INT; cdecl = nil;
998-
ASN1_item_ex_free: procedure (pval: PPASN1_VALUE; const it: PASN1_ITEM); cdecl = nil;
999-
ASN1_item_ex_d2i: function (pval: PPASN1_VALUE; const AIn: PPByte; len: TOpenSSL_C_LONG; const it: PASN1_ITEM; tag: TOpenSSL_C_INT; aclass: TOpenSSL_C_INT; opt: AnsiChar; ctx: PASN1_TLC): TOpenSSL_C_INT; cdecl = nil;
1000-
ASN1_item_ex_i2d: function (pval: PPASN1_VALUE; AOut: PPByte; const it: PASN1_ITEM; tag: TOpenSSL_C_INT; aclass: TOpenSSL_C_INT): TOpenSSL_C_INT; cdecl = nil;
1005+
ASN1_item_ex_new: function (pval: PPASN1_VALUE; const it: PASN1_ITEM): TOpenSSL_C_INT; cdecl = Load_ASN1_item_ex_new;
1006+
ASN1_item_ex_free: procedure (pval: PPASN1_VALUE; const it: PASN1_ITEM); cdecl = Load_ASN1_item_ex_free;
1007+
ASN1_item_ex_d2i: function (pval: PPASN1_VALUE; const AIn: PPByte; len: TOpenSSL_C_LONG; const it: PASN1_ITEM; tag: TOpenSSL_C_INT; aclass: TOpenSSL_C_INT; opt: AnsiChar; ctx: PASN1_TLC): TOpenSSL_C_INT; cdecl = Load_ASN1_item_ex_d2i;
1008+
ASN1_item_ex_i2d: function (pval: PPASN1_VALUE; AOut: PPByte; const it: PASN1_ITEM; tag: TOpenSSL_C_INT; aclass: TOpenSSL_C_INT): TOpenSSL_C_INT; cdecl = Load_ASN1_item_ex_i2d;
10011009
{$ENDIF}
10021010

10031011
implementation
@@ -1015,75 +1023,51 @@ implementation
10151023
{$IFNDEF OPENSSL_STATIC_LINK_MODEL}
10161024
{$IFNDEF OPENSSL_NO_LEGACY_SUPPORT}
10171025
{$ENDIF} { End of OPENSSL_NO_LEGACY_SUPPORT}
1018-
1019-
{$WARN NO_RETVAL OFF}
1020-
function ERROR_ASN1_item_ex_new(pval: PPASN1_VALUE; const it: PASN1_ITEM): TOpenSSL_C_INT; cdecl;
1026+
function Load_ASN1_item_ex_new(pval: PPASN1_VALUE; const it: PASN1_ITEM): TOpenSSL_C_INT; cdecl;
10211027
begin
1022-
EOpenSSLAPIFunctionNotPresent.RaiseException('ASN1_item_ex_new');
1023-
end;
1024-
1025-
procedure ERROR_ASN1_item_ex_free(pval: PPASN1_VALUE; const it: PASN1_ITEM); cdecl;
1026-
begin
1027-
EOpenSSLAPIFunctionNotPresent.RaiseException('ASN1_item_ex_free');
1028+
ASN1_item_ex_new := LoadLibCryptoFunction('ASN1_item_ex_new');
1029+
if not assigned(ASN1_item_ex_new) then
1030+
EOpenSSLAPIFunctionNotPresent.RaiseException('ASN1_item_ex_new');
1031+
Result := ASN1_item_ex_new(pval,it);
10281032
end;
10291033

1030-
function ERROR_ASN1_item_ex_d2i(pval: PPASN1_VALUE; const AIn: PPByte; len: TOpenSSL_C_LONG; const it: PASN1_ITEM; tag: TOpenSSL_C_INT; aclass: TOpenSSL_C_INT; opt: AnsiChar; ctx: PASN1_TLC): TOpenSSL_C_INT; cdecl;
1034+
procedure Load_ASN1_item_ex_free(pval: PPASN1_VALUE; const it: PASN1_ITEM); cdecl;
10311035
begin
1032-
EOpenSSLAPIFunctionNotPresent.RaiseException('ASN1_item_ex_d2i');
1036+
ASN1_item_ex_free := LoadLibCryptoFunction('ASN1_item_ex_free');
1037+
if not assigned(ASN1_item_ex_free) then
1038+
EOpenSSLAPIFunctionNotPresent.RaiseException('ASN1_item_ex_free');
1039+
ASN1_item_ex_free(pval,it);
10331040
end;
10341041

1035-
function ERROR_ASN1_item_ex_i2d(pval: PPASN1_VALUE; AOut: PPByte; const it: PASN1_ITEM; tag: TOpenSSL_C_INT; aclass: TOpenSSL_C_INT): TOpenSSL_C_INT; cdecl;
1042+
function Load_ASN1_item_ex_d2i(pval: PPASN1_VALUE; const AIn: PPByte; len: TOpenSSL_C_LONG; const it: PASN1_ITEM; tag: TOpenSSL_C_INT; aclass: TOpenSSL_C_INT; opt: AnsiChar; ctx: PASN1_TLC): TOpenSSL_C_INT; cdecl;
10361043
begin
1037-
EOpenSSLAPIFunctionNotPresent.RaiseException('ASN1_item_ex_i2d');
1044+
ASN1_item_ex_d2i := LoadLibCryptoFunction('ASN1_item_ex_d2i');
1045+
if not assigned(ASN1_item_ex_d2i) then
1046+
EOpenSSLAPIFunctionNotPresent.RaiseException('ASN1_item_ex_d2i');
1047+
Result := ASN1_item_ex_d2i(pval,AIn,len,it,tag,aclass,opt,ctx);
10381048
end;
10391049

1040-
{$WARN NO_RETVAL ON}
1041-
procedure Load(LibVersion: TOpenSSL_C_UINT; const AFailed: TStringList);
1042-
var FuncLoadError: boolean;
1050+
function Load_ASN1_item_ex_i2d(pval: PPASN1_VALUE; AOut: PPByte; const it: PASN1_ITEM; tag: TOpenSSL_C_INT; aclass: TOpenSSL_C_INT): TOpenSSL_C_INT; cdecl;
10431051
begin
1044-
ASN1_item_ex_new := LoadLibCryptoFunction('ASN1_item_ex_new');
1045-
FuncLoadError := not assigned(ASN1_item_ex_new);
1046-
if FuncLoadError then
1047-
begin
1048-
ASN1_item_ex_new := @ERROR_ASN1_item_ex_new;
1049-
end;
1050-
1051-
ASN1_item_ex_free := LoadLibCryptoFunction('ASN1_item_ex_free');
1052-
FuncLoadError := not assigned(ASN1_item_ex_free);
1053-
if FuncLoadError then
1054-
begin
1055-
ASN1_item_ex_free := @ERROR_ASN1_item_ex_free;
1056-
end;
1057-
1058-
ASN1_item_ex_d2i := LoadLibCryptoFunction('ASN1_item_ex_d2i');
1059-
FuncLoadError := not assigned(ASN1_item_ex_d2i);
1060-
if FuncLoadError then
1061-
begin
1062-
ASN1_item_ex_d2i := @ERROR_ASN1_item_ex_d2i;
1063-
end;
1064-
10651052
ASN1_item_ex_i2d := LoadLibCryptoFunction('ASN1_item_ex_i2d');
1066-
FuncLoadError := not assigned(ASN1_item_ex_i2d);
1067-
if FuncLoadError then
1068-
begin
1069-
ASN1_item_ex_i2d := @ERROR_ASN1_item_ex_i2d;
1070-
end;
1071-
1053+
if not assigned(ASN1_item_ex_i2d) then
1054+
EOpenSSLAPIFunctionNotPresent.RaiseException('ASN1_item_ex_i2d');
1055+
Result := ASN1_item_ex_i2d(pval,AOut,it,tag,aclass);
10721056
end;
10731057

1058+
10741059
procedure UnLoad;
10751060
begin
1076-
ASN1_item_ex_new := nil;
1077-
ASN1_item_ex_free := nil;
1078-
ASN1_item_ex_d2i := nil;
1079-
ASN1_item_ex_i2d := nil;
1061+
ASN1_item_ex_new := Load_ASN1_item_ex_new;
1062+
ASN1_item_ex_free := Load_ASN1_item_ex_free;
1063+
ASN1_item_ex_d2i := Load_ASN1_item_ex_d2i;
1064+
ASN1_item_ex_i2d := Load_ASN1_item_ex_i2d;
10801065
end;
10811066
{$ENDIF}
10821067

10831068
initialization
10841069

10851070
{$IFNDEF OPENSSL_STATIC_LINK_MODEL}
1086-
Register_SSLLoader(@Load);
10871071
Register_SSLUnloader(@Unload);
10881072
{$ENDIF}
10891073
finalization

0 commit comments

Comments
 (0)