@@ -993,11 +993,19 @@ function ASN1_item_ex_d2i(pval: PPASN1_VALUE; const AIn: PPByte; len: TOpenSSL_C
993993function 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+
9961004var
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
10031011implementation
@@ -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;
10211027begin
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);
10281032end ;
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;
10311035begin
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);
10331040end ;
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;
10361043begin
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);
10381048end ;
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;
10431051begin
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);
10721056end ;
10731057
1058+
10741059procedure UnLoad ;
10751060begin
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 ;
10801065end ;
10811066{ $ENDIF}
10821067
10831068initialization
10841069
10851070{ $IFNDEF OPENSSL_STATIC_LINK_MODEL}
1086- Register_SSLLoader(@Load);
10871071Register_SSLUnloader(@Unload);
10881072{ $ENDIF}
10891073finalization
0 commit comments