2 * Copyright 2007-2020 The OpenSSL Project Authors. All Rights Reserved.
3 * Copyright Nokia 2007-2019
4 * Copyright Siemens AG 2015-2019
6 * Licensed under the Apache License 2.0 (the "License"). You may not use
7 * this file except in compliance with the License. You can obtain a copy
8 * in the file LICENSE in the source distribution or at
9 * https://www.openssl.org/source/license.html
12 /* general CMP server functions */
14 #include <openssl/asn1t.h>
16 #include "cmp_local.h"
18 /* explicit #includes not strictly needed since implied by the above: */
19 #include <openssl/cmp.h>
20 #include <openssl/err.h>
22 DEFINE_STACK_OF(OSSL_CRMF_MSG
)
24 DEFINE_STACK_OF(OSSL_CMP_ITAV
)
25 DEFINE_STACK_OF(OSSL_CMP_CERTSTATUS
)
27 /* the context for the generic CMP server */
28 struct ossl_cmp_srv_ctx_st
30 OSSL_CMP_CTX
*ctx
; /* Client CMP context, partly reused for srv */
31 void *custom_ctx
; /* pointer to specific server context */
33 OSSL_CMP_SRV_cert_request_cb_t process_cert_request
;
34 OSSL_CMP_SRV_rr_cb_t process_rr
;
35 OSSL_CMP_SRV_genm_cb_t process_genm
;
36 OSSL_CMP_SRV_error_cb_t process_error
;
37 OSSL_CMP_SRV_certConf_cb_t process_certConf
;
38 OSSL_CMP_SRV_pollReq_cb_t process_pollReq
;
40 int sendUnprotectedErrors
; /* Send error and rejection msgs unprotected */
41 int acceptUnprotected
; /* Accept requests with no/invalid prot. */
42 int acceptRAVerified
; /* Accept ir/cr/kur with POPO RAVerified */
43 int grantImplicitConfirm
; /* Grant implicit confirmation if requested */
45 }; /* OSSL_CMP_SRV_CTX */
47 void OSSL_CMP_SRV_CTX_free(OSSL_CMP_SRV_CTX
*srv_ctx
)
52 OSSL_CMP_CTX_free(srv_ctx
->ctx
);
53 OPENSSL_free(srv_ctx
);
56 OSSL_CMP_SRV_CTX
*OSSL_CMP_SRV_CTX_new(void)
58 OSSL_CMP_SRV_CTX
*ctx
= OPENSSL_zalloc(sizeof(OSSL_CMP_SRV_CTX
));
63 if ((ctx
->ctx
= OSSL_CMP_CTX_new()) == NULL
)
66 /* all other elements are initialized to 0 or NULL, respectively */
69 OSSL_CMP_SRV_CTX_free(ctx
);
73 int OSSL_CMP_SRV_CTX_init(OSSL_CMP_SRV_CTX
*srv_ctx
, void *custom_ctx
,
74 OSSL_CMP_SRV_cert_request_cb_t process_cert_request
,
75 OSSL_CMP_SRV_rr_cb_t process_rr
,
76 OSSL_CMP_SRV_genm_cb_t process_genm
,
77 OSSL_CMP_SRV_error_cb_t process_error
,
78 OSSL_CMP_SRV_certConf_cb_t process_certConf
,
79 OSSL_CMP_SRV_pollReq_cb_t process_pollReq
)
81 if (srv_ctx
== NULL
) {
82 CMPerr(0, CMP_R_NULL_ARGUMENT
);
85 srv_ctx
->custom_ctx
= custom_ctx
;
86 srv_ctx
->process_cert_request
= process_cert_request
;
87 srv_ctx
->process_rr
= process_rr
;
88 srv_ctx
->process_genm
= process_genm
;
89 srv_ctx
->process_error
= process_error
;
90 srv_ctx
->process_certConf
= process_certConf
;
91 srv_ctx
->process_pollReq
= process_pollReq
;
95 OSSL_CMP_CTX
*OSSL_CMP_SRV_CTX_get0_cmp_ctx(const OSSL_CMP_SRV_CTX
*srv_ctx
)
97 if (srv_ctx
== NULL
) {
98 CMPerr(0, CMP_R_NULL_ARGUMENT
);
104 void *OSSL_CMP_SRV_CTX_get0_custom_ctx(const OSSL_CMP_SRV_CTX
*srv_ctx
)
106 if (srv_ctx
== NULL
) {
107 CMPerr(0, CMP_R_NULL_ARGUMENT
);
110 return srv_ctx
->custom_ctx
;
113 int OSSL_CMP_SRV_CTX_set_send_unprotected_errors(OSSL_CMP_SRV_CTX
*srv_ctx
,
116 if (srv_ctx
== NULL
) {
117 CMPerr(0, CMP_R_NULL_ARGUMENT
);
120 srv_ctx
->sendUnprotectedErrors
= val
!= 0;
124 int OSSL_CMP_SRV_CTX_set_accept_unprotected(OSSL_CMP_SRV_CTX
*srv_ctx
, int val
)
126 if (srv_ctx
== NULL
) {
127 CMPerr(0, CMP_R_NULL_ARGUMENT
);
130 srv_ctx
->acceptUnprotected
= val
!= 0;
134 int OSSL_CMP_SRV_CTX_set_accept_raverified(OSSL_CMP_SRV_CTX
*srv_ctx
, int val
)
136 if (srv_ctx
== NULL
) {
137 CMPerr(0, CMP_R_NULL_ARGUMENT
);
140 srv_ctx
->acceptRAVerified
= val
!= 0;
144 int OSSL_CMP_SRV_CTX_set_grant_implicit_confirm(OSSL_CMP_SRV_CTX
*srv_ctx
,
147 if (srv_ctx
== NULL
) {
148 CMPerr(0, CMP_R_NULL_ARGUMENT
);
151 srv_ctx
->grantImplicitConfirm
= val
!= 0;
156 * Processes an ir/cr/p10cr/kur and returns a certification response.
157 * Only handles the first certification request contained in req
158 * returns an ip/cp/kup on success and NULL on error
160 static OSSL_CMP_MSG
*process_cert_request(OSSL_CMP_SRV_CTX
*srv_ctx
,
161 const OSSL_CMP_MSG
*req
)
163 OSSL_CMP_MSG
*msg
= NULL
;
164 OSSL_CMP_PKISI
*si
= NULL
;
165 X509
*certOut
= NULL
;
166 STACK_OF(X509
) *chainOut
= NULL
, *caPubs
= NULL
;
167 const OSSL_CRMF_MSG
*crm
= NULL
;
168 const X509_REQ
*p10cr
= NULL
;
172 if (!ossl_assert(srv_ctx
!= NULL
&& srv_ctx
->ctx
!= NULL
&& req
!= NULL
))
175 switch (ossl_cmp_msg_get_bodytype(req
)) {
176 case OSSL_CMP_PKIBODY_P10CR
:
177 case OSSL_CMP_PKIBODY_CR
:
178 bodytype
= OSSL_CMP_PKIBODY_CP
;
180 case OSSL_CMP_PKIBODY_IR
:
181 bodytype
= OSSL_CMP_PKIBODY_IP
;
183 case OSSL_CMP_PKIBODY_KUR
:
184 bodytype
= OSSL_CMP_PKIBODY_KUP
;
187 CMPerr(0, CMP_R_UNEXPECTED_PKIBODY
);
191 if (ossl_cmp_msg_get_bodytype(req
) == OSSL_CMP_PKIBODY_P10CR
) {
192 certReqId
= OSSL_CMP_CERTREQID
;
193 p10cr
= req
->body
->value
.p10cr
;
195 OSSL_CRMF_MSGS
*reqs
= req
->body
->value
.ir
; /* same for cr and kur */
197 if (sk_OSSL_CRMF_MSG_num(reqs
) != 1) { /* TODO: handle case > 1 */
198 CMPerr(0, CMP_R_MULTIPLE_REQUESTS_NOT_SUPPORTED
);
202 if ((crm
= sk_OSSL_CRMF_MSG_value(reqs
, OSSL_CMP_CERTREQID
)) == NULL
) {
203 CMPerr(0, CMP_R_CERTREQMSG_NOT_FOUND
);
206 certReqId
= OSSL_CRMF_MSG_get_certReqId(crm
);
209 if (!ossl_cmp_verify_popo(req
, srv_ctx
->acceptRAVerified
)) {
210 /* Proof of possession could not be verified */
211 si
= OSSL_CMP_STATUSINFO_new(OSSL_CMP_PKISTATUS_rejection
,
212 1 << OSSL_CMP_PKIFAILUREINFO_badPOP
,
213 ERR_reason_error_string(ERR_peek_error()));
217 OSSL_CMP_PKIHEADER
*hdr
= OSSL_CMP_MSG_get0_header(req
);
219 si
= srv_ctx
->process_cert_request(srv_ctx
, req
, certReqId
, crm
, p10cr
,
220 &certOut
, &chainOut
, &caPubs
);
223 /* set OSSL_CMP_OPT_IMPLICIT_CONFIRM if and only if transaction ends */
224 if (!OSSL_CMP_CTX_set_option(srv_ctx
->ctx
, OSSL_CMP_OPT_IMPLICIT_CONFIRM
,
225 ossl_cmp_hdr_has_implicitConfirm(hdr
)
226 && srv_ctx
->grantImplicitConfirm
227 /* do not set if polling starts: */
232 msg
= ossl_cmp_certRep_new(srv_ctx
->ctx
, bodytype
, certReqId
, si
,
233 certOut
, chainOut
, caPubs
, 0 /* encrypted */,
234 srv_ctx
->sendUnprotectedErrors
);
236 * TODO when implemented in ossl_cmp_certrep_new():
237 * in case OSSL_CRMF_POPO_KEYENC, set encrypted
240 CMPerr(0, CMP_R_ERROR_CREATING_CERTREP
);
243 OSSL_CMP_PKISI_free(si
);
245 sk_X509_pop_free(chainOut
, X509_free
);
246 sk_X509_pop_free(caPubs
, X509_free
);
250 static OSSL_CMP_MSG
*process_rr(OSSL_CMP_SRV_CTX
*srv_ctx
,
251 const OSSL_CMP_MSG
*req
)
253 OSSL_CMP_MSG
*msg
= NULL
;
254 OSSL_CMP_REVDETAILS
*details
;
255 OSSL_CRMF_CERTID
*certId
;
256 OSSL_CRMF_CERTTEMPLATE
*tmpl
;
257 const X509_NAME
*issuer
;
258 ASN1_INTEGER
*serial
;
261 if (!ossl_assert(srv_ctx
!= NULL
&& srv_ctx
->ctx
!= NULL
&& req
!= NULL
))
264 if (sk_OSSL_CMP_REVDETAILS_num(req
->body
->value
.rr
) != 1) {
265 /* TODO: handle multiple elements if multiple requests have been sent */
266 CMPerr(0, CMP_R_MULTIPLE_REQUESTS_NOT_SUPPORTED
);
270 if ((details
= sk_OSSL_CMP_REVDETAILS_value(req
->body
->value
.rr
,
271 OSSL_CMP_REVREQSID
)) == NULL
) {
272 CMPerr(0, CMP_R_ERROR_PROCESSING_MESSAGE
);
276 tmpl
= details
->certDetails
;
277 issuer
= OSSL_CRMF_CERTTEMPLATE_get0_issuer(tmpl
);
278 serial
= OSSL_CRMF_CERTTEMPLATE_get0_serialNumber(tmpl
);
279 /* here issuer and serial may safely be NULL */
280 if ((certId
= OSSL_CRMF_CERTID_gen(issuer
, serial
)) == NULL
)
282 if ((si
= srv_ctx
->process_rr(srv_ctx
, req
, issuer
, serial
)) == NULL
)
285 if ((msg
= ossl_cmp_rp_new(srv_ctx
->ctx
, si
, certId
,
286 srv_ctx
->sendUnprotectedErrors
)) == NULL
)
287 CMPerr(0, CMP_R_ERROR_CREATING_RR
);
290 OSSL_CRMF_CERTID_free(certId
);
291 OSSL_CMP_PKISI_free(si
);
296 * Processes genm and creates a genp message mirroring the contents of the
299 static OSSL_CMP_MSG
*process_genm(OSSL_CMP_SRV_CTX
*srv_ctx
,
300 const OSSL_CMP_MSG
*req
)
302 OSSL_CMP_GENMSGCONTENT
*itavs
;
305 if (!ossl_assert(srv_ctx
!= NULL
&& srv_ctx
->ctx
!= NULL
&& req
!= NULL
))
308 if (!srv_ctx
->process_genm(srv_ctx
, req
, req
->body
->value
.genm
, &itavs
))
311 msg
= ossl_cmp_genp_new(srv_ctx
->ctx
, itavs
);
312 sk_OSSL_CMP_ITAV_pop_free(itavs
, OSSL_CMP_ITAV_free
);
316 static OSSL_CMP_MSG
*process_error(OSSL_CMP_SRV_CTX
*srv_ctx
,
317 const OSSL_CMP_MSG
*req
)
319 OSSL_CMP_ERRORMSGCONTENT
*errorContent
;
322 if (!ossl_assert(srv_ctx
!= NULL
&& srv_ctx
->ctx
!= NULL
&& req
!= NULL
))
324 errorContent
= req
->body
->value
.error
;
325 srv_ctx
->process_error(srv_ctx
, req
, errorContent
->pKIStatusInfo
,
326 errorContent
->errorCode
, errorContent
->errorDetails
);
328 if ((msg
= ossl_cmp_pkiconf_new(srv_ctx
->ctx
)) == NULL
)
329 CMPerr(0, CMP_R_ERROR_CREATING_PKICONF
);
333 static OSSL_CMP_MSG
*process_certConf(OSSL_CMP_SRV_CTX
*srv_ctx
,
334 const OSSL_CMP_MSG
*req
)
337 OSSL_CMP_CERTCONFIRMCONTENT
*ccc
;
339 OSSL_CMP_MSG
*msg
= NULL
;
340 OSSL_CMP_CERTSTATUS
*status
= NULL
;
342 if (!ossl_assert(srv_ctx
!= NULL
&& srv_ctx
->ctx
!= NULL
&& req
!= NULL
))
346 ccc
= req
->body
->value
.certConf
;
347 num
= sk_OSSL_CMP_CERTSTATUS_num(ccc
);
349 if (OSSL_CMP_CTX_get_option(ctx
, OSSL_CMP_OPT_IMPLICIT_CONFIRM
) == 1) {
350 CMPerr(0, CMP_R_ERROR_UNEXPECTED_CERTCONF
);
355 ossl_cmp_err(ctx
, "certificate rejected by client");
358 ossl_cmp_warn(ctx
, "All CertStatus but the first will be ignored");
359 status
= sk_OSSL_CMP_CERTSTATUS_value(ccc
, OSSL_CMP_CERTREQID
);
362 if (status
!= NULL
) {
363 int certReqId
= ossl_cmp_asn1_get_int(status
->certReqId
);
364 ASN1_OCTET_STRING
*certHash
= status
->certHash
;
365 OSSL_CMP_PKISI
*si
= status
->statusInfo
;
367 if (!srv_ctx
->process_certConf(srv_ctx
, req
, certReqId
, certHash
, si
))
368 return NULL
; /* reason code may be: CMP_R_CERTHASH_UNMATCHED */
370 if (si
!= NULL
&& ossl_cmp_pkisi_get_status(si
)
371 != OSSL_CMP_PKISTATUS_accepted
) {
372 int pki_status
= ossl_cmp_pkisi_get_status(si
);
373 const char *str
= ossl_cmp_PKIStatus_to_string(pki_status
);
375 ossl_cmp_log2(INFO
, ctx
, "certificate rejected by client %s %s",
376 str
== NULL
? "without" : "with",
377 str
== NULL
? "PKIStatus" : str
);
381 if ((msg
= ossl_cmp_pkiconf_new(ctx
)) == NULL
)
382 CMPerr(0, CMP_R_ERROR_CREATING_PKICONF
);
386 static OSSL_CMP_MSG
*process_pollReq(OSSL_CMP_SRV_CTX
*srv_ctx
,
387 const OSSL_CMP_MSG
*req
)
389 OSSL_CMP_POLLREQCONTENT
*prc
;
390 OSSL_CMP_POLLREQ
*pr
;
392 OSSL_CMP_MSG
*certReq
;
393 int64_t check_after
= 0;
394 OSSL_CMP_MSG
*msg
= NULL
;
396 if (!ossl_assert(srv_ctx
!= NULL
&& srv_ctx
->ctx
!= NULL
&& req
!= NULL
))
399 prc
= req
->body
->value
.pollReq
;
400 if (sk_OSSL_CMP_POLLREQ_num(prc
) != 1) { /* TODO: handle case > 1 */
401 CMPerr(0, CMP_R_MULTIPLE_REQUESTS_NOT_SUPPORTED
);
405 pr
= sk_OSSL_CMP_POLLREQ_value(prc
, 0);
406 certReqId
= ossl_cmp_asn1_get_int(pr
->certReqId
);
407 if (!srv_ctx
->process_pollReq(srv_ctx
, req
, certReqId
,
408 &certReq
, &check_after
))
411 if (certReq
!= NULL
) {
412 msg
= process_cert_request(srv_ctx
, certReq
);
413 OSSL_CMP_MSG_free(certReq
);
415 if ((msg
= ossl_cmp_pollRep_new(srv_ctx
->ctx
, certReqId
,
416 check_after
)) == NULL
)
417 CMPerr(0, CMP_R_ERROR_CREATING_POLLREP
);
423 * Determine whether missing/invalid protection of request message is allowed.
424 * Return 1 on acceptance, 0 on rejection, or -1 on (internal) error.
426 static int unprotected_exception(const OSSL_CMP_CTX
*ctx
,
427 const OSSL_CMP_MSG
*req
,
428 int invalid_protection
,
429 int accept_unprotected_requests
)
431 if (!ossl_assert(ctx
!= NULL
&& req
!= NULL
))
434 if (accept_unprotected_requests
) {
435 ossl_cmp_log1(WARN
, ctx
, "ignoring %s protection of request message",
436 invalid_protection
? "invalid" : "missing");
439 if (ossl_cmp_msg_get_bodytype(req
) == OSSL_CMP_PKIBODY_ERROR
440 && OSSL_CMP_CTX_get_option(ctx
, OSSL_CMP_OPT_UNPROTECTED_ERRORS
) == 1) {
441 ossl_cmp_warn(ctx
, "ignoring missing protection of error message");
448 * returns created message and NULL on internal error
450 OSSL_CMP_MSG
*OSSL_CMP_SRV_process_request(OSSL_CMP_SRV_CTX
*srv_ctx
,
451 const OSSL_CMP_MSG
*req
)
454 OSSL_CMP_PKIHEADER
*hdr
;
455 int req_type
, rsp_type
;
456 OSSL_CMP_MSG
*rsp
= NULL
;
458 if (srv_ctx
== NULL
|| srv_ctx
->ctx
== NULL
459 || req
== NULL
|| req
->body
== NULL
460 || (hdr
= OSSL_CMP_MSG_get0_header(req
)) == NULL
) {
461 CMPerr(0, CMP_R_NULL_ARGUMENT
);
466 if (hdr
->sender
->type
!= GEN_DIRNAME
) {
467 CMPerr(0, CMP_R_SENDER_GENERALNAME_TYPE_NOT_SUPPORTED
);
470 if (!OSSL_CMP_CTX_set1_recipient(ctx
, hdr
->sender
->d
.directoryName
))
473 req_type
= ossl_cmp_msg_get_bodytype(req
);
475 case OSSL_CMP_PKIBODY_IR
:
476 case OSSL_CMP_PKIBODY_CR
:
477 case OSSL_CMP_PKIBODY_P10CR
:
478 case OSSL_CMP_PKIBODY_KUR
:
479 case OSSL_CMP_PKIBODY_RR
:
480 case OSSL_CMP_PKIBODY_GENM
:
481 case OSSL_CMP_PKIBODY_ERROR
:
482 if (ctx
->transactionID
!= NULL
) {
485 tid
= OPENSSL_buf2hexstr(ctx
->transactionID
->data
,
486 ctx
->transactionID
->length
);
487 ossl_cmp_log1(WARN
, ctx
,
488 "Assuming that last transaction with ID=%s got aborted",
492 /* start of a new transaction, set transactionID and senderNonce */
493 if (!OSSL_CMP_CTX_set1_transactionID(ctx
, hdr
->transactionID
)
494 || !ossl_cmp_ctx_set1_recipNonce(ctx
, hdr
->senderNonce
))
498 /* transactionID should be already initialized */
499 if (ctx
->transactionID
== NULL
) {
500 #ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
501 CMPerr(0, CMP_R_UNEXPECTED_PKIBODY
);
502 /* ignore any (extra) error in next two function calls: */
503 (void)OSSL_CMP_CTX_set1_transactionID(ctx
, hdr
->transactionID
);
504 (void)ossl_cmp_ctx_set1_recipNonce(ctx
, hdr
->senderNonce
);
510 if (ossl_cmp_msg_check_received(ctx
, req
, unprotected_exception
,
511 srv_ctx
->acceptUnprotected
) < 0)
515 case OSSL_CMP_PKIBODY_IR
:
516 case OSSL_CMP_PKIBODY_CR
:
517 case OSSL_CMP_PKIBODY_P10CR
:
518 case OSSL_CMP_PKIBODY_KUR
:
519 if (srv_ctx
->process_cert_request
== NULL
)
520 CMPerr(0, CMP_R_UNEXPECTED_PKIBODY
);
522 rsp
= process_cert_request(srv_ctx
, req
);
524 case OSSL_CMP_PKIBODY_RR
:
525 if (srv_ctx
->process_rr
== NULL
)
526 CMPerr(0, CMP_R_UNEXPECTED_PKIBODY
);
528 rsp
= process_rr(srv_ctx
, req
);
530 case OSSL_CMP_PKIBODY_GENM
:
531 if (srv_ctx
->process_genm
== NULL
)
532 CMPerr(0, CMP_R_UNEXPECTED_PKIBODY
);
534 rsp
= process_genm(srv_ctx
, req
);
536 case OSSL_CMP_PKIBODY_ERROR
:
537 if (srv_ctx
->process_error
== NULL
)
538 CMPerr(0, CMP_R_UNEXPECTED_PKIBODY
);
540 rsp
= process_error(srv_ctx
, req
);
542 case OSSL_CMP_PKIBODY_CERTCONF
:
543 if (srv_ctx
->process_certConf
== NULL
)
544 CMPerr(0, CMP_R_UNEXPECTED_PKIBODY
);
546 rsp
= process_certConf(srv_ctx
, req
);
548 case OSSL_CMP_PKIBODY_POLLREQ
:
549 if (srv_ctx
->process_pollReq
== NULL
)
550 CMPerr(0, CMP_R_UNEXPECTED_PKIBODY
);
552 rsp
= process_pollReq(srv_ctx
, req
);
555 /* TODO possibly support further request message types */
556 CMPerr(0, CMP_R_UNEXPECTED_PKIBODY
);
562 /* on error, try to respond with CMP error message to client */
563 const char *data
= NULL
;
565 unsigned long err
= ERR_peek_error_data(&data
, &flags
);
566 int fail_info
= 1 << OSSL_CMP_PKIFAILUREINFO_badRequest
;
567 /* TODO fail_info could be more specific */
568 OSSL_CMP_PKISI
*si
= NULL
;
570 if ((si
= OSSL_CMP_STATUSINFO_new(OSSL_CMP_PKISTATUS_rejection
,
571 fail_info
, NULL
)) == NULL
)
573 if (err
!= 0 && (flags
& ERR_TXT_STRING
) != 0)
574 data
= ERR_reason_error_string(err
);
575 rsp
= ossl_cmp_error_new(srv_ctx
->ctx
, si
,
576 err
!= 0 ? ERR_GET_REASON(err
) : -1,
577 data
, srv_ctx
->sendUnprotectedErrors
);
578 OSSL_CMP_PKISI_free(si
);
581 /* possibly close the transaction */
583 rsp
!= NULL
? ossl_cmp_msg_get_bodytype(rsp
) : OSSL_CMP_PKIBODY_ERROR
;
585 case OSSL_CMP_PKIBODY_IP
:
586 case OSSL_CMP_PKIBODY_CP
:
587 case OSSL_CMP_PKIBODY_KUP
:
588 case OSSL_CMP_PKIBODY_RP
:
589 if (OSSL_CMP_CTX_get_option(ctx
, OSSL_CMP_OPT_IMPLICIT_CONFIRM
) == 0)
593 case OSSL_CMP_PKIBODY_PKICONF
:
594 case OSSL_CMP_PKIBODY_GENP
:
595 case OSSL_CMP_PKIBODY_ERROR
:
596 /* TODO possibly support further terminating response message types */
597 (void)OSSL_CMP_CTX_set1_transactionID(ctx
, NULL
); /* ignore any error */
599 default: /* not closing transaction in other cases */
606 * Server interface that may substitute OSSL_CMP_MSG_http_perform at the client.
607 * The OSSL_CMP_SRV_CTX must be set as client_ctx->transfer_cb_arg.
608 * returns received message on success, else NULL and pushes an element on the
611 OSSL_CMP_MSG
* OSSL_CMP_CTX_server_perform(OSSL_CMP_CTX
*client_ctx
,
612 const OSSL_CMP_MSG
*req
)
614 OSSL_CMP_SRV_CTX
*srv_ctx
= NULL
;
616 if (client_ctx
== NULL
|| req
== NULL
) {
617 CMPerr(0, CMP_R_NULL_ARGUMENT
);
621 if ((srv_ctx
= OSSL_CMP_CTX_get_transfer_cb_arg(client_ctx
)) == NULL
) {
622 CMPerr(0, CMP_R_TRANSFER_ERROR
);
626 return OSSL_CMP_SRV_process_request(srv_ctx
, req
);