summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2024-05-08 08:11:50 +0000
committertb <>2024-05-08 08:11:50 +0000
commitffb8206b50bbd81b1f29efa652218fd949b207af (patch)
tree8a9114118086b9d646a0f7cd046b4813d185edb8
parentfc935a7616256a5e82a1e3222a2e865967069c45 (diff)
downloadopenbsd-ffb8206b50bbd81b1f29efa652218fd949b207af.tar.gz
openbsd-ffb8206b50bbd81b1f29efa652218fd949b207af.tar.bz2
openbsd-ffb8206b50bbd81b1f29efa652218fd949b207af.zip
Simplify X509_REQ_extension_nid()
Now that the global ext_nids[] array can no longer be modified by the application, we can simplify this by returning the two possible NIDs that we accept in the extension list attribute in PKCS#10 certification requests. The year is 2024. This API is entirely unused by the ecosystem. Well not entirely! One small village of indomitable rare API use still holds out against the cleansers. You may have guessed it: security/xca. ok jsing
-rw-r--r--src/lib/libcrypto/x509/x509_req.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/lib/libcrypto/x509/x509_req.c b/src/lib/libcrypto/x509/x509_req.c
index 60e1a074b8..1497b1ec16 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.34 2024/05/08 07:55:10 tb Exp $ */ 1/* $OpenBSD: x509_req.c,v 1.35 2024/05/08 08:11:50 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 *
@@ -180,17 +180,9 @@ static int ext_nid_list[] = {NID_ext_req, NID_ms_ext_req, NID_undef};
180static int *ext_nids = ext_nid_list; 180static int *ext_nids = ext_nid_list;
181 181
182int 182int
183X509_REQ_extension_nid(int req_nid) 183X509_REQ_extension_nid(int nid)
184{ 184{
185 int i, nid; 185 return nid == NID_ext_req || nid == NID_ms_ext_req;
186
187 for (i = 0; ; i++) {
188 nid = ext_nids[i];
189 if (nid == NID_undef)
190 return 0;
191 else if (req_nid == nid)
192 return 1;
193 }
194} 186}
195LCRYPTO_ALIAS(X509_REQ_extension_nid); 187LCRYPTO_ALIAS(X509_REQ_extension_nid);
196 188