diff options
author | jsing <> | 2017-01-21 04:44:43 +0000 |
---|---|---|
committer | jsing <> | 2017-01-21 04:44:43 +0000 |
commit | cf9904a4b13d79f0e11e7db5209260a381b4a83f (patch) | |
tree | 59d52ecb3cef99a21130ed575a0a20c9b6536385 /src/lib/libcrypto/evp | |
parent | 4a0bade454554867032b09f31d540604366200d5 (diff) | |
download | openbsd-cf9904a4b13d79f0e11e7db5209260a381b4a83f.tar.gz openbsd-cf9904a4b13d79f0e11e7db5209260a381b4a83f.tar.bz2 openbsd-cf9904a4b13d79f0e11e7db5209260a381b4a83f.zip |
Expand DECLARE_OBJ_BSEARCH_CMP_FN and IMPLEMENT_OBJ_BSEARCH_CMP_FN macros.
No change to generated assembly excluding line numbers.
Diffstat (limited to 'src/lib/libcrypto/evp')
-rw-r--r-- | src/lib/libcrypto/evp/evp_pbe.c | 22 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/pmeth_lib.c | 24 |
2 files changed, 38 insertions, 8 deletions
diff --git a/src/lib/libcrypto/evp/evp_pbe.c b/src/lib/libcrypto/evp/evp_pbe.c index 0787e2dc94..c7f0c7749a 100644 --- a/src/lib/libcrypto/evp/evp_pbe.c +++ b/src/lib/libcrypto/evp/evp_pbe.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp_pbe.c,v 1.23 2015/02/08 22:20:18 miod Exp $ */ | 1 | /* $OpenBSD: evp_pbe.c,v 1.24 2017/01/21 04:38:23 jsing 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 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -169,7 +169,9 @@ EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, | |||
169 | return 1; | 169 | return 1; |
170 | } | 170 | } |
171 | 171 | ||
172 | DECLARE_OBJ_BSEARCH_CMP_FN(EVP_PBE_CTL, EVP_PBE_CTL, pbe2); | 172 | static int pbe2_cmp_BSEARCH_CMP_FN(const void *, const void *); |
173 | static int pbe2_cmp(EVP_PBE_CTL const *, EVP_PBE_CTL const *); | ||
174 | static EVP_PBE_CTL *OBJ_bsearch_pbe2(EVP_PBE_CTL *key, EVP_PBE_CTL const *base, int num); | ||
173 | 175 | ||
174 | static int | 176 | static int |
175 | pbe2_cmp(const EVP_PBE_CTL *pbe1, const EVP_PBE_CTL *pbe2) | 177 | 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) | |||
182 | return pbe1->pbe_nid - pbe2->pbe_nid; | 184 | return pbe1->pbe_nid - pbe2->pbe_nid; |
183 | } | 185 | } |
184 | 186 | ||
185 | IMPLEMENT_OBJ_BSEARCH_CMP_FN(EVP_PBE_CTL, EVP_PBE_CTL, pbe2); | 187 | |
188 | static int | ||
189 | pbe2_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) | ||
190 | { | ||
191 | EVP_PBE_CTL const *a = a_; | ||
192 | EVP_PBE_CTL const *b = b_; | ||
193 | return pbe2_cmp(a, b); | ||
194 | } | ||
195 | |||
196 | static EVP_PBE_CTL * | ||
197 | OBJ_bsearch_pbe2(EVP_PBE_CTL *key, EVP_PBE_CTL const *base, int num) | ||
198 | { | ||
199 | return (EVP_PBE_CTL *)OBJ_bsearch_(key, base, num, sizeof(EVP_PBE_CTL), | ||
200 | pbe2_cmp_BSEARCH_CMP_FN); | ||
201 | } | ||
186 | 202 | ||
187 | static int | 203 | static int |
188 | pbe_cmp(const EVP_PBE_CTL * const *a, const EVP_PBE_CTL * const *b) | 204 | pbe_cmp(const EVP_PBE_CTL * const *a, const EVP_PBE_CTL * const *b) |
diff --git a/src/lib/libcrypto/evp/pmeth_lib.c b/src/lib/libcrypto/evp/pmeth_lib.c index c93fa99cc6..1d64edcbeb 100644 --- a/src/lib/libcrypto/evp/pmeth_lib.c +++ b/src/lib/libcrypto/evp/pmeth_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pmeth_lib.c,v 1.11 2015/02/11 03:19:37 doug Exp $ */ | 1 | /* $OpenBSD: pmeth_lib.c,v 1.12 2017/01/21 04:38:23 jsing 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 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -103,8 +103,9 @@ static const EVP_PKEY_METHOD *standard_methods[] = { | |||
103 | &cmac_pkey_meth, | 103 | &cmac_pkey_meth, |
104 | }; | 104 | }; |
105 | 105 | ||
106 | DECLARE_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_METHOD *, const EVP_PKEY_METHOD *, | 106 | static int pmeth_cmp_BSEARCH_CMP_FN(const void *, const void *); |
107 | pmeth); | 107 | static int pmeth_cmp(const EVP_PKEY_METHOD * const *, const EVP_PKEY_METHOD * const *); |
108 | static const EVP_PKEY_METHOD * *OBJ_bsearch_pmeth(const EVP_PKEY_METHOD * *key, const EVP_PKEY_METHOD * const *base, int num); | ||
108 | 109 | ||
109 | static int | 110 | static int |
110 | pmeth_cmp(const EVP_PKEY_METHOD * const *a, const EVP_PKEY_METHOD * const *b) | 111 | 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) | |||
112 | return ((*a)->pkey_id - (*b)->pkey_id); | 113 | return ((*a)->pkey_id - (*b)->pkey_id); |
113 | } | 114 | } |
114 | 115 | ||
115 | IMPLEMENT_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_METHOD *, const EVP_PKEY_METHOD *, | 116 | |
116 | pmeth); | 117 | static int |
118 | pmeth_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) | ||
119 | { | ||
120 | const EVP_PKEY_METHOD * const *a = a_; | ||
121 | const EVP_PKEY_METHOD * const *b = b_; | ||
122 | return pmeth_cmp(a, b); | ||
123 | } | ||
124 | |||
125 | static const EVP_PKEY_METHOD * * | ||
126 | OBJ_bsearch_pmeth(const EVP_PKEY_METHOD * *key, const EVP_PKEY_METHOD * const *base, int num) | ||
127 | { | ||
128 | return (const EVP_PKEY_METHOD * *)OBJ_bsearch_(key, base, num, sizeof(const EVP_PKEY_METHOD *), | ||
129 | pmeth_cmp_BSEARCH_CMP_FN); | ||
130 | } | ||
117 | 131 | ||
118 | const EVP_PKEY_METHOD * | 132 | const EVP_PKEY_METHOD * |
119 | EVP_PKEY_meth_find(int type) | 133 | EVP_PKEY_meth_find(int type) |