summaryrefslogtreecommitdiffstats
path: root/crypto/ocsp
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2021-01-18 12:53:55 +0100
committerDr. David von Oheimb <dev@ddvo.net>2021-01-23 15:25:05 +0100
commitc9603dfa42d0643a6c8cac3e14364d9fd63303c4 (patch)
treec0786fe4a40cb83f79c1a80985ef1089b65362c6 /crypto/ocsp
parent806990e7db4c0ea7ad544477bb7b697cc36347ea (diff)
OCSP HTTP: Restore API of undocumented and recently deprecated functions
Restore parameters of OCSP_REQ_CTX_new(), OCSP_REQ_CTX_http(), OCSP_REQ_CTX_i2d(). Fix a bug (wrong HTTP method selected on req == NULL in OCSP_sendreq_new(). Minor further fixes in OSSL_HTTP_REQ_CTX.pod Fixes #13873 Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13898)
Diffstat (limited to 'crypto/ocsp')
-rw-r--r--crypto/ocsp/ocsp_http.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/crypto/ocsp/ocsp_http.c b/crypto/ocsp/ocsp_http.c
index c5508698c8..e7f1b5a509 100644
--- a/crypto/ocsp/ocsp_http.c
+++ b/crypto/ocsp/ocsp_http.c
@@ -13,29 +13,30 @@
#ifndef OPENSSL_NO_OCSP
-# ifndef OPENSSL_NO_DEPRECATED_3_0
-int OCSP_REQ_CTX_set1_req(OSSL_HTTP_REQ_CTX *rctx, const OCSP_REQUEST *req)
-{
- return OSSL_HTTP_REQ_CTX_i2d(rctx, "application/ocsp-request",
- ASN1_ITEM_rptr(OCSP_REQUEST),
- (ASN1_VALUE *)req);
-}
-# endif
-
OSSL_HTTP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path,
- OCSP_REQUEST *req, int maxline)
+ const OCSP_REQUEST *req, int maxline)
{
- BIO *req_mem = HTTP_asn1_item2bio(ASN1_ITEM_rptr(OCSP_REQUEST),
- (ASN1_VALUE *)req);
- OSSL_HTTP_REQ_CTX *res =
- HTTP_REQ_CTX_new(io, io, 0 /* no HTTP proxy used */, NULL, NULL, path,
- NULL /* headers */, "application/ocsp-request",
- req_mem /* may be NULL */,
- maxline, 0 /* default max_resp_len */,
- 0 /* no timeout, blocking indefinite */, NULL,
- 1 /* expect_asn1 */);
- BIO_free(req_mem);
- return res;
+ OSSL_HTTP_REQ_CTX *rctx = NULL;
+
+ if ((rctx = OSSL_HTTP_REQ_CTX_new(io, io, 1 /* POST */,
+ maxline, 0 /* default max_resp_len */,
+ 0 /* no timeout, blocking indefinitely */,
+ NULL, 1 /* expect_asn1 */)) == NULL)
+ return NULL;
+
+ if (!OSSL_HTTP_REQ_CTX_set_request_line(rctx, NULL, NULL, path))
+ goto err;
+
+ if (req != NULL && !OSSL_HTTP_REQ_CTX_i2d(rctx, "application/ocsp-request",
+ ASN1_ITEM_rptr(OCSP_REQUEST),
+ (ASN1_VALUE *)req))
+ goto err;
+
+ return rctx;
+
+ err:
+ OSSL_HTTP_REQ_CTX_free(rctx);
+ return NULL;
}
int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OSSL_HTTP_REQ_CTX *rctx)