summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2024-05-16 13:19:09 +0000
committertb <>2024-05-16 13:19:09 +0000
commitdffa27fa6b9c52bcb4754b67b06f22d989ef6ed4 (patch)
tree05222a5ac111a0d7e2510134802672ecc8b6f952
parent8643b72edadf73f2e20a30457ebf4c85b67d7b52 (diff)
downloadopenbsd-dffa27fa6b9c52bcb4754b67b06f22d989ef6ed4.tar.gz
openbsd-dffa27fa6b9c52bcb4754b67b06f22d989ef6ed4.tar.bz2
openbsd-dffa27fa6b9c52bcb4754b67b06f22d989ef6ed4.zip
x509_v3.c: remove superfluous parentheses
No change in the generated assembly
-rw-r--r--src/lib/libcrypto/x509/x509_v3.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/lib/libcrypto/x509/x509_v3.c b/src/lib/libcrypto/x509/x509_v3.c
index 8dddb463ce..3dee31e195 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.21 2023/02/16 08:38:17 tb Exp $ */ 1/* $OpenBSD: x509_v3.c,v 1.22 2024/05/16 13:19:09 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 *
@@ -72,8 +72,8 @@ int
72X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x) 72X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x)
73{ 73{
74 if (x == NULL) 74 if (x == NULL)
75 return (0); 75 return 0;
76 return (sk_X509_EXTENSION_num(x)); 76 return sk_X509_EXTENSION_num(x);
77} 77}
78LCRYPTO_ALIAS(X509v3_get_ext_count); 78LCRYPTO_ALIAS(X509v3_get_ext_count);
79 79
@@ -84,8 +84,8 @@ X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, int nid, int lastpos)
84 84
85 obj = OBJ_nid2obj(nid); 85 obj = OBJ_nid2obj(nid);
86 if (obj == NULL) 86 if (obj == NULL)
87 return (-2); 87 return -2;
88 return (X509v3_get_ext_by_OBJ(x, obj, lastpos)); 88 return X509v3_get_ext_by_OBJ(x, obj, lastpos);
89} 89}
90LCRYPTO_ALIAS(X509v3_get_ext_by_NID); 90LCRYPTO_ALIAS(X509v3_get_ext_by_NID);
91 91
@@ -97,7 +97,7 @@ X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *sk,
97 X509_EXTENSION *ex; 97 X509_EXTENSION *ex;
98 98
99 if (sk == NULL) 99 if (sk == NULL)
100 return (-1); 100 return -1;
101 lastpos++; 101 lastpos++;
102 if (lastpos < 0) 102 if (lastpos < 0)
103 lastpos = 0; 103 lastpos = 0;
@@ -105,9 +105,9 @@ X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *sk,
105 for (; lastpos < n; lastpos++) { 105 for (; lastpos < n; lastpos++) {
106 ex = sk_X509_EXTENSION_value(sk, lastpos); 106 ex = sk_X509_EXTENSION_value(sk, lastpos);
107 if (OBJ_cmp(ex->object, obj) == 0) 107 if (OBJ_cmp(ex->object, obj) == 0)
108 return (lastpos); 108 return lastpos;
109 } 109 }
110 return (-1); 110 return -1;
111} 111}
112LCRYPTO_ALIAS(X509v3_get_ext_by_OBJ); 112LCRYPTO_ALIAS(X509v3_get_ext_by_OBJ);
113 113
@@ -119,18 +119,18 @@ X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *sk, int crit,
119 X509_EXTENSION *ex; 119 X509_EXTENSION *ex;
120 120
121 if (sk == NULL) 121 if (sk == NULL)
122 return (-1); 122 return -1;
123 lastpos++; 123 lastpos++;
124 if (lastpos < 0) 124 if (lastpos < 0)
125 lastpos = 0; 125 lastpos = 0;
126 n = sk_X509_EXTENSION_num(sk); 126 n = sk_X509_EXTENSION_num(sk);
127 for (; lastpos < n; lastpos++) { 127 for (; lastpos < n; lastpos++) {
128 ex = sk_X509_EXTENSION_value(sk, lastpos); 128 ex = sk_X509_EXTENSION_value(sk, lastpos);
129 if (((ex->critical > 0) && crit) || 129 if ((ex->critical > 0 && crit) ||
130 ((ex->critical <= 0) && !crit)) 130 (ex->critical <= 0 && !crit))
131 return (lastpos); 131 return lastpos;
132 } 132 }
133 return (-1); 133 return -1;
134} 134}
135LCRYPTO_ALIAS(X509v3_get_ext_by_critical); 135LCRYPTO_ALIAS(X509v3_get_ext_by_critical);
136 136
@@ -150,9 +150,9 @@ X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc)
150 X509_EXTENSION *ret; 150 X509_EXTENSION *ret;
151 151
152 if (x == NULL || sk_X509_EXTENSION_num(x) <= loc || loc < 0) 152 if (x == NULL || sk_X509_EXTENSION_num(x) <= loc || loc < 0)
153 return (NULL); 153 return NULL;
154 ret = sk_X509_EXTENSION_delete(x, loc); 154 ret = sk_X509_EXTENSION_delete(x, loc);
155 return (ret); 155 return ret;
156} 156}
157LCRYPTO_ALIAS(X509v3_delete_ext); 157LCRYPTO_ALIAS(X509v3_delete_ext);
158 158
@@ -186,16 +186,16 @@ X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, X509_EXTENSION *ex, int loc)
186 goto err; 186 goto err;
187 if (*x == NULL) 187 if (*x == NULL)
188 *x = sk; 188 *x = sk;
189 return (sk); 189 return sk;
190 190
191err: 191err:
192 X509error(ERR_R_MALLOC_FAILURE); 192 X509error(ERR_R_MALLOC_FAILURE);
193err2: 193err2:
194 if (new_ex != NULL) 194 if (new_ex != NULL)
195 X509_EXTENSION_free(new_ex); 195 X509_EXTENSION_free(new_ex);
196 if (sk != NULL && (x != NULL && sk != *x)) 196 if (sk != NULL && x != NULL && sk != *x)
197 sk_X509_EXTENSION_free(sk); 197 sk_X509_EXTENSION_free(sk);
198 return (NULL); 198 return NULL;
199} 199}
200LCRYPTO_ALIAS(X509v3_add_ext); 200LCRYPTO_ALIAS(X509v3_add_ext);
201 201
@@ -209,12 +209,12 @@ X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, int nid, int crit,
209 obj = OBJ_nid2obj(nid); 209 obj = OBJ_nid2obj(nid);
210 if (obj == NULL) { 210 if (obj == NULL) {
211 X509error(X509_R_UNKNOWN_NID); 211 X509error(X509_R_UNKNOWN_NID);
212 return (NULL); 212 return NULL;
213 } 213 }
214 ret = X509_EXTENSION_create_by_OBJ(ex, obj, crit, data); 214 ret = X509_EXTENSION_create_by_OBJ(ex, obj, crit, data);
215 if (ret == NULL) 215 if (ret == NULL)
216 ASN1_OBJECT_free(obj); 216 ASN1_OBJECT_free(obj);
217 return (ret); 217 return ret;
218} 218}
219LCRYPTO_ALIAS(X509_EXTENSION_create_by_NID); 219LCRYPTO_ALIAS(X509_EXTENSION_create_by_NID);
220 220
@@ -224,10 +224,10 @@ X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, const ASN1_OBJECT *obj,
224{ 224{
225 X509_EXTENSION *ret; 225 X509_EXTENSION *ret;
226 226
227 if ((ex == NULL) || (*ex == NULL)) { 227 if (ex == NULL || *ex == NULL) {
228 if ((ret = X509_EXTENSION_new()) == NULL) { 228 if ((ret = X509_EXTENSION_new()) == NULL) {
229 X509error(ERR_R_MALLOC_FAILURE); 229 X509error(ERR_R_MALLOC_FAILURE);
230 return (NULL); 230 return NULL;
231 } 231 }
232 } else 232 } else
233 ret= *ex; 233 ret= *ex;
@@ -239,22 +239,22 @@ X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, const ASN1_OBJECT *obj,
239 if (!X509_EXTENSION_set_data(ret, data)) 239 if (!X509_EXTENSION_set_data(ret, data))
240 goto err; 240 goto err;
241 241
242 if ((ex != NULL) && (*ex == NULL)) 242 if (ex != NULL && *ex == NULL)
243 *ex = ret; 243 *ex = ret;
244 return (ret); 244 return ret;
245 245
246err: 246err:
247 if ((ex == NULL) || (ret != *ex)) 247 if (ex == NULL || ret != *ex)
248 X509_EXTENSION_free(ret); 248 X509_EXTENSION_free(ret);
249 return (NULL); 249 return NULL;
250} 250}
251LCRYPTO_ALIAS(X509_EXTENSION_create_by_OBJ); 251LCRYPTO_ALIAS(X509_EXTENSION_create_by_OBJ);
252 252
253int 253int
254X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj) 254X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj)
255{ 255{
256 if ((ex == NULL) || (obj == NULL)) 256 if (ex == NULL || obj == NULL)
257 return (0); 257 return 0;
258 ASN1_OBJECT_free(ex->object); 258 ASN1_OBJECT_free(ex->object);
259 ex->object = OBJ_dup(obj); 259 ex->object = OBJ_dup(obj);
260 return ex->object != NULL; 260 return ex->object != NULL;
@@ -265,9 +265,9 @@ int
265X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit) 265X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit)
266{ 266{
267 if (ex == NULL) 267 if (ex == NULL)
268 return (0); 268 return 0;
269 ex->critical = (crit) ? 0xFF : -1; 269 ex->critical = crit ? 0xFF : -1;
270 return (1); 270 return 1;
271} 271}
272LCRYPTO_ALIAS(X509_EXTENSION_set_critical); 272LCRYPTO_ALIAS(X509_EXTENSION_set_critical);
273 273
@@ -277,11 +277,11 @@ X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data)
277 int i; 277 int i;
278 278
279 if (ex == NULL) 279 if (ex == NULL)
280 return (0); 280 return 0;
281 i = ASN1_STRING_set(ex->value, data->data, data->length); 281 i = ASN1_STRING_set(ex->value, data->data, data->length);
282 if (!i) 282 if (!i)
283 return (0); 283 return 0;
284 return (1); 284 return 1;
285} 285}
286LCRYPTO_ALIAS(X509_EXTENSION_set_data); 286LCRYPTO_ALIAS(X509_EXTENSION_set_data);
287 287
@@ -289,8 +289,8 @@ ASN1_OBJECT *
289X509_EXTENSION_get_object(X509_EXTENSION *ex) 289X509_EXTENSION_get_object(X509_EXTENSION *ex)
290{ 290{
291 if (ex == NULL) 291 if (ex == NULL)
292 return (NULL); 292 return NULL;
293 return (ex->object); 293 return ex->object;
294} 294}
295LCRYPTO_ALIAS(X509_EXTENSION_get_object); 295LCRYPTO_ALIAS(X509_EXTENSION_get_object);
296 296
@@ -298,8 +298,8 @@ ASN1_OCTET_STRING *
298X509_EXTENSION_get_data(X509_EXTENSION *ex) 298X509_EXTENSION_get_data(X509_EXTENSION *ex)
299{ 299{
300 if (ex == NULL) 300 if (ex == NULL)
301 return (NULL); 301 return NULL;
302 return (ex->value); 302 return ex->value;
303} 303}
304LCRYPTO_ALIAS(X509_EXTENSION_get_data); 304LCRYPTO_ALIAS(X509_EXTENSION_get_data);
305 305
@@ -307,7 +307,7 @@ int
307X509_EXTENSION_get_critical(const X509_EXTENSION *ex) 307X509_EXTENSION_get_critical(const X509_EXTENSION *ex)
308{ 308{
309 if (ex == NULL) 309 if (ex == NULL)
310 return (0); 310 return 0;
311 if (ex->critical > 0) 311 if (ex->critical > 0)
312 return 1; 312 return 1;
313 return 0; 313 return 0;