summaryrefslogtreecommitdiff
path: root/lib/libcrypto/x509v3
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2017-01-21 04:42:17 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2017-01-21 04:42:17 +0000
commit23541b2dc7a2e80622c5f1653977701f43676e69 (patch)
tree95399ce293113e503b9765d817a1341f7b5efb74 /lib/libcrypto/x509v3
parent4f959a66d7464751d4fb934f9572519a61f1121e (diff)
Expand DECLARE_OBJ_BSEARCH_CMP_FN and IMPLEMENT_OBJ_BSEARCH_CMP_FN macros.
No change to generated assembly excluding line numbers.
Diffstat (limited to 'lib/libcrypto/x509v3')
-rw-r--r--lib/libcrypto/x509v3/v3_lib.c24
-rw-r--r--lib/libcrypto/x509v3/v3_purp.c22
2 files changed, 38 insertions, 8 deletions
diff --git a/lib/libcrypto/x509v3/v3_lib.c b/lib/libcrypto/x509v3/v3_lib.c
index 2e92747d437..946ef1d54e9 100644
--- a/lib/libcrypto/x509v3/v3_lib.c
+++ b/lib/libcrypto/x509v3/v3_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: v3_lib.c,v 1.15 2016/12/30 15:54:49 jsing Exp $ */
+/* $OpenBSD: v3_lib.c,v 1.16 2017/01/21 04:42:16 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
@@ -91,10 +91,24 @@ ext_cmp(const X509V3_EXT_METHOD * const *a, const X509V3_EXT_METHOD * const *b)
return ((*a)->ext_nid - (*b)->ext_nid);
}
-DECLARE_OBJ_BSEARCH_CMP_FN(const X509V3_EXT_METHOD *,
- const X509V3_EXT_METHOD *, ext);
-IMPLEMENT_OBJ_BSEARCH_CMP_FN(const X509V3_EXT_METHOD *,
- const X509V3_EXT_METHOD *, ext);
+static int ext_cmp_BSEARCH_CMP_FN(const void *, const void *);
+static int ext_cmp(const X509V3_EXT_METHOD * const *, const X509V3_EXT_METHOD * const *);
+static const X509V3_EXT_METHOD * *OBJ_bsearch_ext(const X509V3_EXT_METHOD * *key, const X509V3_EXT_METHOD * const *base, int num);
+
+static int
+ext_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)
+{
+ const X509V3_EXT_METHOD * const *a = a_;
+ const X509V3_EXT_METHOD * const *b = b_;
+ return ext_cmp(a, b);
+}
+
+static const X509V3_EXT_METHOD * *
+OBJ_bsearch_ext(const X509V3_EXT_METHOD * *key, const X509V3_EXT_METHOD * const *base, int num)
+{
+ return (const X509V3_EXT_METHOD * *)OBJ_bsearch_(key, base, num, sizeof(const X509V3_EXT_METHOD *),
+ ext_cmp_BSEARCH_CMP_FN);
+}
const X509V3_EXT_METHOD *
X509V3_EXT_get_nid(int nid)
diff --git a/lib/libcrypto/x509v3/v3_purp.c b/lib/libcrypto/x509v3/v3_purp.c
index a091a7f425b..d8ab6793049 100644
--- a/lib/libcrypto/x509v3/v3_purp.c
+++ b/lib/libcrypto/x509v3/v3_purp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: v3_purp.c,v 1.27 2016/11/08 20:01:06 miod Exp $ */
+/* $OpenBSD: v3_purp.c,v 1.28 2017/01/21 04:42:16 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2001.
*/
@@ -325,8 +325,24 @@ nid_cmp(const int *a, const int *b)
return *a - *b;
}
-DECLARE_OBJ_BSEARCH_CMP_FN(int, int, nid);
-IMPLEMENT_OBJ_BSEARCH_CMP_FN(int, int, nid);
+static int nid_cmp_BSEARCH_CMP_FN(const void *, const void *);
+static int nid_cmp(int const *, int const *);
+static int *OBJ_bsearch_nid(int *key, int const *base, int num);
+
+static int
+nid_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)
+{
+ int const *a = a_;
+ int const *b = b_;
+ return nid_cmp(a, b);
+}
+
+static int *
+OBJ_bsearch_nid(int *key, int const *base, int num)
+{
+ return (int *)OBJ_bsearch_(key, base, num, sizeof(int),
+ nid_cmp_BSEARCH_CMP_FN);
+}
int
X509_supported_extension(X509_EXTENSION *ex)