diff options
author | tb <> | 2024-05-09 14:00:52 +0000 |
---|---|---|
committer | tb <> | 2024-05-09 14:00:52 +0000 |
commit | f2cb6d2279c2ba87b60ec55e26300f3ad60fb532 (patch) | |
tree | c5542ebf67525533b0b86f826e3f654022e9d6cf /src | |
parent | 695cc72a374d931d52dbfd31e18102acae2969cf (diff) | |
download | openbsd-f2cb6d2279c2ba87b60ec55e26300f3ad60fb532.tar.gz openbsd-f2cb6d2279c2ba87b60ec55e26300f3ad60fb532.tar.bz2 openbsd-f2cb6d2279c2ba87b60ec55e26300f3ad60fb532.zip |
Further simplify X509_REQ_get_extensions()
Instead of inlining a poor version of ASN1_TYPE_unpack_sequence() with
missing error checks, just call the real thing. It's safer and simpler.
ok jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/x509/x509_req.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lib/libcrypto/x509/x509_req.c b/src/lib/libcrypto/x509/x509_req.c index 34e052341d..4e30b04d25 100644 --- a/src/lib/libcrypto/x509/x509_req.c +++ b/src/lib/libcrypto/x509/x509_req.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_req.c,v 1.36 2024/05/08 08:20:08 tb Exp $ */ | 1 | /* $OpenBSD: x509_req.c,v 1.37 2024/05/09 14:00:52 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -70,6 +70,7 @@ | |||
70 | #include <openssl/pem.h> | 70 | #include <openssl/pem.h> |
71 | #include <openssl/x509.h> | 71 | #include <openssl/x509.h> |
72 | 72 | ||
73 | #include "asn1_local.h" | ||
73 | #include "evp_local.h" | 74 | #include "evp_local.h" |
74 | #include "x509_local.h" | 75 | #include "x509_local.h" |
75 | 76 | ||
@@ -183,7 +184,6 @@ X509_REQ_get_extensions(X509_REQ *req) | |||
183 | X509_ATTRIBUTE *attr; | 184 | X509_ATTRIBUTE *attr; |
184 | ASN1_TYPE *ext = NULL; | 185 | ASN1_TYPE *ext = NULL; |
185 | int idx; | 186 | int idx; |
186 | const unsigned char *p; | ||
187 | 187 | ||
188 | if (req == NULL || req->req_info == NULL) | 188 | if (req == NULL || req->req_info == NULL) |
189 | return NULL; | 189 | return NULL; |
@@ -197,10 +197,8 @@ X509_REQ_get_extensions(X509_REQ *req) | |||
197 | return NULL; | 197 | return NULL; |
198 | if ((ext = X509_ATTRIBUTE_get0_type(attr, 0)) == NULL) | 198 | if ((ext = X509_ATTRIBUTE_get0_type(attr, 0)) == NULL) |
199 | return NULL; | 199 | return NULL; |
200 | if (ext->type != V_ASN1_SEQUENCE) | 200 | |
201 | return NULL; | 201 | return ASN1_TYPE_unpack_sequence(&X509_EXTENSIONS_it, ext); |
202 | p = ext->value.sequence->data; | ||
203 | return d2i_X509_EXTENSIONS(NULL, &p, ext->value.sequence->length); | ||
204 | } | 202 | } |
205 | LCRYPTO_ALIAS(X509_REQ_get_extensions); | 203 | LCRYPTO_ALIAS(X509_REQ_get_extensions); |
206 | 204 | ||