diff options
author | VladimĂr Kotal <vladimir.kotal@oracle.com> | 2023-06-01 19:55:54 +0200 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2023-06-06 11:05:02 +1000 |
commit | 3ca28c9e81fae36b0b44dc39beecd2b5a7561975 (patch) | |
tree | 4d1028ff958edec00915ef4b962c31c1c232ca9a /crypto/cmp | |
parent | c69756e7a0133b67df50525e89206c9cc4a7d2b8 (diff) |
allow to disable http
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21108)
Diffstat (limited to 'crypto/cmp')
-rw-r--r-- | crypto/cmp/build.info | 11 | ||||
-rw-r--r-- | crypto/cmp/cmp_client.c | 2 | ||||
-rw-r--r-- | crypto/cmp/cmp_ctx.c | 6 | ||||
-rw-r--r-- | crypto/cmp/cmp_local.h | 2 |
4 files changed, 19 insertions, 2 deletions
diff --git a/crypto/cmp/build.info b/crypto/cmp/build.info index ad67c434cc..907d78d25f 100644 --- a/crypto/cmp/build.info +++ b/crypto/cmp/build.info @@ -1,4 +1,11 @@ LIBS=../../libcrypto -SOURCE[../../libcrypto]= cmp_asn.c cmp_ctx.c cmp_err.c cmp_util.c \ +$OPENSSLSRC=\ + cmp_asn.c cmp_ctx.c cmp_err.c cmp_util.c \ cmp_status.c cmp_hdr.c cmp_protect.c cmp_msg.c cmp_vfy.c \ - cmp_server.c cmp_client.c cmp_genm.c cmp_http.c + cmp_server.c cmp_client.c cmp_genm.c + +IF[{- !$disabled{'http'} -}] + $OPENSSLSRC=$OPENSSLSRC cmp_http.c +ENDIF + +SOURCE[../../libcrypto]=$OPENSSLSRC diff --git a/crypto/cmp/cmp_client.c b/crypto/cmp/cmp_client.c index 62f3738247..071c02b187 100644 --- a/crypto/cmp/cmp_client.c +++ b/crypto/cmp/cmp_client.c @@ -134,8 +134,10 @@ static int send_receive_check(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *req, int time_left; OSSL_CMP_transfer_cb_t transfer_cb = ctx->transfer_cb; +#ifndef OPENSSL_NO_HTTP if (transfer_cb == NULL) transfer_cb = OSSL_CMP_MSG_http_perform; +#endif *rep = NULL; if (ctx->total_timeout != 0 /* not waiting indefinitely */) { diff --git a/crypto/cmp/cmp_ctx.c b/crypto/cmp/cmp_ctx.c index ed15f45489..2b8bd2bd2e 100644 --- a/crypto/cmp/cmp_ctx.c +++ b/crypto/cmp/cmp_ctx.c @@ -163,11 +163,13 @@ int OSSL_CMP_CTX_reinit(OSSL_CMP_CTX *ctx) return 0; } +#ifndef OPENSSL_NO_HTTP if (ctx->http_ctx != NULL) { (void)OSSL_HTTP_close(ctx->http_ctx, 1); ossl_cmp_debug(ctx, "disconnected from CMP server"); ctx->http_ctx = NULL; } +#endif ctx->status = OSSL_CMP_PKISTATUS_unspecified; ctx->failInfoCode = -1; @@ -191,10 +193,12 @@ void OSSL_CMP_CTX_free(OSSL_CMP_CTX *ctx) if (ctx == NULL) return; +#ifndef OPENSSL_NO_HTTP if (ctx->http_ctx != NULL) { (void)OSSL_HTTP_close(ctx->http_ctx, 1); ossl_cmp_debug(ctx, "disconnected from CMP server"); } +#endif OPENSSL_free(ctx->propq); OPENSSL_free(ctx->serverPath); OPENSSL_free(ctx->server); @@ -813,6 +817,7 @@ DEFINE_OSSL_CMP_CTX_set1(server, char) /* Set the server exclusion list of the HTTP proxy server */ DEFINE_OSSL_CMP_CTX_set1(no_proxy, char) +#ifndef OPENSSL_NO_HTTP /* Set the http connect/disconnect callback function to be used for HTTP(S) */ DEFINE_OSSL_set(OSSL_CMP_CTX, http_cb, OSSL_HTTP_bio_cb_t) @@ -824,6 +829,7 @@ DEFINE_OSSL_set(OSSL_CMP_CTX, http_cb_arg, void *) * Returns callback argument set previously (NULL if not set or on error) */ DEFINE_OSSL_get(OSSL_CMP_CTX, http_cb_arg, void *, NULL) +#endif /* Set callback function for sending CMP request and receiving response */ DEFINE_OSSL_set(OSSL_CMP_CTX, transfer_cb, OSSL_CMP_transfer_cb_t) diff --git a/crypto/cmp/cmp_local.h b/crypto/cmp/cmp_local.h index 1a27d39abf..b8168af06f 100644 --- a/crypto/cmp/cmp_local.h +++ b/crypto/cmp/cmp_local.h @@ -51,8 +51,10 @@ struct ossl_cmp_ctx_st { int total_timeout; /* max number of seconds an enrollment may take, incl. */ /* attempts polling for a response if a 'waiting' PKIStatus is received */ time_t end_time; /* session start time + totaltimeout */ +# ifndef OPENSSL_NO_HTTP OSSL_HTTP_bio_cb_t http_cb; void *http_cb_arg; /* allows to store optional argument to cb */ +# endif /* server authentication */ /* |