summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2017-01-21 04:38:24 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2017-01-21 04:38:24 +0000
commit4f959a66d7464751d4fb934f9572519a61f1121e (patch)
treeece0a4852ea5efc1aaf374e444f2c84a7a880354 /lib
parent240c690f745d8980cf6ae1ee9475f68c271d963c (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')
-rw-r--r--lib/libcrypto/evp/evp_pbe.c22
-rw-r--r--lib/libcrypto/evp/pmeth_lib.c24
2 files changed, 38 insertions, 8 deletions
diff --git a/lib/libcrypto/evp/evp_pbe.c b/lib/libcrypto/evp/evp_pbe.c
index 0787e2dc942..c7f0c7749a8 100644
--- a/lib/libcrypto/evp/evp_pbe.c
+++ b/lib/libcrypto/evp/evp_pbe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: evp_pbe.c,v 1.23 2015/02/08 22:20:18 miod Exp $ */
+/* $OpenBSD: evp_pbe.c,v 1.24 2017/01/21 04:38:23 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
@@ -169,7 +169,9 @@ EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
return 1;
}
-DECLARE_OBJ_BSEARCH_CMP_FN(EVP_PBE_CTL, EVP_PBE_CTL, pbe2);
+static int pbe2_cmp_BSEARCH_CMP_FN(const void *, const void *);
+static int pbe2_cmp(EVP_PBE_CTL const *, EVP_PBE_CTL const *);
+static EVP_PBE_CTL *OBJ_bsearch_pbe2(EVP_PBE_CTL *key, EVP_PBE_CTL const *base, int num);
static int
pbe2_cmp(const EVP_PBE_CTL *pbe1, const EVP_PBE_CTL *pbe2)
@@ -182,7 +184,21 @@ pbe2_cmp(const EVP_PBE_CTL *pbe1, const EVP_PBE_CTL *pbe2)
return pbe1->pbe_nid - pbe2->pbe_nid;
}
-IMPLEMENT_OBJ_BSEARCH_CMP_FN(EVP_PBE_CTL, EVP_PBE_CTL, pbe2);
+
+static int
+pbe2_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)
+{
+ EVP_PBE_CTL const *a = a_;
+ EVP_PBE_CTL const *b = b_;
+ return pbe2_cmp(a, b);
+}
+
+static EVP_PBE_CTL *
+OBJ_bsearch_pbe2(EVP_PBE_CTL *key, EVP_PBE_CTL const *base, int num)
+{
+ return (EVP_PBE_CTL *)OBJ_bsearch_(key, base, num, sizeof(EVP_PBE_CTL),
+ pbe2_cmp_BSEARCH_CMP_FN);
+}
static int
pbe_cmp(const EVP_PBE_CTL * const *a, const EVP_PBE_CTL * const *b)
diff --git a/lib/libcrypto/evp/pmeth_lib.c b/lib/libcrypto/evp/pmeth_lib.c
index c93fa99cc67..1d64edcbeb0 100644
--- a/lib/libcrypto/evp/pmeth_lib.c
+++ b/lib/libcrypto/evp/pmeth_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmeth_lib.c,v 1.11 2015/02/11 03:19:37 doug Exp $ */
+/* $OpenBSD: pmeth_lib.c,v 1.12 2017/01/21 04:38:23 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
@@ -103,8 +103,9 @@ static const EVP_PKEY_METHOD *standard_methods[] = {
&cmac_pkey_meth,
};
-DECLARE_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_METHOD *, const EVP_PKEY_METHOD *,
- pmeth);
+static int pmeth_cmp_BSEARCH_CMP_FN(const void *, const void *);
+static int pmeth_cmp(const EVP_PKEY_METHOD * const *, const EVP_PKEY_METHOD * const *);
+static const EVP_PKEY_METHOD * *OBJ_bsearch_pmeth(const EVP_PKEY_METHOD * *key, const EVP_PKEY_METHOD * const *base, int num);
static int
pmeth_cmp(const EVP_PKEY_METHOD * const *a, const EVP_PKEY_METHOD * const *b)
@@ -112,8 +113,21 @@ pmeth_cmp(const EVP_PKEY_METHOD * const *a, const EVP_PKEY_METHOD * const *b)
return ((*a)->pkey_id - (*b)->pkey_id);
}
-IMPLEMENT_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_METHOD *, const EVP_PKEY_METHOD *,
- pmeth);
+
+static int
+pmeth_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)
+{
+ const EVP_PKEY_METHOD * const *a = a_;
+ const EVP_PKEY_METHOD * const *b = b_;
+ return pmeth_cmp(a, b);
+}
+
+static const EVP_PKEY_METHOD * *
+OBJ_bsearch_pmeth(const EVP_PKEY_METHOD * *key, const EVP_PKEY_METHOD * const *base, int num)
+{
+ return (const EVP_PKEY_METHOD * *)OBJ_bsearch_(key, base, num, sizeof(const EVP_PKEY_METHOD *),
+ pmeth_cmp_BSEARCH_CMP_FN);
+}
const EVP_PKEY_METHOD *
EVP_PKEY_meth_find(int type)