diff options
author | Ben Laurie <ben@openssl.org> | 2008-10-12 14:32:47 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 2008-10-12 14:32:47 +0000 |
commit | babb379849ffb4112792f266f92e9ebb2bd35332 (patch) | |
tree | d401aa7a4af8cc1180fe602711897a50d8feb74f /crypto/evp/evp_pbe.c | |
parent | 6665ef303e837ed45654d1b5dd42123e7a51b0f4 (diff) |
Type-checked (and modern C compliant) OBJ_bsearch.
Diffstat (limited to 'crypto/evp/evp_pbe.c')
-rw-r--r-- | crypto/evp/evp_pbe.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/crypto/evp/evp_pbe.c b/crypto/evp/evp_pbe.c index 8fecd34221..7d6a50266a 100644 --- a/crypto/evp/evp_pbe.c +++ b/crypto/evp/evp_pbe.c @@ -189,10 +189,10 @@ int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, return 1; } -static int pbe_cmp2(const void *a, const void *b) +DECLARE_OBJ_BSEARCH_CMP_FN(EVP_PBE_CTL, EVP_PBE_CTL, pbe_cmp2); + +static int pbe_cmp2(const EVP_PBE_CTL *pbe1, const EVP_PBE_CTL *pbe2) { - const EVP_PBE_CTL *pbe1 = a; - const EVP_PBE_CTL *pbe2 = b; int ret = pbe1->pbe_type - pbe2->pbe_type; if (ret) return ret; @@ -200,6 +200,8 @@ static int pbe_cmp2(const void *a, const void *b) return pbe1->pbe_nid - pbe2->pbe_nid; } +IMPLEMENT_OBJ_BSEARCH_CMP_FN(EVP_PBE_CTL, EVP_PBE_CTL, pbe_cmp2); + static int pbe_cmp(const EVP_PBE_CTL * const *a, const EVP_PBE_CTL * const *b) { int ret = (*a)->pbe_type - (*b)->pbe_type; @@ -269,11 +271,10 @@ int EVP_PBE_find(int type, int pbe_nid, } if (pbetmp == NULL) { - pbetmp = (EVP_PBE_CTL *) OBJ_bsearch((char *)&pbelu, - (char *)builtin_pbe, - sizeof(builtin_pbe)/sizeof(EVP_PBE_CTL), - sizeof(EVP_PBE_CTL), - pbe_cmp2); + pbetmp = OBJ_bsearch(EVP_PBE_CTL, &pbelu, + EVP_PBE_CTL, builtin_pbe, + sizeof(builtin_pbe)/sizeof(EVP_PBE_CTL), + pbe_cmp2); } if (pbetmp == NULL) return 0; |