From 399781ef788b95eb376ecad0427f91cdbdc052bc Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Fri, 7 Feb 2025 12:41:33 +0100 Subject: [PATCH] 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) --- crypto/ocsp/ocsp_cl.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) 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 */ -- 2.47.3