From 2bfa18a02223155271976afbfbd018a64bd30670 Mon Sep 17 00:00:00 2001 From: Marcel Poul Date: Tue, 7 Aug 2012 17:21:21 +0000 Subject: [PATCH] Split query_responder(), depends on SSLEAY_VERSION and support of ocsp nonblocking queries. --- emi.canl.canl-c/src/canl_ocsp.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/emi.canl.canl-c/src/canl_ocsp.c b/emi.canl.canl-c/src/canl_ocsp.c index 690103d..733501d 100644 --- a/emi.canl.canl-c/src/canl_ocsp.c +++ b/emi.canl.canl-c/src/canl_ocsp.c @@ -513,15 +513,13 @@ end: return resp; } +#if SSLEAY_VERSION_NUMBER >= 0x0090808fL /*TODO the timeout variable should be modified if TO is reached. Somehow retur error codes! */ static OCSP_RESPONSE * query_responder(BIO *conn, char *path, OCSP_REQUEST *req, int req_timeout) { OCSP_RESPONSE *rsp = NULL; - -/*openssl does support non blocking BIO for OCSP_send_request*/ -#if SSLEAY_VERSION_NUMBER >= 0x0090808fL int fd; int rv; OCSP_REQ_CTX *ctx = NULL; @@ -605,8 +603,23 @@ query_responder(BIO *conn, char *path, OCSP_REQUEST *req, int req_timeout) } } +err: + if (ctx) + OCSP_REQ_CTX_free(ctx); + return rsp; +} +#endif + +#if SSLEAY_VERSION_NUMBER < 0x0090808fL +/*TODO the timeout variable should be modified if TO is reached. + Somehow retur error codes! */ + static OCSP_RESPONSE * +query_responder(BIO *conn, char *path, OCSP_REQUEST *req, int req_timeout) +{ + OCSP_RESPONSE *rsp = NULL; + +/*openssl does support non blocking BIO for OCSP_send_request*/ -#else /*openssl does not support non blocking BIO for OCSP_send_request*/ if (BIO_do_connect(conn) <= 0) @@ -621,13 +634,7 @@ query_responder(BIO *conn, char *path, OCSP_REQUEST *req, int req_timeout) goto err; } -#endif - err: -#if SSLEAY_VERSION_NUMBER >= 0x0090808fL - if (ctx) - OCSP_REQ_CTX_free(ctx); -#endif return rsp; } - +#endif -- 1.8.2.3