From e19106f5fb7da7db15449a9a50f9be9047800757 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Wed, 22 Oct 2008 15:43:01 +0000 Subject: Create function of the form OBJ_bsearch_xxx() in bsearch typesafe macros with the appropriate parameters which calls OBJ_bsearch(). A compiler will typically inline this. This avoids the need for cmp_xxx variables and fixes unchecked const issues with CHECKED_PTR_OF() --- ssl/s2_lib.c | 5 ++--- ssl/s3_lib.c | 3 +-- ssl/ssl_locl.h | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'ssl') diff --git a/ssl/s2_lib.c b/ssl/s2_lib.c index 0f311c3fab..4cfafcedf1 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 7e896997b2..54c0540493 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 e478f9aa72..30bd74676c 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, -- cgit v1.2.3