diff options
author | tb <> | 2023-10-11 12:51:07 +0000 |
---|---|---|
committer | tb <> | 2023-10-11 12:51:07 +0000 |
commit | b8f016436567a0430edd09bef3c36426f8d91387 (patch) | |
tree | 88ac276a79fd03f2c62cb546ad99141c4d3a35a0 /src/lib | |
parent | c325a3d32671c84545aa460fd4fe05bc9139d685 (diff) | |
download | openbsd-b8f016436567a0430edd09bef3c36426f8d91387.tar.gz openbsd-b8f016436567a0430edd09bef3c36426f8d91387.tar.bz2 openbsd-b8f016436567a0430edd09bef3c36426f8d91387.zip |
Clean up X509_ALGOR_cmp()
This is currently written in what is likely the most stupid way possible.
Rewrite this function in a more straightforward way.
ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/asn1/x_algor.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/libcrypto/asn1/x_algor.c b/src/lib/libcrypto/asn1/x_algor.c index 0f1cd9cb65..a638337939 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.25 2023/07/07 19:37:52 beck Exp $ */ | 1 | /* $OpenBSD: x_algor.c,v 1.26 2023/10/11 12:51:07 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 | */ |
@@ -205,16 +205,16 @@ X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md) | |||
205 | X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL); | 205 | X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL); |
206 | } | 206 | } |
207 | 207 | ||
208 | /* Returns 0 if they are equal, != 0 otherwise. */ | ||
209 | int | 208 | int |
210 | X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b) | 209 | X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b) |
211 | { | 210 | { |
212 | int rv = OBJ_cmp(a->algorithm, b->algorithm); | 211 | int cmp; |
213 | if (!rv) { | 212 | |
214 | if (!a->parameter && !b->parameter) | 213 | if ((cmp = OBJ_cmp(a->algorithm, b->algorithm)) != 0) |
215 | rv = 0; | 214 | return cmp; |
216 | else | 215 | |
217 | rv = ASN1_TYPE_cmp(a->parameter, b->parameter); | 216 | if (a->parameter == NULL && b->parameter == NULL) |
218 | } | 217 | return 0; |
219 | return(rv); | 218 | |
219 | return ASN1_TYPE_cmp(a->parameter, b->parameter); | ||
220 | } | 220 | } |