@@ -993,19 +993,11 @@ 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-
1004996var
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 ;
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 ;
10091001{ $ENDIF}
10101002
10111003implementation
@@ -1023,51 +1015,75 @@ implementation
10231015{ $IFNDEF OPENSSL_STATIC_LINK_MODEL}
10241016{ $IFNDEF OPENSSL_NO_LEGACY_SUPPORT}
10251017{ $ENDIF} { End of OPENSSL_NO_LEGACY_SUPPORT}
1026- function Load_ASN1_item_ex_new (pval: PPASN1_VALUE; const it: PASN1_ITEM): TOpenSSL_C_INT; cdecl;
1018+
1019+ { $WARN NO_RETVAL OFF}
1020+ function ERROR_ASN1_item_ex_new (pval: PPASN1_VALUE; const it: PASN1_ITEM): TOpenSSL_C_INT; cdecl;
10271021begin
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);
1022+ EOpenSSLAPIFunctionNotPresent.RaiseException(' ASN1_item_ex_new' );
10321023end ;
10331024
1034- procedure Load_ASN1_item_ex_free (pval: PPASN1_VALUE; const it: PASN1_ITEM); cdecl;
1025+ procedure ERROR_ASN1_item_ex_free (pval: PPASN1_VALUE; const it: PASN1_ITEM); cdecl;
10351026begin
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);
1027+ EOpenSSLAPIFunctionNotPresent.RaiseException(' ASN1_item_ex_free' );
10401028end ;
10411029
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;
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;
10431031begin
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);
1032+ EOpenSSLAPIFunctionNotPresent.RaiseException(' ASN1_item_ex_d2i' );
10481033end ;
10491034
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;
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;
10511036begin
1052- ASN1_item_ex_i2d := LoadLibCryptoFunction(' ASN1_item_ex_i2d' );
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);
1037+ EOpenSSLAPIFunctionNotPresent.RaiseException(' ASN1_item_ex_i2d' );
10561038end ;
10571039
1040+ { $WARN NO_RETVAL ON}
1041+ procedure Load (LibVersion: TOpenSSL_C_UINT; const AFailed: TStringList);
1042+ var FuncLoadError: boolean;
1043+ 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+
1065+ 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+
1072+ end ;
10581073
10591074procedure UnLoad ;
10601075begin
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 ;
1076+ ASN1_item_ex_new := nil ;
1077+ ASN1_item_ex_free := nil ;
1078+ ASN1_item_ex_d2i := nil ;
1079+ ASN1_item_ex_i2d := nil ;
10651080end ;
10661081{ $ENDIF}
10671082
10681083initialization
10691084
10701085{ $IFNDEF OPENSSL_STATIC_LINK_MODEL}
1086+ Register_SSLLoader(@Load);
10711087Register_SSLUnloader(@Unload);
10721088{ $ENDIF}
10731089finalization
0 commit comments