Make PKCS#12 code handle missing passwords.
[openssl.git] / crypto / evp / p5_crpt2.c
index 27a2c51..717fad6 100644 (file)
@@ -86,7 +86,8 @@ int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
        HMAC_CTX hctx;
        p = out;
        tkeylen = keylen;
-       if(passlen == -1) passlen = strlen(pass);
+       if(!pass) passlen = 0;
+       else if(passlen == -1) passlen = strlen(pass);
        while(tkeylen) {
                if(tkeylen > SHA_DIGEST_LENGTH) cplen = SHA_DIGEST_LENGTH;
                else cplen = tkeylen;