mirror of
https://github.com/openssl/openssl.git
synced 2024-11-25 11:03:37 +08:00
Make EVP_Digest*() routines return a value.
TODO: update docs, and make soe other routines which use EVP_Digest*() check return codes.
This commit is contained in:
parent
4f98cbabde
commit
2dc769a1c1
5
CHANGES
5
CHANGES
@ -3,6 +3,11 @@
|
|||||||
|
|
||||||
Changes between 0.9.6 and 0.9.7 [xx XXX 2000]
|
Changes between 0.9.6 and 0.9.7 [xx XXX 2000]
|
||||||
|
|
||||||
|
*) Modify EVP_Digest*() routines so they now return values. Although the
|
||||||
|
internal software routines can never fail additional hardware versions
|
||||||
|
might.
|
||||||
|
[Steve Henson]
|
||||||
|
|
||||||
*) Clean up crypto/err/err.h and change some error codes to avoid conflicts:
|
*) Clean up crypto/err/err.h and change some error codes to avoid conflicts:
|
||||||
|
|
||||||
Previously ERR_R_FATAL was too small and coincided with ERR_LIB_PKCS7
|
Previously ERR_R_FATAL was too small and coincided with ERR_LIB_PKCS7
|
||||||
|
@ -61,24 +61,26 @@
|
|||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
|
|
||||||
void EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
|
int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
|
||||||
{
|
{
|
||||||
ctx->digest=type;
|
ctx->digest=type;
|
||||||
type->init(&(ctx->md));
|
return type->init(&(ctx->md));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data,
|
int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data,
|
||||||
unsigned int count)
|
unsigned int count)
|
||||||
{
|
{
|
||||||
ctx->digest->update(&(ctx->md.base[0]),data,(unsigned long)count);
|
return ctx->digest->update(&(ctx->md.base[0]),data,(unsigned long)count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size)
|
int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size)
|
||||||
{
|
{
|
||||||
ctx->digest->final(md,&(ctx->md.base[0]));
|
int ret;
|
||||||
|
ret = ctx->digest->final(md,&(ctx->md.base[0]));
|
||||||
if (size != NULL)
|
if (size != NULL)
|
||||||
*size=ctx->digest->md_size;
|
*size=ctx->digest->md_size;
|
||||||
memset(&(ctx->md),0,sizeof(ctx->md));
|
memset(&(ctx->md),0,sizeof(ctx->md));
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int EVP_MD_CTX_copy(EVP_MD_CTX *out, EVP_MD_CTX *in)
|
int EVP_MD_CTX_copy(EVP_MD_CTX *out, EVP_MD_CTX *in)
|
||||||
@ -95,8 +97,9 @@ int EVP_Digest(void *data, unsigned int count,
|
|||||||
unsigned char *md, unsigned int *size, const EVP_MD *type)
|
unsigned char *md, unsigned int *size, const EVP_MD *type)
|
||||||
{
|
{
|
||||||
EVP_MD_CTX ctx;
|
EVP_MD_CTX ctx;
|
||||||
EVP_DigestInit(&ctx, type);
|
if (!EVP_DigestInit(&ctx, type))
|
||||||
EVP_DigestUpdate(&ctx, data, count);
|
return 0;
|
||||||
EVP_DigestFinal(&ctx, md, size);
|
if (!EVP_DigestUpdate(&ctx, data, count))
|
||||||
return 1;
|
return 0;
|
||||||
|
return EVP_DigestFinal(&ctx, md, size);
|
||||||
}
|
}
|
||||||
|
@ -268,9 +268,9 @@ typedef struct env_md_st
|
|||||||
int type;
|
int type;
|
||||||
int pkey_type;
|
int pkey_type;
|
||||||
int md_size;
|
int md_size;
|
||||||
void (*init)();
|
int (*init)();
|
||||||
void (*update)();
|
int (*update)();
|
||||||
void (*final)();
|
int (*final)();
|
||||||
|
|
||||||
int (*sign)();
|
int (*sign)();
|
||||||
int (*verify)();
|
int (*verify)();
|
||||||
@ -558,10 +558,10 @@ void BIO_set_md(BIO *,const EVP_MD *md);
|
|||||||
|
|
||||||
|
|
||||||
int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in);
|
int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in);
|
||||||
void EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
|
int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
|
||||||
void EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d,
|
int EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d,
|
||||||
unsigned int cnt);
|
unsigned int cnt);
|
||||||
void EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
|
int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
|
||||||
int EVP_Digest(void *data, unsigned int count,
|
int EVP_Digest(void *data, unsigned int count,
|
||||||
unsigned char *md, unsigned int *size, const EVP_MD *type);
|
unsigned char *md, unsigned int *size, const EVP_MD *type);
|
||||||
|
|
||||||
|
@ -62,8 +62,9 @@
|
|||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
|
|
||||||
static void function(void)
|
static int function(void)
|
||||||
{
|
{
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static EVP_MD null_md=
|
static EVP_MD null_md=
|
||||||
|
@ -80,9 +80,9 @@ typedef struct MD2state_st
|
|||||||
} MD2_CTX;
|
} MD2_CTX;
|
||||||
|
|
||||||
const char *MD2_options(void);
|
const char *MD2_options(void);
|
||||||
void MD2_Init(MD2_CTX *c);
|
int MD2_Init(MD2_CTX *c);
|
||||||
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);
|
||||||
void MD2_Final(unsigned char *md, MD2_CTX *c);
|
int MD2_Final(unsigned char *md, MD2_CTX *c);
|
||||||
unsigned char *MD2(const unsigned char *d, unsigned long n,unsigned char *md);
|
unsigned char *MD2(const unsigned char *d, unsigned long n,unsigned char *md);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -115,19 +115,20 @@ const char *MD2_options(void)
|
|||||||
return("md2(int)");
|
return("md2(int)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MD2_Init(MD2_CTX *c)
|
int MD2_Init(MD2_CTX *c)
|
||||||
{
|
{
|
||||||
c->num=0;
|
c->num=0;
|
||||||
memset(c->state,0,MD2_BLOCK*sizeof(MD2_INT));
|
memset(c->state,0,MD2_BLOCK*sizeof(MD2_INT));
|
||||||
memset(c->cksm,0,MD2_BLOCK*sizeof(MD2_INT));
|
memset(c->cksm,0,MD2_BLOCK*sizeof(MD2_INT));
|
||||||
memset(c->data,0,MD2_BLOCK);
|
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;
|
register UCHAR *p;
|
||||||
|
|
||||||
if (len == 0) return;
|
if (len == 0) return 1;
|
||||||
|
|
||||||
p=c->data;
|
p=c->data;
|
||||||
if (c->num != 0)
|
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);
|
memcpy(&(p[c->num]),data,(int)len);
|
||||||
/* data+=len; */
|
/* data+=len; */
|
||||||
c->num+=(int)len;
|
c->num+=(int)len;
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* we now can process the input data in blocks of MD2_BLOCK
|
/* 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);
|
memcpy(p,data,(int)len);
|
||||||
c->num=(int)len;
|
c->num=(int)len;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void md2_block(MD2_CTX *c, const unsigned char *d)
|
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));
|
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;
|
int i,v;
|
||||||
register UCHAR *cp;
|
register UCHAR *cp;
|
||||||
@ -219,5 +221,6 @@ void MD2_Final(unsigned char *md, MD2_CTX *c)
|
|||||||
for (i=0; i<16; i++)
|
for (i=0; i<16; i++)
|
||||||
md[i]=(UCHAR)(p1[i]&0xff);
|
md[i]=(UCHAR)(p1[i]&0xff);
|
||||||
memset((char *)&c,0,sizeof(c));
|
memset((char *)&c,0,sizeof(c));
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,14 +410,14 @@
|
|||||||
* Time for some action:-)
|
* Time for some action:-)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void HASH_UPDATE (HASH_CTX *c, const void *data_, unsigned long len)
|
int HASH_UPDATE (HASH_CTX *c, const void *data_, unsigned long len)
|
||||||
{
|
{
|
||||||
const unsigned char *data=data_;
|
const unsigned char *data=data_;
|
||||||
register HASH_LONG * p;
|
register HASH_LONG * p;
|
||||||
register unsigned long l;
|
register unsigned long l;
|
||||||
int sw,sc,ew,ec;
|
int sw,sc,ew,ec;
|
||||||
|
|
||||||
if (len==0) return;
|
if (len==0) return 1;
|
||||||
|
|
||||||
l=(c->Nl+(len<<3))&0xffffffffL;
|
l=(c->Nl+(len<<3))&0xffffffffL;
|
||||||
/* 95-05-24 eay Fixed a bug with the overflow handling, thanks to
|
/* 95-05-24 eay Fixed a bug with the overflow handling, thanks to
|
||||||
@ -466,7 +466,7 @@ void HASH_UPDATE (HASH_CTX *c, const void *data_, unsigned long len)
|
|||||||
HOST_c2l_p(data,l,ec); p[sw]=l;
|
HOST_c2l_p(data,l,ec); p[sw]=l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,6 +520,7 @@ void HASH_UPDATE (HASH_CTX *c, const void *data_, unsigned long len)
|
|||||||
HOST_c2l_p(data,l,ec);
|
HOST_c2l_p(data,l,ec);
|
||||||
*p=l;
|
*p=l;
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -543,7 +544,7 @@ void HASH_TRANSFORM (HASH_CTX *c, const unsigned char *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void HASH_FINAL (unsigned char *md, HASH_CTX *c)
|
int HASH_FINAL (unsigned char *md, HASH_CTX *c)
|
||||||
{
|
{
|
||||||
register HASH_LONG *p;
|
register HASH_LONG *p;
|
||||||
register unsigned long l;
|
register unsigned long l;
|
||||||
@ -604,4 +605,5 @@ void HASH_FINAL (unsigned char *md, HASH_CTX *c)
|
|||||||
* but I'm not worried :-)
|
* but I'm not worried :-)
|
||||||
memset((void *)c,0,sizeof(HASH_CTX));
|
memset((void *)c,0,sizeof(HASH_CTX));
|
||||||
*/
|
*/
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -104,9 +104,9 @@ typedef struct MD4state_st
|
|||||||
int num;
|
int num;
|
||||||
} MD4_CTX;
|
} MD4_CTX;
|
||||||
|
|
||||||
void MD4_Init(MD4_CTX *c);
|
int MD4_Init(MD4_CTX *c);
|
||||||
void MD4_Update(MD4_CTX *c, const void *data, unsigned long len);
|
int MD4_Update(MD4_CTX *c, const void *data, unsigned long len);
|
||||||
void MD4_Final(unsigned char *md, MD4_CTX *c);
|
int MD4_Final(unsigned char *md, MD4_CTX *c);
|
||||||
unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md);
|
unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md);
|
||||||
void MD4_Transform(MD4_CTX *c, const unsigned char *b);
|
void MD4_Transform(MD4_CTX *c, const unsigned char *b);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -70,7 +70,7 @@ const char *MD4_version="MD4" OPENSSL_VERSION_PTEXT;
|
|||||||
#define INIT_DATA_C (unsigned long)0x98badcfeL
|
#define INIT_DATA_C (unsigned long)0x98badcfeL
|
||||||
#define INIT_DATA_D (unsigned long)0x10325476L
|
#define INIT_DATA_D (unsigned long)0x10325476L
|
||||||
|
|
||||||
void MD4_Init(MD4_CTX *c)
|
int MD4_Init(MD4_CTX *c)
|
||||||
{
|
{
|
||||||
c->A=INIT_DATA_A;
|
c->A=INIT_DATA_A;
|
||||||
c->B=INIT_DATA_B;
|
c->B=INIT_DATA_B;
|
||||||
@ -79,6 +79,7 @@ void MD4_Init(MD4_CTX *c)
|
|||||||
c->Nl=0;
|
c->Nl=0;
|
||||||
c->Nh=0;
|
c->Nh=0;
|
||||||
c->num=0;
|
c->num=0;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef md4_block_host_order
|
#ifndef md4_block_host_order
|
||||||
|
@ -102,9 +102,9 @@ typedef struct MD5state_st
|
|||||||
int num;
|
int num;
|
||||||
} MD5_CTX;
|
} MD5_CTX;
|
||||||
|
|
||||||
void MD5_Init(MD5_CTX *c);
|
int MD5_Init(MD5_CTX *c);
|
||||||
void MD5_Update(MD5_CTX *c, const void *data, unsigned long len);
|
int MD5_Update(MD5_CTX *c, const void *data, unsigned long len);
|
||||||
void MD5_Final(unsigned char *md, MD5_CTX *c);
|
int MD5_Final(unsigned char *md, MD5_CTX *c);
|
||||||
unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);
|
unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);
|
||||||
void MD5_Transform(MD5_CTX *c, const unsigned char *b);
|
void MD5_Transform(MD5_CTX *c, const unsigned char *b);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -70,7 +70,7 @@ const char *MD5_version="MD5" OPENSSL_VERSION_PTEXT;
|
|||||||
#define INIT_DATA_C (unsigned long)0x98badcfeL
|
#define INIT_DATA_C (unsigned long)0x98badcfeL
|
||||||
#define INIT_DATA_D (unsigned long)0x10325476L
|
#define INIT_DATA_D (unsigned long)0x10325476L
|
||||||
|
|
||||||
void MD5_Init(MD5_CTX *c)
|
int MD5_Init(MD5_CTX *c)
|
||||||
{
|
{
|
||||||
c->A=INIT_DATA_A;
|
c->A=INIT_DATA_A;
|
||||||
c->B=INIT_DATA_B;
|
c->B=INIT_DATA_B;
|
||||||
@ -79,6 +79,7 @@ void MD5_Init(MD5_CTX *c)
|
|||||||
c->Nl=0;
|
c->Nl=0;
|
||||||
c->Nh=0;
|
c->Nh=0;
|
||||||
c->num=0;
|
c->num=0;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef md5_block_host_order
|
#ifndef md5_block_host_order
|
||||||
|
@ -81,9 +81,9 @@ typedef struct mdc2_ctx_st
|
|||||||
} MDC2_CTX;
|
} MDC2_CTX;
|
||||||
|
|
||||||
|
|
||||||
void MDC2_Init(MDC2_CTX *c);
|
int MDC2_Init(MDC2_CTX *c);
|
||||||
void MDC2_Update(MDC2_CTX *c, const unsigned char *data, unsigned long len);
|
int MDC2_Update(MDC2_CTX *c, const unsigned char *data, unsigned long len);
|
||||||
void MDC2_Final(unsigned char *md, MDC2_CTX *c);
|
int MDC2_Final(unsigned char *md, MDC2_CTX *c);
|
||||||
unsigned char *MDC2(const unsigned char *d, unsigned long n,
|
unsigned char *MDC2(const unsigned char *d, unsigned long n,
|
||||||
unsigned char *md);
|
unsigned char *md);
|
||||||
|
|
||||||
|
@ -75,15 +75,16 @@
|
|||||||
*((c)++)=(unsigned char)(((l)>>24L)&0xff))
|
*((c)++)=(unsigned char)(((l)>>24L)&0xff))
|
||||||
|
|
||||||
static void mdc2_body(MDC2_CTX *c, const unsigned char *in, unsigned int len);
|
static void mdc2_body(MDC2_CTX *c, const unsigned char *in, unsigned int len);
|
||||||
void MDC2_Init(MDC2_CTX *c)
|
int MDC2_Init(MDC2_CTX *c)
|
||||||
{
|
{
|
||||||
c->num=0;
|
c->num=0;
|
||||||
c->pad_type=1;
|
c->pad_type=1;
|
||||||
memset(&(c->h[0]),0x52,MDC2_BLOCK);
|
memset(&(c->h[0]),0x52,MDC2_BLOCK);
|
||||||
memset(&(c->hh[0]),0x25,MDC2_BLOCK);
|
memset(&(c->hh[0]),0x25,MDC2_BLOCK);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MDC2_Update(MDC2_CTX *c, const unsigned char *in, unsigned long len)
|
int MDC2_Update(MDC2_CTX *c, const unsigned char *in, unsigned long len)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ void MDC2_Update(MDC2_CTX *c, const unsigned char *in, unsigned long len)
|
|||||||
/* partial block */
|
/* partial block */
|
||||||
memcpy(&(c->data[i]),in,(int)len);
|
memcpy(&(c->data[i]),in,(int)len);
|
||||||
c->num+=(int)len;
|
c->num+=(int)len;
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -116,6 +117,7 @@ void MDC2_Update(MDC2_CTX *c, const unsigned char *in, unsigned long len)
|
|||||||
memcpy(&(c->data[0]),&(in[i]),j);
|
memcpy(&(c->data[0]),&(in[i]),j);
|
||||||
c->num=j;
|
c->num=j;
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mdc2_body(MDC2_CTX *c, const unsigned char *in, unsigned int len)
|
static void mdc2_body(MDC2_CTX *c, const unsigned char *in, unsigned int len)
|
||||||
@ -156,7 +158,7 @@ static void mdc2_body(MDC2_CTX *c, const unsigned char *in, unsigned int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MDC2_Final(unsigned char *md, MDC2_CTX *c)
|
int MDC2_Final(unsigned char *md, MDC2_CTX *c)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
@ -171,6 +173,7 @@ void MDC2_Final(unsigned char *md, MDC2_CTX *c)
|
|||||||
}
|
}
|
||||||
memcpy(md,(char *)c->h,MDC2_BLOCK);
|
memcpy(md,(char *)c->h,MDC2_BLOCK);
|
||||||
memcpy(&(md[MDC2_BLOCK]),(char *)c->hh,MDC2_BLOCK);
|
memcpy(&(md[MDC2_BLOCK]),(char *)c->hh,MDC2_BLOCK);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef TEST
|
#undef TEST
|
||||||
|
@ -90,9 +90,9 @@ typedef struct RIPEMD160state_st
|
|||||||
int num;
|
int num;
|
||||||
} RIPEMD160_CTX;
|
} RIPEMD160_CTX;
|
||||||
|
|
||||||
void RIPEMD160_Init(RIPEMD160_CTX *c);
|
int RIPEMD160_Init(RIPEMD160_CTX *c);
|
||||||
void RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, unsigned long len);
|
int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, unsigned long len);
|
||||||
void RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);
|
int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);
|
||||||
unsigned char *RIPEMD160(const unsigned char *d, unsigned long n,
|
unsigned char *RIPEMD160(const unsigned char *d, unsigned long n,
|
||||||
unsigned char *md);
|
unsigned char *md);
|
||||||
void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b);
|
void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b);
|
||||||
|
@ -69,7 +69,7 @@ const char *RMD160_version="RIPE-MD160" OPENSSL_VERSION_PTEXT;
|
|||||||
void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,int num);
|
void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,int num);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
void RIPEMD160_Init(RIPEMD160_CTX *c)
|
int RIPEMD160_Init(RIPEMD160_CTX *c)
|
||||||
{
|
{
|
||||||
c->A=RIPEMD160_A;
|
c->A=RIPEMD160_A;
|
||||||
c->B=RIPEMD160_B;
|
c->B=RIPEMD160_B;
|
||||||
@ -79,6 +79,7 @@ void RIPEMD160_Init(RIPEMD160_CTX *c)
|
|||||||
c->Nl=0;
|
c->Nl=0;
|
||||||
c->Nh=0;
|
c->Nh=0;
|
||||||
c->num=0;
|
c->num=0;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef ripemd160_block_host_order
|
#ifndef ripemd160_block_host_order
|
||||||
|
@ -101,16 +101,16 @@ typedef struct SHAstate_st
|
|||||||
} SHA_CTX;
|
} SHA_CTX;
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_SHA0
|
#ifndef OPENSSL_NO_SHA0
|
||||||
void SHA_Init(SHA_CTX *c);
|
int SHA_Init(SHA_CTX *c);
|
||||||
void SHA_Update(SHA_CTX *c, const void *data, unsigned long len);
|
int SHA_Update(SHA_CTX *c, const void *data, unsigned long len);
|
||||||
void SHA_Final(unsigned char *md, SHA_CTX *c);
|
int SHA_Final(unsigned char *md, SHA_CTX *c);
|
||||||
unsigned char *SHA(const unsigned char *d, unsigned long n,unsigned char *md);
|
unsigned char *SHA(const unsigned char *d, unsigned long n,unsigned char *md);
|
||||||
void SHA_Transform(SHA_CTX *c, const unsigned char *data);
|
void SHA_Transform(SHA_CTX *c, const unsigned char *data);
|
||||||
#endif
|
#endif
|
||||||
#ifndef OPENSSL_NO_SHA1
|
#ifndef OPENSSL_NO_SHA1
|
||||||
void SHA1_Init(SHA_CTX *c);
|
int SHA1_Init(SHA_CTX *c);
|
||||||
void SHA1_Update(SHA_CTX *c, const void *data, unsigned long len);
|
int SHA1_Update(SHA_CTX *c, const void *data, unsigned long len);
|
||||||
void SHA1_Final(unsigned char *md, SHA_CTX *c);
|
int SHA1_Final(unsigned char *md, SHA_CTX *c);
|
||||||
unsigned char *SHA1(const unsigned char *d, unsigned long n,unsigned char *md);
|
unsigned char *SHA1(const unsigned char *d, unsigned long n,unsigned char *md);
|
||||||
void SHA1_Transform(SHA_CTX *c, const unsigned char *data);
|
void SHA1_Transform(SHA_CTX *c, const unsigned char *data);
|
||||||
#endif
|
#endif
|
||||||
|
@ -138,7 +138,7 @@
|
|||||||
#define INIT_DATA_h3 0x10325476UL
|
#define INIT_DATA_h3 0x10325476UL
|
||||||
#define INIT_DATA_h4 0xc3d2e1f0UL
|
#define INIT_DATA_h4 0xc3d2e1f0UL
|
||||||
|
|
||||||
void HASH_INIT (SHA_CTX *c)
|
int HASH_INIT (SHA_CTX *c)
|
||||||
{
|
{
|
||||||
c->h0=INIT_DATA_h0;
|
c->h0=INIT_DATA_h0;
|
||||||
c->h1=INIT_DATA_h1;
|
c->h1=INIT_DATA_h1;
|
||||||
@ -148,6 +148,7 @@ void HASH_INIT (SHA_CTX *c)
|
|||||||
c->Nl=0;
|
c->Nl=0;
|
||||||
c->Nh=0;
|
c->Nh=0;
|
||||||
c->num=0;
|
c->num=0;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define K_00_19 0x5a827999UL
|
#define K_00_19 0x5a827999UL
|
||||||
|
Loading…
Reference in New Issue
Block a user