diff options
author | tb <> | 2023-10-11 13:10:13 +0000 |
---|---|---|
committer | tb <> | 2023-10-11 13:10:13 +0000 |
commit | adc917a287144d58c409d2945fd723f8164f150a (patch) | |
tree | 9d81cc1ec9450a62f23dff16d0c836d05634c1a2 /src/lib | |
parent | efb854ab4bf78936b0cf08b3a4b4c549b541086e (diff) | |
download | openbsd-adc917a287144d58c409d2945fd723f8164f150a.tar.gz openbsd-adc917a287144d58c409d2945fd723f8164f150a.tar.bz2 openbsd-adc917a287144d58c409d2945fd723f8164f150a.zip |
Rewrite X509_ALGOR_get0()
Make the logic slightly less convoluted. Preserve the behavior that
*ppval remains unset if pptype == NULL for now. However, ensure that
*ppval is set to NULL if pptype is V_ASN1_UNDER.
ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/asn1/x_algor.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/lib/libcrypto/asn1/x_algor.c b/src/lib/libcrypto/asn1/x_algor.c index 092ad80d2d..47bde7b97e 100644 --- a/src/lib/libcrypto/asn1/x_algor.c +++ b/src/lib/libcrypto/asn1/x_algor.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x_algor.c,v 1.27 2023/10/11 13:05:18 tb Exp $ */ | 1 | /* $OpenBSD: x_algor.c,v 1.28 2023/10/11 13:10:13 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 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -176,20 +176,26 @@ X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval) | |||
176 | } | 176 | } |
177 | 177 | ||
178 | void | 178 | void |
179 | X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, const void **ppval, | 179 | X509_ALGOR_get0(const ASN1_OBJECT **out_aobj, int *out_type, |
180 | const X509_ALGOR *algor) | 180 | const void **out_value, const X509_ALGOR *alg) |
181 | { | 181 | { |
182 | if (paobj) | 182 | int type = V_ASN1_UNDEF; |
183 | *paobj = algor->algorithm; | 183 | const void *value = NULL; |
184 | if (pptype) { | 184 | |
185 | if (algor->parameter == NULL) { | 185 | if (out_aobj != NULL) |
186 | *pptype = V_ASN1_UNDEF; | 186 | *out_aobj = alg->algorithm; |
187 | return; | 187 | |
188 | } else | 188 | if (out_type == NULL) |
189 | *pptype = algor->parameter->type; | 189 | return; |
190 | if (ppval) | 190 | |
191 | *ppval = algor->parameter->value.ptr; | 191 | if (alg->parameter != NULL) { |
192 | type = alg->parameter->type; | ||
193 | value = alg->parameter->value.ptr; | ||
192 | } | 194 | } |
195 | |||
196 | *out_type = type; | ||
197 | if (out_value != NULL) | ||
198 | *out_value = value; | ||
193 | } | 199 | } |
194 | 200 | ||
195 | int | 201 | int |