diff --git a/crypto/asn1/a_strnid.c b/crypto/asn1/a_strnid.c index f0d5416660963e6fd093488c8ce35deac99b3e17..cdba943737e71f1e73da3155496f8693b27bafe6 100644 --- a/crypto/asn1/a_strnid.c +++ b/crypto/asn1/a_strnid.c @@ -185,14 +185,14 @@ static int sk_table_cmp(const ASN1_STRING_TABLE * const *a, return (*a)->nid - (*b)->nid; } -DECLARE_OBJ_BSEARCH_CMP_FN(ASN1_STRING_TABLE, ASN1_STRING_TABLE, table_cmp); +DECLARE_OBJ_BSEARCH_CMP_FN(ASN1_STRING_TABLE, ASN1_STRING_TABLE, table); static int table_cmp(const ASN1_STRING_TABLE *a, const ASN1_STRING_TABLE *b) { return a->nid - b->nid; } -IMPLEMENT_OBJ_BSEARCH_CMP_FN(ASN1_STRING_TABLE, ASN1_STRING_TABLE, table_cmp); +IMPLEMENT_OBJ_BSEARCH_CMP_FN(ASN1_STRING_TABLE, ASN1_STRING_TABLE, table); ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid) { @@ -200,10 +200,8 @@ ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid) ASN1_STRING_TABLE *ttmp; ASN1_STRING_TABLE fnd; fnd.nid = nid; - ttmp = OBJ_bsearch(ASN1_STRING_TABLE, &fnd, - ASN1_STRING_TABLE, tbl_standard, - sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE), - table_cmp); + ttmp = OBJ_bsearch_table(&fnd, tbl_standard, + sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE)); if(ttmp) return ttmp; if(!stable) return NULL; idx = sk_ASN1_STRING_TABLE_find(stable, &fnd); diff --git a/crypto/asn1/ameth_lib.c b/crypto/asn1/ameth_lib.c index fee7198b85ad6b836ba76f60c0ac6ecc851ca9bd..5063191515bb8c3f60577989455260c9747b6922 100644 --- a/crypto/asn1/ameth_lib.c +++ b/crypto/asn1/ameth_lib.c @@ -113,7 +113,7 @@ void main() #endif DECLARE_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_ASN1_METHOD *, - const EVP_PKEY_ASN1_METHOD *, ameth_cmp); + const EVP_PKEY_ASN1_METHOD *, ameth); static int ameth_cmp(const EVP_PKEY_ASN1_METHOD * const *a, const EVP_PKEY_ASN1_METHOD * const *b) @@ -122,7 +122,7 @@ static int ameth_cmp(const EVP_PKEY_ASN1_METHOD * const *a, } IMPLEMENT_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_ASN1_METHOD *, - const EVP_PKEY_ASN1_METHOD *, ameth_cmp); + const EVP_PKEY_ASN1_METHOD *, ameth); int EVP_PKEY_asn1_get_count(void) { @@ -155,11 +155,9 @@ static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type) if (idx >= 0) return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx); } - ret = OBJ_bsearch(const EVP_PKEY_ASN1_METHOD *, &t, - const EVP_PKEY_ASN1_METHOD *, standard_methods, + ret = OBJ_bsearch_ameth(&t, standard_methods, sizeof(standard_methods) - /sizeof(EVP_PKEY_ASN1_METHOD *), - ameth_cmp); + /sizeof(EVP_PKEY_ASN1_METHOD *)); if (!ret || !*ret) return NULL; return *ret; diff --git a/crypto/evp/evp_pbe.c b/crypto/evp/evp_pbe.c index 7d6a50266abf59beebdec384f80880e570c01858..e1d72b762a3b7b4221ac4244b247e80801fd3fc1 100644 --- a/crypto/evp/evp_pbe.c +++ b/crypto/evp/evp_pbe.c @@ -189,9 +189,9 @@ int 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, pbe_cmp2); +DECLARE_OBJ_BSEARCH_CMP_FN(EVP_PBE_CTL, EVP_PBE_CTL, pbe2); -static int pbe_cmp2(const EVP_PBE_CTL *pbe1, const EVP_PBE_CTL *pbe2) +static int pbe2_cmp(const EVP_PBE_CTL *pbe1, const EVP_PBE_CTL *pbe2) { int ret = pbe1->pbe_type - pbe2->pbe_type; if (ret) @@ -200,7 +200,7 @@ static int pbe_cmp2(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, pbe_cmp2); +IMPLEMENT_OBJ_BSEARCH_CMP_FN(EVP_PBE_CTL, EVP_PBE_CTL, pbe2); static int pbe_cmp(const EVP_PBE_CTL * const *a, const EVP_PBE_CTL * const *b) { @@ -271,10 +271,8 @@ int EVP_PBE_find(int type, int pbe_nid, } if (pbetmp == NULL) { - pbetmp = OBJ_bsearch(EVP_PBE_CTL, &pbelu, - EVP_PBE_CTL, builtin_pbe, - sizeof(builtin_pbe)/sizeof(EVP_PBE_CTL), - pbe_cmp2); + pbetmp = OBJ_bsearch_pbe2(&pbelu, builtin_pbe, + sizeof(builtin_pbe)/sizeof(EVP_PBE_CTL)); } if (pbetmp == NULL) return 0; diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index d1b661ff36bf1cec32d0299b002a4ef2c4562b05..072736719d4664ff5c7e0d68cf46991e5f51ed41 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -85,7 +85,7 @@ static const EVP_PKEY_METHOD *standard_methods[] = }; DECLARE_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_METHOD *, const EVP_PKEY_METHOD *, - pmeth_cmp); + pmeth); static int pmeth_cmp(const EVP_PKEY_METHOD * const *a, const EVP_PKEY_METHOD * const *b) @@ -94,7 +94,7 @@ static int pmeth_cmp(const EVP_PKEY_METHOD * const *a, } IMPLEMENT_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_METHOD *, const EVP_PKEY_METHOD *, - pmeth_cmp); + pmeth); const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type) { @@ -108,10 +108,8 @@ const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type) if (idx >= 0) return sk_EVP_PKEY_METHOD_value(app_pkey_methods, idx); } - ret = OBJ_bsearch(const EVP_PKEY_METHOD *, &t, - const EVP_PKEY_METHOD *, standard_methods, - sizeof(standard_methods)/sizeof(EVP_PKEY_METHOD *), - pmeth_cmp); + ret = OBJ_bsearch_pmeth(&t, standard_methods, + sizeof(standard_methods)/sizeof(EVP_PKEY_METHOD *)); if (!ret || !*ret) return NULL; return *ret; diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index 3623e152b1f66d6f2374a7378bcaee63e90967cd..e999ef7831a231b426c486608432f3ba6173ba56 100644 --- a/crypto/objects/obj_dat.c +++ b/crypto/objects/obj_dat.c @@ -81,9 +81,9 @@ static const unsigned int ln_objs[1]; static const unsigned int obj_objs[1]; #endif -DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn_cmp); -DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln_cmp); -DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj_cmp); +DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn); +DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln); +DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj); #define ADDED_DATA 0 #define ADDED_SNAME 1 @@ -103,12 +103,12 @@ static LHASH_OF(ADDED_OBJ) *added=NULL; static int sn_cmp(const ASN1_OBJECT * const *a, const unsigned int *b) { return(strcmp((*a)->sn,nid_objs[*b].sn)); } -IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn_cmp); +IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn); static int ln_cmp(const ASN1_OBJECT * const *a, const unsigned int *b) { return(strcmp((*a)->ln,nid_objs[*b].ln)); } -IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln_cmp); +IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln); static unsigned long added_obj_hash(const ADDED_OBJ *ca) { @@ -393,7 +393,7 @@ static int obj_cmp(const ASN1_OBJECT * const *ap, const unsigned int *bp) return(memcmp(a->data,b->data,a->length)); } -IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj_cmp); +IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj); int OBJ_obj2nid(const ASN1_OBJECT *a) { @@ -412,8 +412,7 @@ int OBJ_obj2nid(const ASN1_OBJECT *a) adp=lh_ADDED_OBJ_retrieve(added,&ad); if (adp != NULL) return (adp->obj->nid); } - op=OBJ_bsearch(const ASN1_OBJECT *, &a, const unsigned int, obj_objs, - NUM_OBJ, obj_cmp); + op=OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ); if (op == NULL) return(NID_undef); return(nid_objs[*op].nid); @@ -648,8 +647,7 @@ int OBJ_ln2nid(const char *s) adp=lh_ADDED_OBJ_retrieve(added,&ad); if (adp != NULL) return (adp->obj->nid); } - op=OBJ_bsearch(const ASN1_OBJECT *, &oo, const unsigned int, ln_objs, - NUM_LN, ln_cmp); + op=OBJ_bsearch_ln(&oo, ln_objs, NUM_LN); if (op == NULL) return(NID_undef); return(nid_objs[*op].nid); } @@ -669,8 +667,7 @@ int OBJ_sn2nid(const char *s) adp=lh_ADDED_OBJ_retrieve(added,&ad); if (adp != NULL) return (adp->obj->nid); } - op=OBJ_bsearch(const ASN1_OBJECT *, &oo, const unsigned int, sn_objs, - NUM_SN, sn_cmp); + op=OBJ_bsearch_sn(&oo, sn_objs, NUM_SN); if (op == NULL) return(NID_undef); return(nid_objs[*op].nid); } diff --git a/crypto/objects/obj_xref.c b/crypto/objects/obj_xref.c index 30d544b1a4a523d7d5ffea7fa95b0e339bfa298f..6230c365a1b6a4d8b84780195f4346f17c14312d 100644 --- a/crypto/objects/obj_xref.c +++ b/crypto/objects/obj_xref.c @@ -62,22 +62,22 @@ DECLARE_STACK_OF(nid_triple) STACK_OF(nid_triple) *sig_app, *sigx_app; -static int cmp_sig(const nid_triple *a, const nid_triple *b) +static int sig_cmp(const nid_triple *a, const nid_triple *b) { return a->sign_id - b->sign_id; } -DECLARE_OBJ_BSEARCH_CMP_FN(nid_triple, nid_triple, cmp_sig); -IMPLEMENT_OBJ_BSEARCH_CMP_FN(nid_triple, nid_triple, cmp_sig); +DECLARE_OBJ_BSEARCH_CMP_FN(nid_triple, nid_triple, sig); +IMPLEMENT_OBJ_BSEARCH_CMP_FN(nid_triple, nid_triple, sig); -static int cmp_sig_sk(const nid_triple * const *a, const nid_triple * const *b) +static int sig_sk_cmp(const nid_triple * const *a, const nid_triple * const *b) { return (*a)->sign_id - (*b)->sign_id; } -DECLARE_OBJ_BSEARCH_CMP_FN(const nid_triple *, const nid_triple *, cmp_sigx); +DECLARE_OBJ_BSEARCH_CMP_FN(const nid_triple *, const nid_triple *, sigx); -static int cmp_sigx(const nid_triple * const *a, const nid_triple * const *b) +static int sigx_cmp(const nid_triple * const *a, const nid_triple * const *b) { int ret; ret = (*a)->hash_id - (*b)->hash_id; @@ -86,7 +86,7 @@ static int cmp_sigx(const nid_triple * const *a, const nid_triple * const *b) return (*a)->pkey_id - (*b)->pkey_id; } -IMPLEMENT_OBJ_BSEARCH_CMP_FN(const nid_triple *, const nid_triple *, cmp_sigx); +IMPLEMENT_OBJ_BSEARCH_CMP_FN(const nid_triple *, const nid_triple *, sigx); int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid) { @@ -104,10 +104,8 @@ int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid) #ifndef OBJ_XREF_TEST2 if (rv == NULL) { - rv = OBJ_bsearch(const nid_triple,&tmp, - const nid_triple,sigoid_srt, - sizeof(sigoid_srt) / sizeof(nid_triple), - cmp_sig); + rv = OBJ_bsearch_sig(&tmp, sigoid_srt, + sizeof(sigoid_srt) / sizeof(nid_triple)); } #endif if (rv == NULL) @@ -139,10 +137,9 @@ int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid) #ifndef OBJ_XREF_TEST2 if (rv == NULL) { - rv = OBJ_bsearch(const nid_triple *,&t, - const nid_triple *,sigoid_srt_xref, - sizeof(sigoid_srt_xref) / sizeof(nid_triple *), - cmp_sigx); + rv = OBJ_bsearch_sigx(&t, sigoid_srt_xref, + sizeof(sigoid_srt_xref) / sizeof(nid_triple *) + ); } #endif if (rv == NULL) @@ -155,11 +152,11 @@ int OBJ_add_sigid(int signid, int dig_id, int pkey_id) { nid_triple *ntr; if (!sig_app) - sig_app = sk_nid_triple_new(cmp_sig_sk); + sig_app = sk_nid_triple_new(sig_sk_cmp); if (!sig_app) return 0; if (!sigx_app) - sigx_app = sk_nid_triple_new(cmp_sigx); + sigx_app = sk_nid_triple_new(sigx_cmp); if (!sigx_app) return 0; ntr = OPENSSL_malloc(sizeof(int) * 3); diff --git a/crypto/objects/objects.h b/crypto/objects/objects.h index 3e6d71021bf207499d7500c96002dd3bee84e02f..65b6f013588cddf53b2453a1fdcfd9b52d0ca9b2 100644 --- a/crypto/objects/objects.h +++ b/crypto/objects/objects.h @@ -1018,16 +1018,15 @@ const void * OBJ_bsearch_ex_(const void *key,const void *base,int num, int (*cmp)(const void *, const void *), int flags); -#define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, cmp) \ - scope type1 *cmp##_type_1; \ - scope type2 *cmp##_type_2; \ - scope int cmp##_BSEARCH_CMP_FN(const void *, const void *); \ - scope int cmp(type1 const *, type2 const *) +#define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \ + static int nm##_cmp(type1 const *, type2 const *); \ + scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) #define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) -#define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, cmp) \ - _DECLARE_OBJ_BSEARCH_CMP_FN(, type1, type2, cmp) +#define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ + type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) /* * Unsolved problem: if a type is actually a pointer type, like @@ -1055,12 +1054,17 @@ const void * OBJ_bsearch_ex_(const void *key,const void *base,int num, * the non-constness means a lot of complication, and in practice * comparison routines do always not touch their arguments. */ -#define _IMPLEMENT_OBJ_BSEARCH_CMP_FN(scope, type1, type2, cmp) \ - scope int cmp##_BSEARCH_CMP_FN(const void *a_, const void *b_) \ +#define _IMPLEMENT_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ { \ type1 const *a = a_; \ type2 const *b = b_; \ - return cmp(a,b); \ + return nm##_cmp(a,b); \ + } \ + scope type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ + { \ + return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ + nm##_cmp_BSEARCH_CMP_FN); \ } \ extern void dummy_prototype(void) diff --git a/crypto/x509/x509_vpm.c b/crypto/x509/x509_vpm.c index 5c018e9832a509c1a2c72b859854dce4c6e14e44..ce8e676c2b6a1d1da01a742088984e896dda500f 100644 --- a/crypto/x509/x509_vpm.c +++ b/crypto/x509/x509_vpm.c @@ -363,9 +363,9 @@ static int table_cmp(const X509_VERIFY_PARAM *a, const X509_VERIFY_PARAM *b) } DECLARE_OBJ_BSEARCH_CMP_FN(X509_VERIFY_PARAM, X509_VERIFY_PARAM, - table_cmp); + table); IMPLEMENT_OBJ_BSEARCH_CMP_FN(X509_VERIFY_PARAM, X509_VERIFY_PARAM, - table_cmp); + table); static int param_cmp(const X509_VERIFY_PARAM * const *a, const X509_VERIFY_PARAM * const *b) @@ -410,10 +410,8 @@ const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name) if (idx != -1) return sk_X509_VERIFY_PARAM_value(param_table, idx); } - return OBJ_bsearch(const X509_VERIFY_PARAM, &pm, - const X509_VERIFY_PARAM, default_table, - sizeof(default_table)/sizeof(X509_VERIFY_PARAM), - table_cmp); + return OBJ_bsearch_table(&pm, default_table, + sizeof(default_table)/sizeof(X509_VERIFY_PARAM)); } void X509_VERIFY_PARAM_table_cleanup(void) diff --git a/crypto/x509v3/v3_lib.c b/crypto/x509v3/v3_lib.c index 3ad5b29afcd030eaa991a0c249f704cca3568fce..dad0c905c2dca1cd873ac634ede973b6112f116d 100644 --- a/crypto/x509v3/v3_lib.c +++ b/crypto/x509v3/v3_lib.c @@ -90,9 +90,9 @@ static int ext_cmp(const X509V3_EXT_METHOD * const *a, } DECLARE_OBJ_BSEARCH_CMP_FN(const X509V3_EXT_METHOD *, const X509V3_EXT_METHOD *, - ext_cmp); + ext); IMPLEMENT_OBJ_BSEARCH_CMP_FN(const X509V3_EXT_METHOD *, - const X509V3_EXT_METHOD *, ext_cmp); + const X509V3_EXT_METHOD *, ext); const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid) { @@ -101,9 +101,7 @@ const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid) int idx; if(nid < 0) return NULL; tmp.ext_nid = nid; - ret = OBJ_bsearch(const X509V3_EXT_METHOD *, &t, - const X509V3_EXT_METHOD *, standard_exts, - STANDARD_EXTENSION_COUNT, ext_cmp); + ret = OBJ_bsearch_ext(&t, standard_exts, STANDARD_EXTENSION_COUNT); if(ret) return *ret; if(!ext_list) return NULL; idx = sk_X509V3_EXT_METHOD_find(ext_list, &tmp); diff --git a/crypto/x509v3/v3_purp.c b/crypto/x509v3/v3_purp.c index a5d9805ce466bdad1c54c8cb280b3f41fabe22a2..e00c9ec13016f8ab21e150fa3274c839327b05cb 100644 --- a/crypto/x509v3/v3_purp.c +++ b/crypto/x509v3/v3_purp.c @@ -272,8 +272,8 @@ static int nid_cmp(const int *a, const int *b) return *a - *b; } -DECLARE_OBJ_BSEARCH_CMP_FN(int, int, nid_cmp); -IMPLEMENT_OBJ_BSEARCH_CMP_FN(int, int, nid_cmp); +DECLARE_OBJ_BSEARCH_CMP_FN(int, int, nid); +IMPLEMENT_OBJ_BSEARCH_CMP_FN(int, int, nid); int X509_supported_extension(X509_EXTENSION *ex) { @@ -303,13 +303,13 @@ int X509_supported_extension(X509_EXTENSION *ex) NID_inhibit_any_policy /* 748 */ }; - const int ex_nid = OBJ_obj2nid(X509_EXTENSION_get_object(ex)); + int ex_nid = OBJ_obj2nid(X509_EXTENSION_get_object(ex)); if (ex_nid == NID_undef) return 0; - if (OBJ_bsearch(int, &ex_nid, int, supported_nids, - sizeof(supported_nids)/sizeof(int), nid_cmp)) + if (OBJ_bsearch_nid(&ex_nid, supported_nids, + sizeof(supported_nids)/sizeof(int))) return 1; return 0; } diff --git a/ssl/s2_lib.c b/ssl/s2_lib.c index 0f311c3fab8f5d13c07d17648162a0316cec84a8..4cfafcedf17f3a95ab4f363d863b0f47125964b6 100644 --- a/ssl/s2_lib.c +++ b/ssl/s2_lib.c @@ -413,7 +413,7 @@ long ssl2_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void)) } IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, - ssl_cipher_id_cmp); + ssl_cipher_id); /* This function needs to check if the ciphers required are actually * available */ @@ -426,8 +426,7 @@ const SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p) id=0x02000000L|((unsigned long)p[0]<<16L)| ((unsigned long)p[1]<<8L)|(unsigned long)p[2]; c.id=id; - cp = OBJ_bsearch(const SSL_CIPHER, &c, const SSL_CIPHER, ssl2_ciphers, - SSL2_NUM_CIPHERS, ssl_cipher_id_cmp); + cp = OBJ_bsearch_ssl_cipher_id(&c, ssl2_ciphers, SSL2_NUM_CIPHERS); if ((cp == NULL) || (cp->valid == 0)) return NULL; else diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 7e896997b22d9c8c7893723deaa1ddd792271d15..54c0540493e1ac4660693f20ba9d05a2a2df2b63 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -2794,8 +2794,7 @@ const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p) id=0x03000000L|((unsigned long)p[0]<<8L)|(unsigned long)p[1]; c.id=id; - cp = OBJ_bsearch(SSL_CIPHER, &c, SSL_CIPHER, ssl3_ciphers, - SSL3_NUM_CIPHERS, ssl_cipher_id_cmp); + cp = OBJ_bsearch_ssl_cipher_id(&c, ssl3_ciphers, SSL3_NUM_CIPHERS); if (cp == NULL || cp->valid == 0) return NULL; else diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h index e478f9aa727785faff8d52438de26bda45621c8c..30bd74676ca51ab98a89b2fb7045b8035d27f93d 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h @@ -785,7 +785,7 @@ int ssl_get_new_session(SSL *s, int session); int ssl_get_prev_session(SSL *s, unsigned char *session,int len, const unsigned char *limit); int ssl_cipher_id_cmp(const SSL_CIPHER *a,const SSL_CIPHER *b); DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, - ssl_cipher_id_cmp); + ssl_cipher_id); int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap, const SSL_CIPHER * const *bp); STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num,