summaryrefslogtreecommitdiffstats
path: root/crypto/md2
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2001-03-08 14:04:22 +0000
committerDr. Stephen Henson <steve@openssl.org>2001-03-08 14:04:22 +0000
commit2dc769a1c17e1e0c7aef6e11496c8ba2c1db2e28 (patch)
tree47bc3c6bf378e59f79c418f9956b6ed03fc4c805 /crypto/md2
parent4f98cbabdeb50d548c83a8ca36014f3011461379 (diff)
Make EVP_Digest*() routines return a value.
TODO: update docs, and make soe other routines which use EVP_Digest*() check return codes.
Diffstat (limited to 'crypto/md2')
-rw-r--r--crypto/md2/md2.h6
-rw-r--r--crypto/md2/md2_dgst.c13
2 files changed, 11 insertions, 8 deletions
diff --git a/crypto/md2/md2.h b/crypto/md2/md2.h
index 5494afd6d8..ad9241455c 100644
--- a/crypto/md2/md2.h
+++ b/crypto/md2/md2.h
@@ -80,9 +80,9 @@ typedef struct MD2state_st
} MD2_CTX;
const char *MD2_options(void);
-void MD2_Init(MD2_CTX *c);
-void MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len);
-void MD2_Final(unsigned char *md, MD2_CTX *c);
+int MD2_Init(MD2_CTX *c);
+int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len);
+int MD2_Final(unsigned char *md, MD2_CTX *c);
unsigned char *MD2(const unsigned char *d, unsigned long n,unsigned char *md);
#ifdef __cplusplus
}
diff --git a/crypto/md2/md2_dgst.c b/crypto/md2/md2_dgst.c
index 608baefa8f..e25dd00e02 100644
--- a/crypto/md2/md2_dgst.c
+++ b/crypto/md2/md2_dgst.c
@@ -115,19 +115,20 @@ const char *MD2_options(void)
return("md2(int)");
}
-void MD2_Init(MD2_CTX *c)
+int MD2_Init(MD2_CTX *c)
{
c->num=0;
memset(c->state,0,MD2_BLOCK*sizeof(MD2_INT));
memset(c->cksm,0,MD2_BLOCK*sizeof(MD2_INT));
memset(c->data,0,MD2_BLOCK);
+ return 1;
}
-void MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len)
+int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len)
{
register UCHAR *p;
- if (len == 0) return;
+ if (len == 0) return 1;
p=c->data;
if (c->num != 0)
@@ -146,7 +147,7 @@ void MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len)
memcpy(&(p[c->num]),data,(int)len);
/* data+=len; */
c->num+=(int)len;
- return;
+ return 1;
}
}
/* we now can process the input data in blocks of MD2_BLOCK
@@ -159,6 +160,7 @@ void MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len)
}
memcpy(p,data,(int)len);
c->num=(int)len;
+ return 1;
}
static void md2_block(MD2_CTX *c, const unsigned char *d)
@@ -197,7 +199,7 @@ static void md2_block(MD2_CTX *c, const unsigned char *d)
memset(state,0,48*sizeof(MD2_INT));
}
-void MD2_Final(unsigned char *md, MD2_CTX *c)
+int MD2_Final(unsigned char *md, MD2_CTX *c)
{
int i,v;
register UCHAR *cp;
@@ -219,5 +221,6 @@ void MD2_Final(unsigned char *md, MD2_CTX *c)
for (i=0; i<16; i++)
md[i]=(UCHAR)(p1[i]&0xff);
memset((char *)&c,0,sizeof(c));
+ return 1;
}