From 9500c8234d8e99396717b9e43f10cc518e8bf668 Mon Sep 17 00:00:00 2001 From: Shane Lontis Date: Thu, 25 Feb 2021 09:08:54 +1000 Subject: Fix misc external ossl_ symbols. Partial fix for #12964 Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/14473) --- crypto/http/http_client.c | 35 ++++++++++++++++++----------------- crypto/http/http_lib.c | 8 ++++---- crypto/http/http_local.h | 28 +++++++++++++++------------- 3 files changed, 37 insertions(+), 34 deletions(-) (limited to 'crypto/http') diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c index 2f59cb421a..1d08c41052 100644 --- a/crypto/http/http_client.c +++ b/crypto/http/http_client.c @@ -229,7 +229,7 @@ static int OSSL_HTTP_REQ_CTX_set_content(OSSL_HTTP_REQ_CTX *rctx, && BIO_write(rctx->mem, req, req_len) == (int)req_len; } -BIO *HTTP_asn1_item2bio(const ASN1_ITEM *it, const ASN1_VALUE *val) +BIO *ossl_http_asn1_item2bio(const ASN1_ITEM *it, const ASN1_VALUE *val) { BIO *res; @@ -258,7 +258,7 @@ int OSSL_HTTP_REQ_CTX_i2d(OSSL_HTTP_REQ_CTX *rctx, const char *content_type, return 0; } - res = (mem = HTTP_asn1_item2bio(it, req)) != NULL + res = (mem = ossl_http_asn1_item2bio(it, req)) != NULL && OSSL_HTTP_REQ_CTX_set_content(rctx, content_type, mem); BIO_free(mem); return res; @@ -290,14 +290,15 @@ static int OSSL_HTTP_REQ_CTX_add1_headers(OSSL_HTTP_REQ_CTX *rctx, * If !use_http_proxy then the 'server' and 'port' parameters are ignored. * If req_mem == NULL then use GET and ignore content_type, else POST. */ -OSSL_HTTP_REQ_CTX *HTTP_REQ_CTX_new(BIO *wbio, BIO *rbio, int use_http_proxy, - const char *server, const char *port, - const char *path, - const STACK_OF(CONF_VALUE) *headers, - const char *content_type, BIO *req_mem, - int maxline, unsigned long max_resp_len, - int timeout, - const char *expected_ct, int expect_asn1) +OSSL_HTTP_REQ_CTX +*ossl_http_req_ctx_new(BIO *wbio, BIO *rbio, int use_http_proxy, + const char *server, const char *port, + const char *path, + const STACK_OF(CONF_VALUE) *headers, + const char *content_type, BIO *req_mem, + int maxline, unsigned long max_resp_len, + int timeout, + const char *expected_ct, int expect_asn1) { OSSL_HTTP_REQ_CTX *rctx; @@ -868,7 +869,7 @@ BIO *OSSL_HTTP_transfer(const char *server, const char *port, const char *path, port = NULL; if (port == NULL && strchr(server, ':') == NULL) port = use_ssl ? OSSL_HTTPS_PORT : OSSL_HTTP_PORT; - proxy = http_adapt_proxy(proxy, no_proxy, server, use_ssl); + proxy = ossl_http_adapt_proxy(proxy, no_proxy, server, use_ssl); if ((cbio = HTTP_new_bio(server, port, proxy)) == NULL) return NULL; #else @@ -893,11 +894,11 @@ BIO *OSSL_HTTP_transfer(const char *server, const char *port, const char *path, } } - rctx = HTTP_REQ_CTX_new(cbio, rbio != NULL ? rbio : cbio, - !use_ssl && proxy != NULL, server, port, path, - headers, content_type, req_mem, maxline, - max_resp_len, update_timeout(timeout, start_time), - expected_ct, expect_asn1); + rctx = ossl_http_req_ctx_new(cbio, rbio != NULL ? rbio : cbio, + !use_ssl && proxy != NULL, server, port, path, + headers, content_type, req_mem, maxline, + max_resp_len, update_timeout(timeout, start_time), + expected_ct, expect_asn1); if (rctx == NULL) goto end; @@ -1090,7 +1091,7 @@ ASN1_VALUE *OSSL_HTTP_post_asn1(const char *server, const char *port, } /* remaining parameters are checked indirectly */ - req_mem = HTTP_asn1_item2bio(req_it, req); + req_mem = ossl_http_asn1_item2bio(req_it, req); res_mem = OSSL_HTTP_transfer(server, port, path, use_ssl, proxy, no_proxy, bio, rbio, bio_update_fn, arg, headers, content_type, diff --git a/crypto/http/http_lib.c b/crypto/http/http_lib.c index 8b300a9db0..ebb2af9b2e 100644 --- a/crypto/http/http_lib.c +++ b/crypto/http/http_lib.c @@ -239,7 +239,7 @@ int OSSL_HTTP_parse_url(const char *url, int *pssl, char **puser, char **phost, return 0; } -int http_use_proxy(const char *no_proxy, const char *server) +int ossl_http_use_proxy(const char *no_proxy, const char *server) { size_t sl; const char *found = NULL; @@ -265,8 +265,8 @@ int http_use_proxy(const char *no_proxy, const char *server) return found == NULL; } -const char *http_adapt_proxy(const char *proxy, const char *no_proxy, - const char *server, int use_ssl) +const char *ossl_http_adapt_proxy(const char *proxy, const char *no_proxy, + const char *server, int use_ssl) { const int http_len = strlen(OSSL_HTTP_PREFIX); const int https_len = strlen(OSSL_HTTPS_PREFIX); @@ -289,7 +289,7 @@ const char *http_adapt_proxy(const char *proxy, const char *no_proxy, else if (strncmp(proxy, OSSL_HTTPS_PREFIX, https_len) == 0) proxy += https_len; - if (*proxy == '\0' || !http_use_proxy(no_proxy, server)) + if (*proxy == '\0' || !ossl_http_use_proxy(no_proxy, server)) return NULL; return proxy; } diff --git a/crypto/http/http_local.h b/crypto/http/http_local.h index 3f52e0772f..1dfa03ce8e 100644 --- a/crypto/http/http_local.h +++ b/crypto/http/http_local.h @@ -13,18 +13,20 @@ # include -BIO *HTTP_asn1_item2bio(const ASN1_ITEM *it, const ASN1_VALUE *val); -OSSL_HTTP_REQ_CTX *HTTP_REQ_CTX_new(BIO *wbio, BIO *rbio, int use_http_proxy, - const char *server, const char *port, - const char *path, - const STACK_OF(CONF_VALUE) *headers, - const char *content_type, BIO *req_mem, - int maxline, unsigned long max_resp_len, - int timeout, - const char *expected_content_type, - int expect_asn1); -int http_use_proxy(const char *no_proxy, const char *server); -const char *http_adapt_proxy(const char *proxy, const char *no_proxy, - const char *server, int use_ssl); +BIO *ossl_http_asn1_item2bio(const ASN1_ITEM *it, const ASN1_VALUE *val); +OSSL_HTTP_REQ_CTX +*ossl_http_req_ctx_new(BIO *wbio, BIO *rbio, int use_http_proxy, + const char *server, const char *port, + const char *path, + const STACK_OF(CONF_VALUE) *headers, + const char *content_type, BIO *req_mem, + int maxline, unsigned long max_resp_len, + int timeout, + const char *expected_content_type, + int expect_asn1); + +int ossl_http_use_proxy(const char *no_proxy, const char *server); +const char *ossl_http_adapt_proxy(const char *proxy, const char *no_proxy, + const char *server, int use_ssl); #endif /* !defined(OSSL_CRYPTO_HTTP_LOCAL_H) */ -- cgit v1.2.3