提交 9e0aad9f 编写于 作者: A Andy Polyakov

size_t-fication of message digest APIs. We should size_t-fy more APIs...

上级 1c7a0e28
......@@ -305,7 +305,7 @@ static int test_sha1_init(EVP_MD_CTX *ctx)
#endif
return SHA1_Init(ctx->md_data);
}
static int test_sha1_update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
static int test_sha1_update(EVP_MD_CTX *ctx,const void *data,size_t count)
{
#ifdef TEST_ENG_OPENSSL_SHA_P_UPDATE
fprintf(stderr, "(TEST_ENG_OPENSSL_SHA) test_sha1_update() called\n");
......
......@@ -208,9 +208,9 @@ skip_to_init:
}
int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data,
unsigned int count)
size_t count)
{
return ctx->digest->update(ctx,data,(unsigned long)count);
return ctx->digest->update(ctx,data,count);
}
/* The caller can assume that this removes any secret data from the context */
......@@ -285,7 +285,7 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)
return 1;
}
int EVP_Digest(const void *data, unsigned int count,
int EVP_Digest(const void *data, size_t count,
unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl)
{
EVP_MD_CTX ctx;
......
......@@ -227,7 +227,7 @@ struct env_md_st
int md_size;
unsigned long flags;
int (*init)(EVP_MD_CTX *ctx);
int (*update)(EVP_MD_CTX *ctx,const void *data,unsigned long count);
int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count);
int (*final)(EVP_MD_CTX *ctx,unsigned char *md);
int (*copy)(EVP_MD_CTX *to,const EVP_MD_CTX *from);
int (*cleanup)(EVP_MD_CTX *ctx);
......@@ -490,9 +490,9 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in);
#define EVP_MD_CTX_test_flags(ctx,flgs) ((ctx)->flags&(flgs))
int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
int EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d,
unsigned int cnt);
size_t cnt);
int EVP_DigestFinal_ex(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
int EVP_Digest(const void *data, unsigned int count,
int EVP_Digest(const void *data, size_t count,
unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl);
int EVP_MD_CTX_copy(EVP_MD_CTX *out,const EVP_MD_CTX *in);
......
......@@ -67,7 +67,7 @@
static int init(EVP_MD_CTX *ctx)
{ return SHA1_Init(ctx->md_data); }
static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
{ return SHA1_Update(ctx->md_data,data,count); }
static int final(EVP_MD_CTX *ctx,unsigned char *md)
......
......@@ -69,7 +69,7 @@
static int init(EVP_MD_CTX *ctx)
{ return SHA1_Init(ctx->md_data); }
static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
{ return SHA1_Update(ctx->md_data,data,count); }
static int final(EVP_MD_CTX *ctx,unsigned char *md)
......
......@@ -119,7 +119,7 @@
static int init(EVP_MD_CTX *ctx)
{ return SHA1_Init(ctx->md_data); }
static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
{ return SHA1_Update(ctx->md_data,data,count); }
static int final(EVP_MD_CTX *ctx,unsigned char *md)
......
......@@ -70,7 +70,7 @@
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)
static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
{ return MD2_Update(ctx->md_data,data,count); }
static int final(EVP_MD_CTX *ctx,unsigned char *md)
......
......@@ -70,7 +70,7 @@
static int init(EVP_MD_CTX *ctx)
{ return MD4_Init(ctx->md_data); }
static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
{ return MD4_Update(ctx->md_data,data,count); }
static int final(EVP_MD_CTX *ctx,unsigned char *md)
......
......@@ -70,7 +70,7 @@
static int init(EVP_MD_CTX *ctx)
{ return MD5_Init(ctx->md_data); }
static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
{ return MD5_Update(ctx->md_data,data,count); }
static int final(EVP_MD_CTX *ctx,unsigned char *md)
......
......@@ -70,7 +70,7 @@
static int init(EVP_MD_CTX *ctx)
{ return MDC2_Init(ctx->md_data); }
static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
{ return MDC2_Update(ctx->md_data,data,count); }
static int final(EVP_MD_CTX *ctx,unsigned char *md)
......
......@@ -65,7 +65,7 @@
static int init(EVP_MD_CTX *ctx)
{ return 1; }
static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
{ return 1; }
static int final(EVP_MD_CTX *ctx,unsigned char *md)
......
......@@ -70,7 +70,7 @@
static int init(EVP_MD_CTX *ctx)
{ return RIPEMD160_Init(ctx->md_data); }
static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
{ return RIPEMD160_Update(ctx->md_data,data,count); }
static int final(EVP_MD_CTX *ctx,unsigned char *md)
......
......@@ -69,7 +69,7 @@
static int init(EVP_MD_CTX *ctx)
{ return SHA_Init(ctx->md_data); }
static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
{ return SHA_Update(ctx->md_data,data,count); }
static int final(EVP_MD_CTX *ctx,unsigned char *md)
......
......@@ -69,7 +69,7 @@
static int init(EVP_MD_CTX *ctx)
{ return SHA1_Init(ctx->md_data); }
static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
{ return SHA1_Update(ctx->md_data,data,count); }
static int final(EVP_MD_CTX *ctx,unsigned char *md)
......
......@@ -121,7 +121,7 @@ void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
HMAC_Init_ex(ctx,key,len,md, NULL);
}
void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len)
void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len)
{
EVP_DigestUpdate(&ctx->md_ctx,data,len);
}
......@@ -156,7 +156,7 @@ void HMAC_CTX_cleanup(HMAC_CTX *ctx)
}
unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
const unsigned char *d, int n, unsigned char *md,
const unsigned char *d, size_t n, unsigned char *md,
unsigned int *md_len)
{
HMAC_CTX c;
......
......@@ -94,10 +94,10 @@ void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md); /* deprecated */
void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md, ENGINE *impl);
void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len);
void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);
void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
const unsigned char *d, int n, unsigned char *md,
const unsigned char *d, size_t n, unsigned char *md,
unsigned int *md_len);
......
......@@ -81,9 +81,9 @@ typedef struct MD2state_st
const char *MD2_options(void);
int MD2_Init(MD2_CTX *c);
int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len);
int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len);
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, size_t n,unsigned char *md);
#ifdef __cplusplus
}
#endif
......
......@@ -125,7 +125,7 @@ int MD2_Init(MD2_CTX *c)
return 1;
}
int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len)
int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len)
{
register UCHAR *p;
......@@ -145,7 +145,7 @@ int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len)
}
else
{
memcpy(&(p[c->num]),data,(int)len);
memcpy(&(p[c->num]),data,len);
/* data+=len; */
c->num+=(int)len;
return 1;
......@@ -159,7 +159,7 @@ int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len)
data+=MD2_BLOCK;
len-=MD2_BLOCK;
}
memcpy(p,data,(int)len);
memcpy(p,data,len);
c->num=(int)len;
return 1;
}
......
......@@ -63,7 +63,7 @@
/* This is a separate file so that #defines in cryptlib.h can
* map my MD functions to different names */
unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md)
unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md)
{
MD2_CTX c;
static unsigned char m[MD2_DIGEST_LENGTH];
......
......@@ -410,21 +410,21 @@
* Time for some action:-)
*/
int HASH_UPDATE (HASH_CTX *c, const void *data_, unsigned long len)
int HASH_UPDATE (HASH_CTX *c, const void *data_, size_t len)
{
const unsigned char *data=data_;
register HASH_LONG * p;
register unsigned long l;
register HASH_LONG l;
int sw,sc,ew,ec;
if (len==0) return 1;
l=(c->Nl+(len<<3))&0xffffffffL;
l=(c->Nl+(((HASH_LONG)len)<<3))&0xffffffffUL;
/* 95-05-24 eay Fixed a bug with the overflow handling, thanks to
* Wei Dai <weidai@eskimo.com> for pointing it out. */
if (l < c->Nl) /* overflow */
c->Nh++;
c->Nh+=(len>>29);
c->Nh+=(len>>29); /* might cause compiler warning on 16-bit */
c->Nl=l;
if (c->num != 0)
......
......@@ -105,9 +105,9 @@ typedef struct MD4state_st
} MD4_CTX;
int MD4_Init(MD4_CTX *c);
int MD4_Update(MD4_CTX *c, const void *data, unsigned long len);
int MD4_Update(MD4_CTX *c, const void *data, size_t len);
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, size_t n, unsigned char *md);
void MD4_Transform(MD4_CTX *c, const unsigned char *b);
#ifdef __cplusplus
}
......
......@@ -83,7 +83,7 @@ int MD4_Init(MD4_CTX *c)
}
#ifndef md4_block_host_order
void md4_block_host_order (MD4_CTX *c, const void *data, int num)
void md4_block_host_order (MD4_CTX *c, const void *data, size_t num)
{
const MD4_LONG *X=data;
register unsigned MD32_REG_T A,B,C,D;
......@@ -159,7 +159,7 @@ void md4_block_host_order (MD4_CTX *c, const void *data, int num)
#ifdef X
#undef X
#endif
void md4_block_data_order (MD4_CTX *c, const void *data_, int num)
void md4_block_data_order (MD4_CTX *c, const void *data_, size_t num)
{
const unsigned char *data=data_;
register unsigned MD32_REG_T A,B,C,D,l;
......
......@@ -65,8 +65,8 @@
#define MD4_LONG_LOG2 2 /* default to 32 bits */
#endif
void md4_block_host_order (MD4_CTX *c, const void *p,int num);
void md4_block_data_order (MD4_CTX *c, const void *p,int num);
void md4_block_host_order (MD4_CTX *c, const void *p,size_t num);
void md4_block_data_order (MD4_CTX *c, const void *p,size_t num);
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__)
/*
......
......@@ -65,7 +65,7 @@
#include <openssl/ebcdic.h>
#endif
unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md)
unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md)
{
MD4_CTX c;
static unsigned char m[MD4_DIGEST_LENGTH];
......
......@@ -105,9 +105,9 @@ typedef struct MD5state_st
} MD5_CTX;
int MD5_Init(MD5_CTX *c);
int MD5_Update(MD5_CTX *c, const void *data, unsigned long len);
int MD5_Update(MD5_CTX *c, const void *data, size_t len);
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, size_t n, unsigned char *md);
void MD5_Transform(MD5_CTX *c, const unsigned char *b);
#ifdef __cplusplus
}
......
......@@ -83,7 +83,7 @@ int MD5_Init(MD5_CTX *c)
}
#ifndef md5_block_host_order
void md5_block_host_order (MD5_CTX *c, const void *data, int num)
void md5_block_host_order (MD5_CTX *c, const void *data, size_t num)
{
const MD5_LONG *X=data;
register unsigned MD32_REG_T A,B,C,D;
......@@ -176,7 +176,7 @@ void md5_block_host_order (MD5_CTX *c, const void *data, int num)
#ifdef X
#undef X
#endif
void md5_block_data_order (MD5_CTX *c, const void *data_, int num)
void md5_block_data_order (MD5_CTX *c, const void *data_, size_t num)
{
const unsigned char *data=data_;
register unsigned MD32_REG_T A,B,C,D,l;
......
......@@ -69,13 +69,13 @@
# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__)
# define md5_block_host_order md5_block_asm_host_order
# elif defined(__sparc) && defined(OPENSSL_SYS_ULTRASPARC)
void md5_block_asm_data_order_aligned (MD5_CTX *c, const MD5_LONG *p,int num);
void md5_block_asm_data_order_aligned (MD5_CTX *c, const MD5_LONG *p,size_t num);
# define HASH_BLOCK_DATA_ORDER_ALIGNED md5_block_asm_data_order_aligned
# endif
#endif
void md5_block_host_order (MD5_CTX *c, const void *p,int num);
void md5_block_data_order (MD5_CTX *c, const void *p,int num);
void md5_block_host_order (MD5_CTX *c, const void *p,size_t num);
void md5_block_data_order (MD5_CTX *c, const void *p,size_t num);
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__)
/*
......
......@@ -65,7 +65,7 @@
#include <openssl/ebcdic.h>
#endif
unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md)
unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md)
{
MD5_CTX c;
static unsigned char m[MD5_DIGEST_LENGTH];
......
......@@ -82,9 +82,9 @@ typedef struct mdc2_ctx_st
int MDC2_Init(MDC2_CTX *c);
int MDC2_Update(MDC2_CTX *c, const unsigned char *data, unsigned long len);
int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len);
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, size_t n,
unsigned char *md);
#ifdef __cplusplus
......
......@@ -60,7 +60,7 @@
#include "cryptlib.h"
#include <openssl/mdc2.h>
unsigned char *MDC2(const unsigned char *d, unsigned long n, unsigned char *md)
unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md)
{
MDC2_CTX c;
static unsigned char m[MDC2_DIGEST_LENGTH];
......
......@@ -74,7 +74,7 @@
*((c)++)=(unsigned char)(((l)>>16L)&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, size_t len);
int MDC2_Init(MDC2_CTX *c)
{
c->num=0;
......@@ -84,9 +84,9 @@ int MDC2_Init(MDC2_CTX *c)
return 1;
}
int MDC2_Update(MDC2_CTX *c, const unsigned char *in, unsigned long len)
int MDC2_Update(MDC2_CTX *c, const unsigned char *in, size_t len)
{
int i,j;
size_t i,j;
i=c->num;
if (i != 0)
......@@ -94,7 +94,7 @@ int MDC2_Update(MDC2_CTX *c, const unsigned char *in, unsigned long len)
if (i+len < MDC2_BLOCK)
{
/* partial block */
memcpy(&(c->data[i]),in,(int)len);
memcpy(&(c->data[i]),in,len);
c->num+=(int)len;
return 1;
}
......@@ -109,25 +109,25 @@ int MDC2_Update(MDC2_CTX *c, const unsigned char *in, unsigned long len)
mdc2_body(c,&(c->data[0]),MDC2_BLOCK);
}
}
i=(int)(len&(unsigned long)~(MDC2_BLOCK-1));
i=len&~((size_t)MDC2_BLOCK-1);
if (i > 0) mdc2_body(c,in,i);
j=(int)len-i;
j=len-i;
if (j > 0)
{
memcpy(&(c->data[0]),&(in[i]),j);
c->num=j;
c->num=(int)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, size_t len)
{
register DES_LONG tin0,tin1;
register DES_LONG ttin0,ttin1;
DES_LONG d[2],dd[2];
DES_key_schedule k;
unsigned char *p;
unsigned int i;
size_t i;
for (i=0; i<len; i+=8)
{
......
......@@ -91,9 +91,9 @@ typedef struct RIPEMD160state_st
} RIPEMD160_CTX;
int RIPEMD160_Init(RIPEMD160_CTX *c);
int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, unsigned long len);
int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len);
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, size_t n,
unsigned char *md);
void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b);
#ifdef __cplusplus
......
......@@ -63,10 +63,10 @@
const char *RMD160_version="RIPE-MD160" OPENSSL_VERSION_PTEXT;
# ifdef RMD160_ASM
void ripemd160_block_x86(RIPEMD160_CTX *c, unsigned long *p,int num);
void ripemd160_block_x86(RIPEMD160_CTX *c, unsigned long *p,size_t num);
# define ripemd160_block ripemd160_block_x86
# else
void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,int num);
void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,size_t num);
# endif
int RIPEMD160_Init(RIPEMD160_CTX *c)
......@@ -87,7 +87,7 @@ int RIPEMD160_Init(RIPEMD160_CTX *c)
#undef X
#endif
#define X(i) XX[i]
void ripemd160_block_host_order (RIPEMD160_CTX *ctx, const void *p, int num)
void ripemd160_block_host_order (RIPEMD160_CTX *ctx, const void *p, size_t num)
{
const RIPEMD160_LONG *XX=p;
register unsigned MD32_REG_T A,B,C,D,E;
......@@ -287,7 +287,7 @@ void ripemd160_block_host_order (RIPEMD160_CTX *ctx, const void *p, int num)
#ifdef X
#undef X
#endif
void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, int num)
void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num)
{
const unsigned char *data=p;
register unsigned MD32_REG_T A,B,C,D,E;
......
......@@ -76,8 +76,8 @@
# endif
#endif
void ripemd160_block_host_order (RIPEMD160_CTX *c, const void *p,int num);
void ripemd160_block_data_order (RIPEMD160_CTX *c, const void *p,int num);
void ripemd160_block_host_order (RIPEMD160_CTX *c, const void *p,size_t num);
void ripemd160_block_data_order (RIPEMD160_CTX *c, const void *p,size_t num);
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__)
#define ripemd160_block_data_order ripemd160_block_host_order
......
......@@ -61,7 +61,7 @@
#include <openssl/ripemd.h>
#include <openssl/crypto.h>
unsigned char *RIPEMD160(const unsigned char *d, unsigned long n,
unsigned char *RIPEMD160(const unsigned char *d, size_t n,
unsigned char *md)
{
RIPEMD160_CTX c;
......
......@@ -102,16 +102,16 @@ typedef struct SHAstate_st
#ifndef OPENSSL_NO_SHA0
int SHA_Init(SHA_CTX *c);
int SHA_Update(SHA_CTX *c, const void *data, unsigned long len);
int SHA_Update(SHA_CTX *c, const void *data, size_t len);
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, size_t n, unsigned char *md);
void SHA_Transform(SHA_CTX *c, const unsigned char *data);
#endif
#ifndef OPENSSL_NO_SHA1
int SHA1_Init(SHA_CTX *c);
int SHA1_Update(SHA_CTX *c, const void *data, unsigned long len);
int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
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, size_t n, unsigned char *md);
void SHA1_Transform(SHA_CTX *c, const unsigned char *data);
#endif
......
......@@ -62,7 +62,7 @@
#include <openssl/crypto.h>
#ifndef OPENSSL_NO_SHA1
unsigned char *SHA1(const unsigned char *d, unsigned long n, unsigned char *md)
unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md)
{
SHA_CTX c;
static unsigned char m[SHA_DIGEST_LENGTH];
......
......@@ -92,8 +92,8 @@
# define HASH_BLOCK_DATA_ORDER sha_block_data_order
# define Xupdate(a,ix,ia,ib,ic,id) (ix=(a)=(ia^ib^ic^id))
void sha_block_host_order (SHA_CTX *c, const void *p,int num);
void sha_block_data_order (SHA_CTX *c, const void *p,int num);
void sha_block_host_order (SHA_CTX *c, const void *p,size_t num);
void sha_block_data_order (SHA_CTX *c, const void *p,size_t num);
#elif defined(SHA_1)
......@@ -123,8 +123,8 @@
# define HASH_BLOCK_DATA_ORDER_ALIGNED sha1_block_asm_data_order
# endif
# endif
void sha1_block_host_order (SHA_CTX *c, const void *p,int num);
void sha1_block_data_order (SHA_CTX *c, const void *p,int num);
void sha1_block_host_order (SHA_CTX *c, const void *p,size_t num);
void sha1_block_data_order (SHA_CTX *c, const void *p,size_t num);
#else
# error "Either SHA_0 or SHA_1 must be defined."
......@@ -223,7 +223,7 @@ int HASH_INIT (SHA_CTX *c)
#endif
#ifndef DONT_IMPLEMENT_BLOCK_HOST_ORDER
void HASH_BLOCK_HOST_ORDER (SHA_CTX *c, const void *d, int num)
void HASH_BLOCK_HOST_ORDER (SHA_CTX *c, const void *d, size_t num)
{
const SHA_LONG *W=d;
register unsigned MD32_REG_T A,B,C,D,E,T;
......@@ -348,7 +348,7 @@ void HASH_BLOCK_HOST_ORDER (SHA_CTX *c, const void *d, int num)
#endif
#ifndef DONT_IMPLEMENT_BLOCK_DATA_ORDER
void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, int num)
void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num)
{
const unsigned char *data=p;
register unsigned MD32_REG_T A,B,C,D,E,T,l;
......@@ -505,7 +505,7 @@ void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, int num)
A=ROTATE(A,5)+T+xa; } while(0)
#ifndef DONT_IMPLEMENT_BLOCK_HOST_ORDER
void HASH_BLOCK_HOST_ORDER (SHA_CTX *c, const void *d, int num)
void HASH_BLOCK_HOST_ORDER (SHA_CTX *c, const void *d, size_t num)
{
const SHA_LONG *W=d;
register unsigned MD32_REG_T A,B,C,D,E,T;
......@@ -551,7 +551,7 @@ void HASH_BLOCK_HOST_ORDER (SHA_CTX *c, const void *d, int num)
#endif
#ifndef DONT_IMPLEMENT_BLOCK_DATA_ORDER
void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, int num)
void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num)
{
const unsigned char *data=p;
register unsigned MD32_REG_T A,B,C,D,E,T,l;
......
......@@ -62,7 +62,7 @@
#include <openssl/crypto.h>
#ifndef OPENSSL_NO_SHA0
unsigned char *SHA(const unsigned char *d, unsigned long n, unsigned char *md)
unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md)
{
SHA_CTX c;
static unsigned char m[SHA_DIGEST_LENGTH];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册