Delete extra ;
[oweals/openssl.git] / crypto / evp / bio_md.c
index 78c4c1f4ed287fc4ea4cd9f14a5ced1627a18623..2373c247d8afc59ebaaad779f8a4bc007c82ab18 100644 (file)
 #include <stdio.h>
 #include <errno.h>
 #include "cryptlib.h"
-#include "buffer.h"
-#include "evp.h"
+#include <openssl/buffer.h>
+#include <openssl/evp.h>
 
 /* BIO_put and BIO_get both add to the digest,
  * BIO_gets returns the digest */
 
-#ifndef NOPROTO
-static int md_write(BIO *h,char *buf,int num);
-static int md_read(BIO *h,char *buf,int size);
-/*static int md_puts(BIO *h,char *str); */
-static int md_gets(BIO *h,char *str,int size);
-static long md_ctrl(BIO *h,int cmd,long arg1,char *arg2);
+static int md_write(BIO *h, char const *buf, int num);
+static int md_read(BIO *h, char *buf, int size);
+/*static int md_puts(BIO *h, const char *str); */
+static int md_gets(BIO *h, char *str, int size);
+static long md_ctrl(BIO *h, int cmd, long arg1, void *arg2);
 static int md_new(BIO *h);
 static int md_free(BIO *data);
-#else
-static int md_write();
-static int md_read();
-/*static int md_puts(); */
-static int md_gets();
-static long md_ctrl();
-static int md_new();
-static int md_free();
-#endif
+static long md_callback_ctrl(BIO *h,int cmd,bio_info_cb *fp);
 
 static BIO_METHOD methods_md=
        {
@@ -93,6 +84,7 @@ static BIO_METHOD methods_md=
        md_ctrl,
        md_new,
        md_free,
+       md_callback_ctrl,
        };
 
 BIO_METHOD *BIO_f_md(void)
@@ -104,7 +96,7 @@ static int md_new(BIO *bi)
        {
        EVP_MD_CTX *ctx;
 
-       ctx=(EVP_MD_CTX *)Malloc(sizeof(EVP_MD_CTX));
+       ctx=(EVP_MD_CTX *)OPENSSL_malloc(sizeof(EVP_MD_CTX));
        if (ctx == NULL) return(0);
 
        bi->init=0;
@@ -116,7 +108,7 @@ static int md_new(BIO *bi)
 static int md_free(BIO *a)
        {
        if (a == NULL) return(0);
-       Free(a->ptr);
+       OPENSSL_free(a->ptr);
        a->ptr=NULL;
        a->init=0;
        a->flags=0;
@@ -147,7 +139,7 @@ static int md_read(BIO *b, char *out, int outl)
        return(ret);
        }
 
-static int md_write(BIO *b, char *in, int inl)
+static int md_write(BIO *b, const char *in, int inl)
        {
        int ret=0;
        EVP_MD_CTX *ctx;
@@ -170,7 +162,7 @@ static int md_write(BIO *b, char *in, int inl)
        return(ret);
        }
 
-static long md_ctrl(BIO *b, int cmd, long num, char *ptr)
+static long md_ctrl(BIO *b, int cmd, long num, void *ptr)
        {
        EVP_MD_CTX *ctx,*dctx,**pctx;
        const EVP_MD **ppmd;
@@ -231,6 +223,20 @@ static long md_ctrl(BIO *b, int cmd, long num, char *ptr)
        return(ret);
        }
 
+static long md_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);
+       }
+
 static int md_gets(BIO *bp, char *buf, int size)
        {
        EVP_MD_CTX *ctx;