Updates from 1.0.0-stable.
[openssl.git] / crypto / evp / evp_pbe.c
index 8fecd34221c3c750daa423ffbcf6d8ce3824664e..cd6e40dcaa3ad4381f800ac67658f9181c2e67ba 100644 (file)
@@ -1,5 +1,5 @@
 /* evp_pbe.c */
-/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
+/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
  * project 1999.
  */
 /* ====================================================================
@@ -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, pbe2);
+
+static int pbe2_cmp(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, pbe2);
+
 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,8 @@ 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_pbe2(&pbelu, builtin_pbe,
+                                    sizeof(builtin_pbe)/sizeof(EVP_PBE_CTL));
                }
        if (pbetmp == NULL)
                return 0;