summaryrefslogtreecommitdiff
path: root/lib/libcrypto/evp/evp_pbe.c
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2000-12-15 02:58:48 +0000
committerBob Beck <beck@cvs.openbsd.org>2000-12-15 02:58:48 +0000
commit01c37e03996dffeff1618614755c6cc676899acb (patch)
tree988002fb9b1d859c10890511aa5273cfb00662dc /lib/libcrypto/evp/evp_pbe.c
parent9865f3ff77de9cfef0c5c8b0470daf6faa2f14af (diff)
openssl-engine-0.9.6 merge
Diffstat (limited to 'lib/libcrypto/evp/evp_pbe.c')
-rw-r--r--lib/libcrypto/evp/evp_pbe.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/libcrypto/evp/evp_pbe.c b/lib/libcrypto/evp/evp_pbe.c
index 353c3ad667f..224a422b126 100644
--- a/lib/libcrypto/evp/evp_pbe.c
+++ b/lib/libcrypto/evp/evp_pbe.c
@@ -92,7 +92,8 @@ int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
ERR_add_error_data(2, "TYPE=", obj_tmp);
return 0;
}
- if (passlen == -1) passlen = strlen(pass);
+ if(!pass) passlen = 0;
+ else if (passlen == -1) passlen = strlen(pass);
pbetmp = (EVP_PBE_CTL *)sk_value (pbe_algs, i);
i = (*pbetmp->keygen)(ctx, pass, passlen, param, pbetmp->cipher,
pbetmp->md, en_de);
@@ -103,8 +104,9 @@ 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);
}
@@ -114,8 +116,8 @@ int EVP_PBE_alg_add (int nid, EVP_CIPHER *cipher, EVP_MD *md,
EVP_PBE_KEYGEN *keygen)
{
EVP_PBE_CTL *pbe_tmp;
- if (!pbe_algs) pbe_algs = sk_new (pbe_cmp);
- if (!(pbe_tmp = (EVP_PBE_CTL*) Malloc (sizeof(EVP_PBE_CTL)))) {
+ 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;
}
@@ -129,6 +131,6 @@ int EVP_PBE_alg_add (int nid, EVP_CIPHER *cipher, EVP_MD *md,
void EVP_PBE_cleanup(void)
{
- sk_pop_free(pbe_algs, FreeFunc);
+ sk_pop_free(pbe_algs, OPENSSL_freeFunc);
pbe_algs = NULL;
}