diff options
| author | tb <> | 2025-03-12 04:58:04 +0000 |
|---|---|---|
| committer | tb <> | 2025-03-12 04:58:04 +0000 |
| commit | 2bdb35b17f474043d28be95bab3d97edbb2f6a69 (patch) | |
| tree | f16957cacb37b935964dead1a0ff724010334715 /src | |
| parent | 79936a29bfab883b3a2c4bf6a894da19b7c1aa00 (diff) | |
| download | openbsd-2bdb35b17f474043d28be95bab3d97edbb2f6a69.tar.gz openbsd-2bdb35b17f474043d28be95bab3d97edbb2f6a69.tar.bz2 openbsd-2bdb35b17f474043d28be95bab3d97edbb2f6a69.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.c | 29 |
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 | |||
| 667 | X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param) | 667 | X509_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 | } |
| 690 | LCRYPTO_ALIAS(X509_VERIFY_PARAM_add0_table); | 685 | LCRYPTO_ALIAS(X509_VERIFY_PARAM_add0_table); |
| 691 | 686 | ||
