summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/x509/x509_v3.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/lib/libcrypto/x509/x509_v3.c b/src/lib/libcrypto/x509/x509_v3.c
index 0af2ee3ba2..dcd790abf6 100644
--- a/src/lib/libcrypto/x509/x509_v3.c
+++ b/src/lib/libcrypto/x509/x509_v3.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_v3.c,v 1.40 2024/07/12 09:47:49 tb Exp $ */ 1/* $OpenBSD: x509_v3.c,v 1.41 2024/07/12 09:53:30 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -185,7 +185,7 @@ X509v3_add_ext(STACK_OF(X509_EXTENSION) **out_exts, X509_EXTENSION *ext, int loc
185LCRYPTO_ALIAS(X509v3_add_ext); 185LCRYPTO_ALIAS(X509v3_add_ext);
186 186
187X509_EXTENSION * 187X509_EXTENSION *
188X509_EXTENSION_create_by_NID(X509_EXTENSION **ext, int nid, int critical, 188X509_EXTENSION_create_by_NID(X509_EXTENSION **out_ext, int nid, int critical,
189 ASN1_OCTET_STRING *data) 189 ASN1_OCTET_STRING *data)
190{ 190{
191 const ASN1_OBJECT *obj; 191 const ASN1_OBJECT *obj;
@@ -195,38 +195,38 @@ X509_EXTENSION_create_by_NID(X509_EXTENSION **ext, int nid, int critical,
195 return NULL; 195 return NULL;
196 } 196 }
197 197
198 return X509_EXTENSION_create_by_OBJ(ext, obj, critical, data); 198 return X509_EXTENSION_create_by_OBJ(out_ext, obj, critical, data);
199} 199}
200LCRYPTO_ALIAS(X509_EXTENSION_create_by_NID); 200LCRYPTO_ALIAS(X509_EXTENSION_create_by_NID);
201 201
202X509_EXTENSION * 202X509_EXTENSION *
203X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ext, const ASN1_OBJECT *obj, 203X509_EXTENSION_create_by_OBJ(X509_EXTENSION **out_ext, const ASN1_OBJECT *obj,
204 int critical, ASN1_OCTET_STRING *data) 204 int critical, ASN1_OCTET_STRING *data)
205{ 205{
206 X509_EXTENSION *ret; 206 X509_EXTENSION *ext;
207 207
208 if (ext == NULL || (ret = *ext) == NULL) 208 if (out_ext == NULL || (ext = *out_ext) == NULL)
209 ret = X509_EXTENSION_new(); 209 ext = X509_EXTENSION_new();
210 if (ret == NULL) { 210 if (ext == NULL) {
211 X509error(ERR_R_MALLOC_FAILURE); 211 X509error(ERR_R_MALLOC_FAILURE);
212 goto err; 212 goto err;
213 } 213 }
214 214
215 if (!X509_EXTENSION_set_object(ret, obj)) 215 if (!X509_EXTENSION_set_object(ext, obj))
216 goto err; 216 goto err;
217 if (!X509_EXTENSION_set_critical(ret, critical)) 217 if (!X509_EXTENSION_set_critical(ext, critical))
218 goto err; 218 goto err;
219 if (!X509_EXTENSION_set_data(ret, data)) 219 if (!X509_EXTENSION_set_data(ext, data))
220 goto err; 220 goto err;
221 221
222 if (ext != NULL) 222 if (out_ext != NULL)
223 *ext = ret; 223 *out_ext = ext;
224 224
225 return ret; 225 return ext;
226 226
227 err: 227 err:
228 if (ext == NULL || ret != *ext) 228 if (out_ext == NULL || ext != *out_ext)
229 X509_EXTENSION_free(ret); 229 X509_EXTENSION_free(ext);
230 230
231 return NULL; 231 return NULL;
232} 232}