From: Dr. David von Oheimb Date: Fri, 7 Feb 2025 11:41:33 +0000 (+0100) Subject: OCSP_request_set1_name(): make use of GENERAL_NAME_set1_X509_NAME() X-Git-Tag: 4.0-PRE-CLANG-FORMAT-WEBKIT~156 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=399781ef788b95eb376ecad0427f91cdbdc052bc;p=thirdparty%2Fopenssl.git OCSP_request_set1_name(): make use of GENERAL_NAME_set1_X509_NAME() Reviewed-by: Eugene Syromiatnikov Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/28031) --- diff --git a/crypto/ocsp/ocsp_cl.c b/crypto/ocsp/ocsp_cl.c index c1dda38414f..afb996cb71f 100644 --- a/crypto/ocsp/ocsp_cl.c +++ b/crypto/ocsp/ocsp_cl.c @@ -46,18 +46,7 @@ OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid) /* Set requestorName from an X509_NAME structure */ int OCSP_request_set1_name(OCSP_REQUEST *req, const X509_NAME *nm) { - GENERAL_NAME *gen = GENERAL_NAME_new(); - - if (gen == NULL) - return 0; - if (!X509_NAME_set(&gen->d.directoryName, nm)) { - GENERAL_NAME_free(gen); - return 0; - } - gen->type = GEN_DIRNAME; - GENERAL_NAME_free(req->tbsRequest.requestorName); - req->tbsRequest.requestorName = gen; - return 1; + return GENERAL_NAME_set1_X509_NAME(&req->tbsRequest.requestorName, nm); } /* Add a certificate to an OCSP request */