Skip to content

Commit afe554c

Browse files
committed
Chunk 10 of CMP contribution to OpenSSL: CMP http client and related tests
Also improve the generic HTTP client w.r.t. proxy and no_proxy options. Certificate Management Protocol (CMP, RFC 4210) extension to OpenSSL Also includes CRMF (RFC 4211) and HTTP transfer (RFC 6712). Adds the CMP and CRMF API to libcrypto and the "cmp" app to the CLI. Adds extensive documentation and tests. Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: David von Oheimb <[email protected]> (Merged from openssl#11404)
1 parent 98278b9 commit afe554c

26 files changed

+321
-244
lines changed

apps/include/apps.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,13 @@ BIO *app_http_tls_cb(BIO *hbio, /* APP_HTTP_TLS_INFO */ void *arg,
233233
int connect, int detail);
234234
# ifndef OPENSSL_NO_SOCK
235235
ASN1_VALUE *app_http_get_asn1(const char *url, const char *proxy,
236-
const char *proxy_port, SSL_CTX *ssl_ctx,
236+
const char *no_proxy, SSL_CTX *ssl_ctx,
237237
const STACK_OF(CONF_VALUE) *headers,
238238
long timeout, const char *expected_content_type,
239239
const ASN1_ITEM *it);
240240
ASN1_VALUE *app_http_post_asn1(const char *host, const char *port,
241241
const char *path, const char *proxy,
242-
const char *proxy_port, SSL_CTX *ctx,
242+
const char *no_proxy, SSL_CTX *ctx,
243243
const STACK_OF(CONF_VALUE) *headers,
244244
const char *content_type,
245245
ASN1_VALUE *req, const ASN1_ITEM *req_it,

apps/lib/apps.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -1990,7 +1990,7 @@ BIO *app_http_tls_cb(BIO *hbio, void *arg, int connect, int detail)
19901990
} else if (!connect && !detail) { /* disconnecting after error */
19911991
const char *hint = tls_error_hint();
19921992
if (hint != NULL)
1993-
ERR_add_error_data(1, hint);
1993+
ERR_add_error_data(2, " : ", hint);
19941994
/*
19951995
* If we pop sbio and BIO_free() it this may lead to libssl double free.
19961996
* Rely on BIO_free_all() done by OSSL_HTTP_transfer() in http_client.c
@@ -2000,7 +2000,7 @@ BIO *app_http_tls_cb(BIO *hbio, void *arg, int connect, int detail)
20002000
}
20012001

20022002
ASN1_VALUE *app_http_get_asn1(const char *url, const char *proxy,
2003-
const char *proxy_port, SSL_CTX *ssl_ctx,
2003+
const char *no_proxy, SSL_CTX *ssl_ctx,
20042004
const STACK_OF(CONF_VALUE) *headers,
20052005
long timeout, const char *expected_content_type,
20062006
const ASN1_ITEM *it)
@@ -2029,7 +2029,7 @@ ASN1_VALUE *app_http_get_asn1(const char *url, const char *proxy,
20292029
info.use_proxy = proxy != NULL;
20302030
info.timeout = timeout;
20312031
info.ssl_ctx = ssl_ctx;
2032-
resp = OSSL_HTTP_get_asn1(url, proxy, proxy_port,
2032+
resp = OSSL_HTTP_get_asn1(url, proxy, no_proxy,
20332033
NULL, NULL, app_http_tls_cb, &info,
20342034
headers, 0 /* maxline */, 0 /* max_resp_len */,
20352035
timeout, expected_content_type, it);
@@ -2042,7 +2042,7 @@ ASN1_VALUE *app_http_get_asn1(const char *url, const char *proxy,
20422042

20432043
ASN1_VALUE *app_http_post_asn1(const char *host, const char *port,
20442044
const char *path, const char *proxy,
2045-
const char *proxy_port, SSL_CTX *ssl_ctx,
2045+
const char *no_proxy, SSL_CTX *ssl_ctx,
20462046
const STACK_OF(CONF_VALUE) *headers,
20472047
const char *content_type,
20482048
ASN1_VALUE *req, const ASN1_ITEM *req_it,
@@ -2056,7 +2056,7 @@ ASN1_VALUE *app_http_post_asn1(const char *host, const char *port,
20562056
info.timeout = timeout;
20572057
info.ssl_ctx = ssl_ctx;
20582058
return OSSL_HTTP_post_asn1(host, port, path, ssl_ctx != NULL,
2059-
proxy, proxy_port,
2059+
proxy, no_proxy,
20602060
NULL, NULL, app_http_tls_cb, &info,
20612061
headers, content_type, req, req_it,
20622062
0 /* maxline */,

crypto/cmp/build.info

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
LIBS=../../libcrypto
22
SOURCE[../../libcrypto]= cmp_asn.c cmp_ctx.c cmp_err.c cmp_util.c \
33
cmp_status.c cmp_hdr.c cmp_protect.c cmp_msg.c cmp_vfy.c \
4-
cmp_server.c cmp_client.c
4+
cmp_server.c cmp_client.c cmp_http.c

crypto/cmp/cmp_client.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ static int send_receive_check(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *req,
140140
OSSL_CMP_transfer_cb_t transfer_cb = ctx->transfer_cb;
141141

142142
if (transfer_cb == NULL)
143-
transfer_cb = NULL; /* TODO: will be OSSL_CMP_MSG_http_perform of chunk 10 */
143+
transfer_cb = OSSL_CMP_MSG_http_perform;
144144

145145
*rep = NULL;
146146
msg_timeout = ctx->msg_timeout; /* backup original value */

0 commit comments

Comments
 (0)