In RSA, DSA, DH, and RAND - if the "***_new()" function fails because the
[oweals/openssl.git] / crypto / evp / evp_pbe.c
index 229ac673a7beaa67df7d019a6583e6fb8cc32a9a..06afb9d152a1c3f4301e72e6cdca550569c66c6c 100644 (file)
@@ -69,8 +69,8 @@ static STACK *pbe_algs;
 
 typedef struct {
 int pbe_nid;
-EVP_CIPHER *cipher;
-EVP_MD *md;
+const EVP_CIPHER *cipher;
+const EVP_MD *md;
 EVP_PBE_KEYGEN *keygen;
 } EVP_PBE_CTL;
 
@@ -104,18 +104,19 @@ int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
        return 1;       
 }
 
-static int pbe_cmp (EVP_PBE_CTL **pbe1, EVP_PBE_CTL **pbe2)
+static int pbe_cmp(const char * const *a, const char * const *b)
 {
+       EVP_PBE_CTL **pbe1 = (EVP_PBE_CTL **) a,  **pbe2 = (EVP_PBE_CTL **)b;
        return ((*pbe1)->pbe_nid - (*pbe2)->pbe_nid);
 }
 
 /* Add a PBE algorithm */
 
-int EVP_PBE_alg_add (int nid, EVP_CIPHER *cipher, EVP_MD *md,
+int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
             EVP_PBE_KEYGEN *keygen)
 {
        EVP_PBE_CTL *pbe_tmp;
-       if (!pbe_algs) pbe_algs = sk_new ((int (*)())pbe_cmp);
+       if (!pbe_algs) pbe_algs = sk_new(pbe_cmp);
        if (!(pbe_tmp = (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL)))) {
                EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);
                return 0;