Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   OpenSSL und d2i_OCSP_RESPONSE_bio (https://www.delphipraxis.net/210828-openssl-und-d2i_ocsp_response_bio.html)

Peter666 17. Jun 2022 11:09

OpenSSL und d2i_OCSP_RESPONSE_bio
 
Hi,

hat jemand zufällig schon mit OCSP gearbeitet?

Ich habe hier folgenden C Code
Code:
derbio = bio_open_default(respin, 'r', FORMAT_ASN1);
        if (derbio == NULL)
            goto end;
        resp = d2i_OCSP_RESPONSE_bio(derbio, NULL);
        BIO_free(derbio);
        if (resp == NULL) {
            BIO_printf(bio_err, "Error reading OCSP response\n");
            goto end;
        }
OCSP_RESPONSE_print(out, resp, 0);
scheitere aber dabei, dass d2i_OCSP_RESPONSE_bio ein Makro ist und keine Funktion.

Hat jemand dazu eine Idee?

Peter

shebang 17. Jun 2022 14:51

AW: OpenSSL und d2i_OCSP_RESPONSE_bio
 
Eine kurze Suche hat das hier aus https://git.openssl.org ergeben:
Code:
# define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p)
Hilft dir das weiter?

Peter666 17. Jun 2022 15:31

AW: OpenSSL und d2i_OCSP_RESPONSE_bio
 
Nicht wirklich,

mein Code schaut derzeit wie folgt aus:

Delphi-Quellcode:
type
  ASN1_d2i_bio_xnew = function(): Pointer; cdecl;
  Pd2i_of_void = function(p1: PPointer; p2: PPByte; p3: Integer): Pointer; cdecl;
    TASN1_d2i_bio = function(xnew: ASN1_d2i_bio_xnew; d2i: Pd2i_of_void; _in: PBIO; var x: Pointer): pointer; cdecl;

var _ASN1_d2i_bio: TASN1_d2i_bio = nil;

...
 _ASN1_d2i_bio:= GetProcAddr(SSLUtilHandle, 'ASN1_d2i_bio');
   _i2d_OCSP_RESPONSE := GetProcAddr(SSLUtilHandle, 'i2d_OCSP_RESPONSE');    
...

function ASN1_d2i_bio(xnew: ASN1_d2i_bio_xnew; d2i: Pd2i_of_void; _in: PBIO; x: Pointer): pointer;
begin
  if InitSSLInterface and Assigned(_ASN1_d2i_bio) then
    Result := _ASN1_d2i_bio(xnew, d2i, _in, x)
  else
    Result := nil;
end;      

function i2d_OCSP_RESPONSE_bio(b: PBIO; x: Pointer): Pointer;
begin
 result := ASN1_d2i_bio(OCSP_RESPONSE, _i2d_OCSP_RESPONSE, b, x);
end;
Wobei ich nicht verstehe wo das OCSP_RESPONSE deklariert ist.


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:25 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz