diff --git a/crypto/asn1/ameth_lib.c b/crypto/asn1/ameth_lib.c index 300195bf95..fee7198b85 100644 --- a/crypto/asn1/ameth_lib.c +++ b/crypto/asn1/ameth_lib.c @@ -112,7 +112,7 @@ void main() } #endif -DECLARE_OBJ_BSEARCH_CMP_FN(EVP_PKEY_ASN1_METHOD *, +DECLARE_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_ASN1_METHOD *, const EVP_PKEY_ASN1_METHOD *, ameth_cmp); static int ameth_cmp(const EVP_PKEY_ASN1_METHOD * const *a, @@ -121,7 +121,7 @@ static int ameth_cmp(const EVP_PKEY_ASN1_METHOD * const *a, return ((*a)->pkey_id - (*b)->pkey_id); } -IMPLEMENT_OBJ_BSEARCH_CMP_FN(EVP_PKEY_ASN1_METHOD *, +IMPLEMENT_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_ASN1_METHOD *, const EVP_PKEY_ASN1_METHOD *, ameth_cmp); int EVP_PKEY_asn1_get_count(void) @@ -145,8 +145,8 @@ const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx) static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type) { - EVP_PKEY_ASN1_METHOD tmp, *t = &tmp; - const EVP_PKEY_ASN1_METHOD **ret; + EVP_PKEY_ASN1_METHOD tmp; + const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret; tmp.pkey_id = type; if (app_methods) { @@ -155,7 +155,7 @@ 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(EVP_PKEY_ASN1_METHOD *, &t, + ret = OBJ_bsearch(const EVP_PKEY_ASN1_METHOD *, &t, const EVP_PKEY_ASN1_METHOD *, standard_methods, sizeof(standard_methods) /sizeof(EVP_PKEY_ASN1_METHOD *), diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index 3fd11cbb5a..d1b661ff36 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -84,7 +84,7 @@ static const EVP_PKEY_METHOD *standard_methods[] = &hmac_pkey_meth, }; -DECLARE_OBJ_BSEARCH_CMP_FN(EVP_PKEY_METHOD *, const EVP_PKEY_METHOD *, +DECLARE_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_METHOD *, const EVP_PKEY_METHOD *, pmeth_cmp); static int pmeth_cmp(const EVP_PKEY_METHOD * const *a, @@ -93,13 +93,13 @@ static int pmeth_cmp(const EVP_PKEY_METHOD * const *a, return ((*a)->pkey_id - (*b)->pkey_id); } -IMPLEMENT_OBJ_BSEARCH_CMP_FN(EVP_PKEY_METHOD *, const EVP_PKEY_METHOD *, +IMPLEMENT_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_METHOD *, const EVP_PKEY_METHOD *, pmeth_cmp); const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type) { - EVP_PKEY_METHOD tmp, *t = &tmp; - const EVP_PKEY_METHOD **ret; + EVP_PKEY_METHOD tmp; + const EVP_PKEY_METHOD *t = &tmp, **ret; tmp.pkey_id = type; if (app_pkey_methods) { @@ -108,7 +108,7 @@ 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(EVP_PKEY_METHOD *, &t, + ret = OBJ_bsearch(const EVP_PKEY_METHOD *, &t, const EVP_PKEY_METHOD *, standard_methods, sizeof(standard_methods)/sizeof(EVP_PKEY_METHOD *), pmeth_cmp); diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index 2f41aaeb0f..3623e152b1 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 *, const unsigned int, sn_cmp); -DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, const unsigned int, ln_cmp); -DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, const unsigned int, obj_cmp); +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); #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 *, const unsigned int, sn_cmp) +IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn_cmp); 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 *, const unsigned int, ln_cmp) +IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln_cmp); 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 *, const unsigned int, obj_cmp) +IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj_cmp); int OBJ_obj2nid(const ASN1_OBJECT *a) { diff --git a/crypto/objects/obj_xref.c b/crypto/objects/obj_xref.c index 3e85e7a576..30d544b1a4 100644 --- a/crypto/objects/obj_xref.c +++ b/crypto/objects/obj_xref.c @@ -67,8 +67,8 @@ static int cmp_sig(const nid_triple *a, const nid_triple *b) return a->sign_id - b->sign_id; } -DECLARE_OBJ_BSEARCH_CMP_FN(const nid_triple, const nid_triple, cmp_sig); -IMPLEMENT_OBJ_BSEARCH_CMP_FN(const nid_triple, const nid_triple, cmp_sig) +DECLARE_OBJ_BSEARCH_CMP_FN(nid_triple, nid_triple, cmp_sig); +IMPLEMENT_OBJ_BSEARCH_CMP_FN(nid_triple, nid_triple, cmp_sig); static int cmp_sig_sk(const nid_triple * const *a, const nid_triple * const *b) { @@ -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 *, cmp_sigx); int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid) { @@ -120,7 +120,7 @@ int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid) int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid) { nid_triple tmp; - const nid_triple const *t=&tmp; + const nid_triple *t=&tmp; const nid_triple **rv = NULL; tmp.hash_id = dig_nid; diff --git a/crypto/objects/objects.h b/crypto/objects/objects.h index 7868023af1..3e6d71021b 100644 --- a/crypto/objects/objects.h +++ b/crypto/objects/objects.h @@ -1022,7 +1022,7 @@ const void * OBJ_bsearch_ex_(const void *key,const void *base,int num, scope type1 *cmp##_type_1; \ scope type2 *cmp##_type_2; \ scope int cmp##_BSEARCH_CMP_FN(const void *, const void *); \ - scope int cmp(const type1 const *, const type2 const *) + scope int cmp(type1 const *, type2 const *) #define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) @@ -1058,10 +1058,11 @@ const void * OBJ_bsearch_ex_(const void *key,const void *base,int num, #define _IMPLEMENT_OBJ_BSEARCH_CMP_FN(scope, type1, type2, cmp) \ scope int cmp##_BSEARCH_CMP_FN(const void *a_, const void *b_) \ { \ - const type1 const *a = a_; \ - const type2 const *b = b_; \ + type1 const *a = a_; \ + type2 const *b = b_; \ return cmp(a,b); \ - } + } \ + extern void dummy_prototype(void) #define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ _IMPLEMENT_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) @@ -1076,7 +1077,7 @@ const void * OBJ_bsearch_ex_(const void *key,const void *base,int num, cmp##_BSEARCH_CMP_FN))) #define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags) \ - ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ + ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ num,sizeof(type2), \ ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \ diff --git a/crypto/x509/x509_vpm.c b/crypto/x509/x509_vpm.c index 9c37c4ded3..5c018e9832 100644 --- a/crypto/x509/x509_vpm.c +++ b/crypto/x509/x509_vpm.c @@ -362,9 +362,9 @@ static int table_cmp(const X509_VERIFY_PARAM *a, const X509_VERIFY_PARAM *b) return strcmp(a->name, b->name); } -DECLARE_OBJ_BSEARCH_CMP_FN(const X509_VERIFY_PARAM, const X509_VERIFY_PARAM, +DECLARE_OBJ_BSEARCH_CMP_FN(X509_VERIFY_PARAM, X509_VERIFY_PARAM, table_cmp); -IMPLEMENT_OBJ_BSEARCH_CMP_FN(const X509_VERIFY_PARAM, const X509_VERIFY_PARAM, +IMPLEMENT_OBJ_BSEARCH_CMP_FN(X509_VERIFY_PARAM, X509_VERIFY_PARAM, table_cmp); static int param_cmp(const X509_VERIFY_PARAM * const *a, diff --git a/ssl/s2_lib.c b/ssl/s2_lib.c index d93a2c797f..0f311c3fab 100644 --- a/ssl/s2_lib.c +++ b/ssl/s2_lib.c @@ -412,7 +412,7 @@ long ssl2_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void)) return(0); } -IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(const SSL_CIPHER, const SSL_CIPHER, +IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, ssl_cipher_id_cmp); /* This function needs to check if the ciphers required are actually diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h index ad69a71ff5..e478f9aa72 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h @@ -784,7 +784,7 @@ int ssl_set_peer_cert_type(SESS_CERT *c, int type); 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(const SSL_CIPHER, const SSL_CIPHER, +DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, ssl_cipher_id_cmp); int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap, const SSL_CIPHER * const *bp);