Fix for BIO pairs.
[openssl.git] / crypto / pkcs12 / p12_decr.c
index b96f119b7a73346e4ef862c2449a11d93bf6b9cd..8f502fae7fe6c1df3435be72bb83e4dde3fec9ba 100644 (file)
@@ -58,7 +58,7 @@
 
 #include <stdio.h>
 #include "cryptlib.h"
-#include "pkcs12.h"
+#include <openssl/pkcs12.h>
 
 /* Define this to dump decrypted output to files called DERnnn */
 /*#define DEBUG_DECRYPT*/
@@ -68,7 +68,7 @@
  * Malloc'ed buffer
  */
 
-unsigned char * PKCS12_pbe_crypt (X509_ALGOR *algor, unsigned char *pass,
+unsigned char * PKCS12_pbe_crypt (X509_ALGOR *algor, const char *pass,
             int passlen, unsigned char *in, int inlen, unsigned char **data,
             int *datalen, int en_de)
 {
@@ -82,7 +82,8 @@ unsigned char * PKCS12_pbe_crypt (X509_ALGOR *algor, unsigned char *pass,
        }
 
        /* Decrypt data */
-        if (!EVP_PBE_ALGOR_CipherInit (algor, pass, passlen, &ctx, en_de)) {
+        if (!EVP_PBE_CipherInit (algor->algorithm, pass, passlen,
+                                        algor->parameter, &ctx, en_de)) {
                PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR);
                return NULL;
        }
@@ -107,7 +108,7 @@ unsigned char * PKCS12_pbe_crypt (X509_ALGOR *algor, unsigned char *pass,
  */
 
 char * PKCS12_decrypt_d2i (X509_ALGOR *algor, char * (*d2i)(),
-            void (*free_func)(), unsigned char *pass, int passlen,
+            void (*free_func)(), const char *pass, int passlen,
             ASN1_OCTET_STRING *oct, int seq)
 {
        unsigned char *out, *p;
@@ -115,7 +116,7 @@ char * PKCS12_decrypt_d2i (X509_ALGOR *algor, char * (*d2i)(),
        int outlen;
 
        if (!PKCS12_pbe_crypt (algor, pass, passlen, oct->data, oct->length,
-                                &out, &outlen, 0)) {
+                              &out, &outlen, 0)) {
                PKCS12err(PKCS12_F_PKCS12_DECRYPT_D2I,PKCS12_R_PKCS12_PBE_CRYPT_ERROR);
                return NULL;
        }
@@ -147,7 +148,8 @@ char * PKCS12_decrypt_d2i (X509_ALGOR *algor, char * (*d2i)(),
  */
 
 ASN1_OCTET_STRING *PKCS12_i2d_encrypt (X509_ALGOR *algor, int (*i2d)(),
-            unsigned char *pass, int passlen, char *obj, int seq)
+                                      const char *pass, int passlen,
+                                      char *obj, int seq)
 {
        ASN1_OCTET_STRING *oct;
        unsigned char *in, *p;