mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-06 14:38:57 +01:00
- Major type rewrite of int to size_t for most variables and arguments used for buffer lengths and loops
This commit is contained in:
parent
1be81a4e5f
commit
23986e5d5d
67 changed files with 1041 additions and 949 deletions
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include "polarssl/sha2.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
|
|
@ -230,9 +229,9 @@ static void sha2_process( sha2_context *ctx, const unsigned char data[64] )
|
|||
/*
|
||||
* SHA-256 process buffer
|
||||
*/
|
||||
void sha2_update( sha2_context *ctx, const unsigned char *input, int ilen )
|
||||
void sha2_update( sha2_context *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
int fill;
|
||||
size_t fill;
|
||||
unsigned long left;
|
||||
|
||||
if( ilen <= 0 )
|
||||
|
|
@ -241,7 +240,7 @@ void sha2_update( sha2_context *ctx, const unsigned char *input, int ilen )
|
|||
left = ctx->total[0] & 0x3F;
|
||||
fill = 64 - left;
|
||||
|
||||
ctx->total[0] += ilen;
|
||||
ctx->total[0] += (unsigned long) ilen;
|
||||
ctx->total[0] &= 0xFFFFFFFF;
|
||||
|
||||
if( ctx->total[0] < (unsigned long) ilen )
|
||||
|
|
@ -316,7 +315,7 @@ void sha2_finish( sha2_context *ctx, unsigned char output[32] )
|
|||
/*
|
||||
* output = SHA-256( input buffer )
|
||||
*/
|
||||
void sha2( const unsigned char *input, int ilen,
|
||||
void sha2( const unsigned char *input, size_t ilen,
|
||||
unsigned char output[32], int is224 )
|
||||
{
|
||||
sha2_context ctx;
|
||||
|
|
@ -363,10 +362,10 @@ int sha2_file( const char *path, unsigned char output[32], int is224 )
|
|||
/*
|
||||
* SHA-256 HMAC context setup
|
||||
*/
|
||||
void sha2_hmac_starts( sha2_context *ctx, const unsigned char *key, int keylen,
|
||||
void sha2_hmac_starts( sha2_context *ctx, const unsigned char *key, size_t keylen,
|
||||
int is224 )
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
unsigned char sum[32];
|
||||
|
||||
if( keylen > 64 )
|
||||
|
|
@ -394,7 +393,7 @@ void sha2_hmac_starts( sha2_context *ctx, const unsigned char *key, int keylen,
|
|||
/*
|
||||
* SHA-256 HMAC process buffer
|
||||
*/
|
||||
void sha2_hmac_update( sha2_context *ctx, const unsigned char *input, int ilen )
|
||||
void sha2_hmac_update( sha2_context *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
sha2_update( ctx, input, ilen );
|
||||
}
|
||||
|
|
@ -431,8 +430,8 @@ void sha2_hmac_reset( sha2_context *ctx )
|
|||
/*
|
||||
* output = HMAC-SHA-256( hmac key, input buffer )
|
||||
*/
|
||||
void sha2_hmac( const unsigned char *key, int keylen,
|
||||
const unsigned char *input, int ilen,
|
||||
void sha2_hmac( const unsigned char *key, size_t keylen,
|
||||
const unsigned char *input, size_t ilen,
|
||||
unsigned char output[32], int is224 )
|
||||
{
|
||||
sha2_context ctx;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue