summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/cms/cms_lib.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/libcrypto/cms/cms_lib.c b/src/lib/libcrypto/cms/cms_lib.c
index fc899437ab..950d8764ad 100644
--- a/src/lib/libcrypto/cms/cms_lib.c
+++ b/src/lib/libcrypto/cms/cms_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_lib.c,v 1.21 2023/08/22 08:59:44 tb Exp $ */ 1/* $OpenBSD: cms_lib.c,v 1.22 2023/08/24 04:46:56 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -142,34 +142,34 @@ cms_content_bio(CMS_ContentInfo *cms)
142} 142}
143 143
144BIO * 144BIO *
145CMS_dataInit(CMS_ContentInfo *cms, BIO *icont) 145CMS_dataInit(CMS_ContentInfo *cms, BIO *in_content_bio)
146{ 146{
147 BIO *cmsbio = NULL, *cont = NULL; 147 BIO *cms_bio = NULL, *content_bio = NULL;
148 148
149 if ((cont = icont) == NULL) 149 if ((content_bio = in_content_bio) == NULL)
150 cont = cms_content_bio(cms); 150 content_bio = cms_content_bio(cms);
151 if (cont == NULL) { 151 if (content_bio == NULL) {
152 CMSerror(CMS_R_NO_CONTENT); 152 CMSerror(CMS_R_NO_CONTENT);
153 goto err; 153 goto err;
154 } 154 }
155 155
156 switch (OBJ_obj2nid(cms->contentType)) { 156 switch (OBJ_obj2nid(cms->contentType)) {
157 case NID_pkcs7_data: 157 case NID_pkcs7_data:
158 return cont; 158 return content_bio;
159 case NID_pkcs7_signed: 159 case NID_pkcs7_signed:
160 if ((cmsbio = cms_SignedData_init_bio(cms)) == NULL) 160 if ((cms_bio = cms_SignedData_init_bio(cms)) == NULL)
161 goto err; 161 goto err;
162 break; 162 break;
163 case NID_pkcs7_digest: 163 case NID_pkcs7_digest:
164 if ((cmsbio = cms_DigestedData_init_bio(cms)) == NULL) 164 if ((cms_bio = cms_DigestedData_init_bio(cms)) == NULL)
165 goto err; 165 goto err;
166 break; 166 break;
167 case NID_pkcs7_encrypted: 167 case NID_pkcs7_encrypted:
168 if ((cmsbio = cms_EncryptedData_init_bio(cms)) == NULL) 168 if ((cms_bio = cms_EncryptedData_init_bio(cms)) == NULL)
169 goto err; 169 goto err;
170 break; 170 break;
171 case NID_pkcs7_enveloped: 171 case NID_pkcs7_enveloped:
172 if ((cmsbio = cms_EnvelopedData_init_bio(cms)) == NULL) 172 if ((cms_bio = cms_EnvelopedData_init_bio(cms)) == NULL)
173 goto err; 173 goto err;
174 break; 174 break;
175 default: 175 default:
@@ -177,11 +177,11 @@ CMS_dataInit(CMS_ContentInfo *cms, BIO *icont)
177 goto err; 177 goto err;
178 } 178 }
179 179
180 return BIO_push(cmsbio, cont); 180 return BIO_push(cms_bio, content_bio);
181 181
182 err: 182 err:
183 if (cont != icont) 183 if (content_bio != in_content_bio)
184 BIO_free(cont); 184 BIO_free(content_bio);
185 185
186 return NULL; 186 return NULL;
187} 187}