diff options
Diffstat (limited to 'crypto/cmp/cmp_server.c')
-rw-r--r-- | crypto/cmp/cmp_server.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto/cmp/cmp_server.c b/crypto/cmp/cmp_server.c index 345f312df4..593c074f8d 100644 --- a/crypto/cmp/cmp_server.c +++ b/crypto/cmp/cmp_server.c @@ -562,7 +562,7 @@ OSSL_CMP_MSG *OSSL_CMP_SRV_process_request(OSSL_CMP_SRV_CTX *srv_ctx, err: if (rsp == NULL) { /* on error, try to respond with CMP error message to client */ - const char *data = NULL; + const char *data = NULL, *reason = NULL; int flags = 0; unsigned long err = ERR_peek_error_data(&data, &flags); int fail_info = 1 << OSSL_CMP_PKIFAILUREINFO_badRequest; @@ -574,12 +574,12 @@ OSSL_CMP_MSG *OSSL_CMP_SRV_process_request(OSSL_CMP_SRV_CTX *srv_ctx, (void)ossl_cmp_ctx_set1_recipNonce(ctx, hdr->senderNonce); } + if ((flags & ERR_TXT_STRING) == 0 || *data == '\0') + data = NULL; + reason = ERR_reason_error_string(err); if ((si = OSSL_CMP_STATUSINFO_new(OSSL_CMP_PKISTATUS_rejection, - fail_info, data)) != NULL) { - if (err != 0 && (flags & ERR_TXT_STRING) != 0) - data = ERR_reason_error_string(err); - rsp = ossl_cmp_error_new(srv_ctx->ctx, si, - err != 0 ? ERR_GET_REASON(err) : -1, + fail_info, reason)) != NULL) { + rsp = ossl_cmp_error_new(srv_ctx->ctx, si, err, data, srv_ctx->sendUnprotectedErrors); OSSL_CMP_PKISI_free(si); } |