Make MD functions take EVP_MD_CTX * instead of void *, add copy() function.
[openssl.git] / crypto / evp / m_md2.c
index 17360c100e55136401717bc7ddc17b686bd3ff7c..8f95541c6a30af69cdf24574d88994ff3dc8ef37 100644 (file)
@@ -1,5 +1,5 @@
 /* crypto/evp/m_md2.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
  * [including the GNU Public Licence.]
  */
 
+#ifndef OPENSSL_NO_MD2
 #include <stdio.h>
 #include "cryptlib.h"
-#include "evp.h"
-#include "objects.h"
-#include "x509.h"
+#include <openssl/evp.h>
+#include <openssl/objects.h>
+#include <openssl/x509.h>
+#include <openssl/md2.h>
 
-static EVP_MD md2_md=
+static int init(EVP_MD_CTX *ctx)
+       { return MD2_Init(ctx->md_data); }
+
+static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
+       { return MD2_Update(ctx->md_data,data,count); }
+
+static int final(EVP_MD_CTX *ctx,unsigned char *md)
+       { return MD2_Final(md,ctx->md_data); }
+
+static const EVP_MD md2_md=
        {
        NID_md2,
        NID_md2WithRSAEncryption,
        MD2_DIGEST_LENGTH,
-       MD2_Init,
-       MD2_Update,
-       MD2_Final,
+       0,
+       init,
+       update,
+       final,
+       NULL,
        EVP_PKEY_RSA_method,
+       MD2_BLOCK,
+       sizeof(EVP_MD *)+sizeof(MD2_CTX),
        };
 
-EVP_MD *EVP_md2()
+const EVP_MD *EVP_md2(void)
        {
        return(&md2_md);
        }
-
+#endif