summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2025-03-12 04:58:04 +0000
committertb <>2025-03-12 04:58:04 +0000
commit9cd560ffc854f5c4f8c45e0620cb7d6f84f80c98 (patch)
treef16957cacb37b935964dead1a0ff724010334715 /src
parent8f3ecc2dc9481b389927abcfb38cd6456eb5cfb2 (diff)
downloadopenbsd-9cd560ffc854f5c4f8c45e0620cb7d6f84f80c98.tar.gz
openbsd-9cd560ffc854f5c4f8c45e0620cb7d6f84f80c98.tar.bz2
openbsd-9cd560ffc854f5c4f8c45e0620cb7d6f84f80c98.zip
Streamline X509_VERIFY_PARAM_add0_table()
Unindent, use correct type for idx (int rather than size_t) and make this mess a bit more pleasant on the eyes. ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/x509/x509_vpm.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/lib/libcrypto/x509/x509_vpm.c b/src/lib/libcrypto/x509/x509_vpm.c
index 056b691ddd..4b333e2a2d 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.46 2025/03/12 04:56:26 tb Exp $ */ 1/* $OpenBSD: x509_vpm.c,v 1.47 2025/03/12 04:58:04 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 */
@@ -667,25 +667,20 @@ int
667X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param) 667X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param)
668{ 668{
669 X509_VERIFY_PARAM *ptmp; 669 X509_VERIFY_PARAM *ptmp;
670 if (!param_table) { 670 int idx;
671
672 if (param_table == NULL)
671 param_table = sk_X509_VERIFY_PARAM_new(param_cmp); 673 param_table = sk_X509_VERIFY_PARAM_new(param_cmp);
672 if (!param_table) 674 if (param_table == NULL)
673 return 0; 675 return 0;
674 } else {
675 size_t idx;
676 676
677 if ((idx = sk_X509_VERIFY_PARAM_find(param_table, param)) 677 if ((idx = sk_X509_VERIFY_PARAM_find(param_table, param)) != -1) {
678 != -1) { 678 ptmp = sk_X509_VERIFY_PARAM_value(param_table, idx);
679 ptmp = sk_X509_VERIFY_PARAM_value(param_table, 679 X509_VERIFY_PARAM_free(ptmp);
680 idx); 680 (void)sk_X509_VERIFY_PARAM_delete(param_table, idx);
681 X509_VERIFY_PARAM_free(ptmp);
682 (void)sk_X509_VERIFY_PARAM_delete(param_table,
683 idx);
684 }
685 } 681 }
686 if (!sk_X509_VERIFY_PARAM_push(param_table, param)) 682
687 return 0; 683 return sk_X509_VERIFY_PARAM_push(param_table, param) > 0;
688 return 1;
689} 684}
690LCRYPTO_ALIAS(X509_VERIFY_PARAM_add0_table); 685LCRYPTO_ALIAS(X509_VERIFY_PARAM_add0_table);
691 686