aboutsummaryrefslogtreecommitdiff
path: root/library/md2.c
diff options
context:
space:
mode:
authorPaul Bakker <p.j.bakker@polarssl.org>2011-04-24 08:57:21 +0000
committerPaul Bakker <p.j.bakker@polarssl.org>2011-04-24 08:57:21 +0000
commit23986e5d5d501ae93bed161752708ba18fb9e016 (patch)
treec6e3d8251151695fcd38167c21af5e5290f915b3 /library/md2.c
parent1be81a4e5feca5b46aa886b55a0096f2dfb33c1b (diff)
downloadmbedtls-23986e5d5d501ae93bed161752708ba18fb9e016.zip
mbedtls-23986e5d5d501ae93bed161752708ba18fb9e016.tar.gz
mbedtls-23986e5d5d501ae93bed161752708ba18fb9e016.tar.bz2
- Major type rewrite of int to size_t for most variables and arguments used for buffer lengths and loops
Diffstat (limited to 'library/md2.c')
-rw-r--r--library/md2.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/library/md2.c b/library/md2.c
index 7741033..4daea58 100644
--- a/library/md2.c
+++ b/library/md2.c
@@ -35,7 +35,6 @@
#include "polarssl/md2.h"
-#include <string.h>
#include <stdio.h>
static const unsigned char PI_SUBST[256] =
@@ -116,9 +115,9 @@ static void md2_process( md2_context *ctx )
/*
* MD2 process buffer
*/
-void md2_update( md2_context *ctx, const unsigned char *input, int ilen )
+void md2_update( md2_context *ctx, const unsigned char *input, size_t ilen )
{
- int fill;
+ size_t fill;
while( ilen > 0 )
{
@@ -146,7 +145,7 @@ void md2_update( md2_context *ctx, const unsigned char *input, int ilen )
*/
void md2_finish( md2_context *ctx, unsigned char output[16] )
{
- int i;
+ size_t i;
unsigned char x;
x = (unsigned char)( 16 - ctx->left );
@@ -165,7 +164,7 @@ void md2_finish( md2_context *ctx, unsigned char output[16] )
/*
* output = MD2( input buffer )
*/
-void md2( const unsigned char *input, int ilen, unsigned char output[16] )
+void md2( const unsigned char *input, size_t ilen, unsigned char output[16] )
{
md2_context ctx;
@@ -211,9 +210,9 @@ int md2_file( const char *path, unsigned char output[16] )
/*
* MD2 HMAC context setup
*/
-void md2_hmac_starts( md2_context *ctx, const unsigned char *key, int keylen )
+void md2_hmac_starts( md2_context *ctx, const unsigned char *key, size_t keylen )
{
- int i;
+ size_t i;
unsigned char sum[16];
if( keylen > 64 )
@@ -241,7 +240,7 @@ void md2_hmac_starts( md2_context *ctx, const unsigned char *key, int keylen )
/*
* MD2 HMAC process buffer
*/
-void md2_hmac_update( md2_context *ctx, const unsigned char *input, int ilen )
+void md2_hmac_update( md2_context *ctx, const unsigned char *input, size_t ilen )
{
md2_update( ctx, input, ilen );
}
@@ -274,8 +273,8 @@ void md2_hmac_reset( md2_context *ctx )
/*
* output = HMAC-MD2( hmac key, input buffer )
*/
-void md2_hmac( const unsigned char *key, int keylen,
- const unsigned char *input, int ilen,
+void md2_hmac( const unsigned char *key, size_t keylen,
+ const unsigned char *input, size_t ilen,
unsigned char output[16] )
{
md2_context ctx;