mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
[winpr,crypto] use size_t as length for md[45]
This commit is contained in:
@@ -96,7 +96,7 @@ static inline winpr_MD4_u32plus H(winpr_MD4_u32plus x, winpr_MD4_u32plus y, winp
|
||||
* This processes one or more 64-byte data blocks, but does NOT update the bit
|
||||
* counters. There are no alignment requirements.
|
||||
*/
|
||||
static const void* body(WINPR_MD4_CTX* ctx, const void* data, unsigned long size)
|
||||
static const void* body(WINPR_MD4_CTX* ctx, const void* data, size_t size)
|
||||
{
|
||||
const winpr_MD4_u32plus ac1 = 0x5a827999;
|
||||
const winpr_MD4_u32plus ac2 = 0x6ed9eba1;
|
||||
@@ -196,18 +196,18 @@ void winpr_MD4_Init(WINPR_MD4_CTX* ctx)
|
||||
ctx->hi = 0;
|
||||
}
|
||||
|
||||
void winpr_MD4_Update(WINPR_MD4_CTX* ctx, const void* data, unsigned long size)
|
||||
void winpr_MD4_Update(WINPR_MD4_CTX* ctx, const void* data, size_t size)
|
||||
{
|
||||
winpr_MD4_u32plus saved_lo = ctx->lo;
|
||||
if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
|
||||
ctx->hi++;
|
||||
ctx->hi += size >> 29;
|
||||
|
||||
unsigned long used = saved_lo & 0x3f;
|
||||
size_t used = saved_lo & 0x3f;
|
||||
|
||||
if (used)
|
||||
{
|
||||
unsigned long available = 64 - used;
|
||||
size_t available = 64 - used;
|
||||
|
||||
if (size < available)
|
||||
{
|
||||
@@ -223,7 +223,7 @@ void winpr_MD4_Update(WINPR_MD4_CTX* ctx, const void* data, unsigned long size)
|
||||
|
||||
if (size >= 64)
|
||||
{
|
||||
data = body(ctx, data, size & ~(unsigned long)0x3f);
|
||||
data = body(ctx, data, size & ~(size_t)0x3f);
|
||||
size &= 0x3f;
|
||||
}
|
||||
|
||||
@@ -240,11 +240,11 @@ static inline void mdOUT(unsigned char* dst, winpr_MD4_u32plus src)
|
||||
|
||||
void winpr_MD4_Final(unsigned char* result, WINPR_MD4_CTX* ctx)
|
||||
{
|
||||
unsigned long used = ctx->lo & 0x3f;
|
||||
size_t used = ctx->lo & 0x3f;
|
||||
|
||||
ctx->buffer[used++] = 0x80;
|
||||
|
||||
unsigned long available = 64 - used;
|
||||
size_t available = 64 - used;
|
||||
|
||||
if (available < 8)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ typedef struct
|
||||
} WINPR_MD4_CTX;
|
||||
|
||||
extern void winpr_MD4_Init(WINPR_MD4_CTX* ctx);
|
||||
extern void winpr_MD4_Update(WINPR_MD4_CTX* ctx, const void* data, unsigned long size);
|
||||
extern void winpr_MD4_Update(WINPR_MD4_CTX* ctx, const void* data, size_t size);
|
||||
extern void winpr_MD4_Final(unsigned char* result, WINPR_MD4_CTX* ctx);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -106,7 +106,7 @@ static inline winpr_MD5_u32plus I(winpr_MD5_u32plus x, winpr_MD5_u32plus y, winp
|
||||
* This processes one or more 64-byte data blocks, but does NOT update the bit
|
||||
* counters. There are no alignment requirements.
|
||||
*/
|
||||
static const void* body(WINPR_MD5_CTX* ctx, const void* data, unsigned long size)
|
||||
static const void* body(WINPR_MD5_CTX* ctx, const void* data, size_t size)
|
||||
{
|
||||
const unsigned char* ptr = (const unsigned char*)data;
|
||||
|
||||
@@ -221,18 +221,18 @@ void winpr_MD5_Init(WINPR_MD5_CTX* ctx)
|
||||
ctx->hi = 0;
|
||||
}
|
||||
|
||||
void winpr_MD5_Update(WINPR_MD5_CTX* ctx, const void* data, unsigned long size)
|
||||
void winpr_MD5_Update(WINPR_MD5_CTX* ctx, const void* data, size_t size)
|
||||
{
|
||||
winpr_MD5_u32plus saved_lo = ctx->lo;
|
||||
if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
|
||||
ctx->hi++;
|
||||
ctx->hi += size >> 29;
|
||||
|
||||
unsigned long used = saved_lo & 0x3f;
|
||||
size_t used = saved_lo & 0x3f;
|
||||
|
||||
if (used)
|
||||
{
|
||||
unsigned long available = 64 - used;
|
||||
size_t available = 64 - used;
|
||||
|
||||
if (size < available)
|
||||
{
|
||||
@@ -248,7 +248,7 @@ void winpr_MD5_Update(WINPR_MD5_CTX* ctx, const void* data, unsigned long size)
|
||||
|
||||
if (size >= 64)
|
||||
{
|
||||
data = body(ctx, data, size & ~(unsigned long)0x3f);
|
||||
data = body(ctx, data, size & ~(size_t)0x3f);
|
||||
size &= 0x3f;
|
||||
}
|
||||
|
||||
@@ -265,11 +265,11 @@ static inline void mdOUT(unsigned char* dst, winpr_MD5_u32plus src)
|
||||
|
||||
void winpr_MD5_Final(unsigned char* result, WINPR_MD5_CTX* ctx)
|
||||
{
|
||||
unsigned long used = ctx->lo & 0x3f;
|
||||
size_t used = ctx->lo & 0x3f;
|
||||
|
||||
ctx->buffer[used++] = 0x80;
|
||||
|
||||
unsigned long available = 64 - used;
|
||||
size_t available = 64 - used;
|
||||
|
||||
if (available < 8)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ typedef struct
|
||||
} WINPR_MD5_CTX;
|
||||
|
||||
extern void winpr_MD5_Init(WINPR_MD5_CTX* ctx);
|
||||
extern void winpr_MD5_Update(WINPR_MD5_CTX* ctx, const void* data, unsigned long size);
|
||||
extern void winpr_MD5_Update(WINPR_MD5_CTX* ctx, const void* data, size_t size);
|
||||
extern void winpr_MD5_Final(unsigned char* result, WINPR_MD5_CTX* ctx);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user