Clean up prototypes (prepare for removing NOPROTO).
[openssl.git] / crypto / evp / digest.c
index 035218d4314d2f044cc9fc0301d07231f4447608..0704827be10c29c99fb2528ba46a00aee7d87c03 100644 (file)
@@ -1,5 +1,5 @@
 /* crypto/evp/digest.c */
-/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
  * This package is an SSL implementation written
@@ -63,7 +63,7 @@
 
 void EVP_DigestInit(ctx,type)
 EVP_MD_CTX *ctx;
-EVP_MD *type;
+const EVP_MD *type;
        {
        ctx->digest=type;
        type->init(&(ctx->md));
@@ -71,7 +71,7 @@ EVP_MD *type;
 
 void EVP_DigestUpdate(ctx,data,count)
 EVP_MD_CTX *ctx;
-unsigned char *data;
+const unsigned char *data;
 unsigned int count;
        {
        ctx->digest->update(&(ctx->md.base[0]),data,(unsigned long)count);
@@ -87,3 +87,13 @@ unsigned int *size;
                *size=ctx->digest->md_size;
        memset(&(ctx->md),0,sizeof(ctx->md));
        }
+
+int EVP_MD_CTX_copy(EVP_MD_CTX *out, EVP_MD_CTX *in)
+{
+    if ((in == NULL) || (in->digest == NULL)) {
+        EVPerr(EVP_F_EVP_MD_CTX_COPY,EVP_R_INPUT_NOT_INITIALIZED);
+       return 0;
+    }
+    memcpy((char *)out,(char *)in,in->digest->ctx_size);
+    return 1;
+}