From a150f8e1fcc38752fef4d7c75d765d8efc7d46d6 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 4 Nov 2020 16:14:00 +0100 Subject: CRYPTO: refactor ERR_raise()+ERR_add_error_data() to ERR_raise_data() This is not done absolutely everywhere, as there are places where the use of ERR_add_error_data() is quite complex, but at least the simple cases are done. Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/13318) --- crypto/cmp/cmp_msg.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'crypto/cmp/cmp_msg.c') diff --git a/crypto/cmp/cmp_msg.c b/crypto/cmp/cmp_msg.c index eff093c6b5..1a4a873168 100644 --- a/crypto/cmp/cmp_msg.c +++ b/crypto/cmp/cmp_msg.c @@ -888,14 +888,6 @@ static int suitable_rid(const ASN1_INTEGER *certReqId, int rid) return rid == trid; } -static void add_expected_rid(int rid) -{ - char str[DECIMAL_SIZE(rid) + 1]; - - BIO_snprintf(str, sizeof(str), "%d", rid); - ERR_add_error_data(2, "expected certReqId = ", str); -} - /* * returns a pointer to the PollResponse with the given CertReqId * (or the first one in case -1) inside a PollRepContent @@ -917,8 +909,8 @@ ossl_cmp_pollrepcontent_get0_pollrep(const OSSL_CMP_POLLREPCONTENT *prc, return pollRep; } - ERR_raise(ERR_LIB_CMP, CMP_R_CERTRESPONSE_NOT_FOUND); - add_expected_rid(rid); + ERR_raise_data(ERR_LIB_CMP, CMP_R_CERTRESPONSE_NOT_FOUND, + "expected certReqId = %d", rid); return NULL; } @@ -943,8 +935,8 @@ ossl_cmp_certrepmessage_get0_certresponse(const OSSL_CMP_CERTREPMESSAGE *crm, return crep; } - ERR_raise(ERR_LIB_CMP, CMP_R_CERTRESPONSE_NOT_FOUND); - add_expected_rid(rid); + ERR_raise_data(ERR_LIB_CMP, CMP_R_CERTRESPONSE_NOT_FOUND, + "expected certReqId = %d", rid); return NULL; } -- cgit v1.2.3