Portability patch for HP MPE/iX. Submitted by Mark Bixby <mark_bixby@hp.com>
[oweals/openssl.git] / crypto / evp / p5_crpt2.c
index 65c4afa9bbb9d3807b482393c496070f978fa2b4..717fad68ca8fa053a56d4102ceb70bb52f442b39 100644 (file)
@@ -55,6 +55,7 @@
  * Hudson (tjh@cryptsoft.com).
  *
  */
+#if !defined(NO_HMAC) && !defined(NO_SHA)
 #include <stdio.h>
 #include <stdlib.h>
 #include <openssl/x509.h>
@@ -85,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;
@@ -243,4 +245,4 @@ static void h__dump (const unsigned char *p, int len)
         fprintf(stderr, "\n");
 }
 #endif
-
+#endif