Fixes for Win32 build.
[openssl.git] / crypto / evp / bio_b64.c
index 913bafa5f79e60aa3308d38e985054b42bdfc037..35c514a771743d2c4f37edf16b587e848a107479 100644 (file)
 #include <openssl/buffer.h>
 #include <openssl/evp.h>
 
-static int b64_write(BIO *h,char *buf,int num);
-static int b64_read(BIO *h,char *buf,int size);
-/*static int b64_puts(BIO *h,char *str); */
-/*static int b64_gets(BIO *h,char *str,int size); */
-static long b64_ctrl(BIO *h,int cmd,long arg1,char *arg2);
+static int b64_write(BIO *h, const char *buf, int num);
+static int b64_read(BIO *h, char *buf, int size);
+/*static int b64_puts(BIO *h, const char *str); */
+/*static int b64_gets(BIO *h, char *str, int size); */
+static long b64_ctrl(BIO *h, int cmd, long arg1, void *arg2);
 static int b64_new(BIO *h);
 static int b64_free(BIO *data);
+static long b64_callback_ctrl(BIO *h,int cmd,bio_info_cb *fp);
 #define B64_BLOCK_SIZE 1024
 #define B64_BLOCK_SIZE2        768
 #define B64_NONE       0
@@ -100,6 +101,7 @@ static BIO_METHOD methods_b64=
        b64_ctrl,
        b64_new,
        b64_free,
+       b64_callback_ctrl,
        };
 
 BIO_METHOD *BIO_f_base64(void)
@@ -111,7 +113,7 @@ static int b64_new(BIO *bi)
        {
        BIO_B64_CTX *ctx;
 
-       ctx=(BIO_B64_CTX *)Malloc(sizeof(BIO_B64_CTX));
+       ctx=(BIO_B64_CTX *)OPENSSL_malloc(sizeof(BIO_B64_CTX));
        if (ctx == NULL) return(0);
 
        ctx->buf_len=0;
@@ -131,7 +133,7 @@ static int b64_new(BIO *bi)
 static int b64_free(BIO *a)
        {
        if (a == NULL) return(0);
-       Free(a->ptr);
+       OPENSSL_free(a->ptr);
        a->ptr=NULL;
        a->init=0;
        a->flags=0;
@@ -338,7 +340,7 @@ static int b64_read(BIO *b, char *out, int outl)
        return((ret == 0)?ret_code:ret);
        }
 
-static int b64_write(BIO *b, char *in, int inl)
+static int b64_write(BIO *b, const char *in, int inl)
        {
        int ret=inl,n,i;
        BIO_B64_CTX *ctx;
@@ -432,7 +434,7 @@ static int b64_write(BIO *b, char *in, int inl)
        return(ret);
        }
 
-static long b64_ctrl(BIO *b, int cmd, long num, char *ptr)
+static long b64_ctrl(BIO *b, int cmd, long num, void *ptr)
        {
        BIO_B64_CTX *ctx;
        long ret=1;
@@ -522,3 +524,17 @@ again:
        return(ret);
        }
 
+static long b64_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
+       {
+       long ret=1;
+
+       if (b->next_bio == NULL) return(0);
+       switch (cmd)
+               {
+       default:
+               ret=BIO_callback_ctrl(b->next_bio,cmd,fp);
+               break;
+               }
+       return(ret);
+       }
+