summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2024-03-29 04:45:15 +0000
committertb <>2024-03-29 04:45:15 +0000
commitfb26968c651f68c0d0e9f86683d69aa87c8976de (patch)
tree1d8d6baff9dd229b59bde022b484a59ac72e3ec0
parent2c1a87a439933e428607afc0c18d4d12070ae246 (diff)
downloadopenbsd-fb26968c651f68c0d0e9f86683d69aa87c8976de.tar.gz
openbsd-fb26968c651f68c0d0e9f86683d69aa87c8976de.tar.bz2
openbsd-fb26968c651f68c0d0e9f86683d69aa87c8976de.zip
Clean up X509_VERIFY_PARAM_add0_policy()
Streamline some checks and use more idiomatic sk_push() error check ok jsing
-rw-r--r--src/lib/libcrypto/x509/x509_vpm.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/libcrypto/x509/x509_vpm.c b/src/lib/libcrypto/x509/x509_vpm.c
index 674c8e445c..62d9215b4c 100644
--- a/src/lib/libcrypto/x509/x509_vpm.c
+++ b/src/lib/libcrypto/x509/x509_vpm.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_vpm.c,v 1.43 2024/03/29 00:25:32 tb Exp $ */ 1/* $OpenBSD: x509_vpm.c,v 1.44 2024/03/29 04:45:15 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2004. 3 * project 2004.
4 */ 4 */
@@ -464,12 +464,11 @@ LCRYPTO_ALIAS(X509_VERIFY_PARAM_set_time);
464int 464int
465X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, ASN1_OBJECT *policy) 465X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, ASN1_OBJECT *policy)
466{ 466{
467 if (!param->policies) { 467 if (param->policies == NULL)
468 param->policies = sk_ASN1_OBJECT_new_null(); 468 param->policies = sk_ASN1_OBJECT_new_null();
469 if (!param->policies) 469 if (param->policies == NULL)
470 return 0; 470 return 0;
471 } 471 if (sk_ASN1_OBJECT_push(param->policies, policy) <= 0)
472 if (!sk_ASN1_OBJECT_push(param->policies, policy))
473 return 0; 472 return 0;
474 return 1; 473 return 1;
475} 474}