- Added const-correctness to main codebase

This commit is contained in:
Paul Bakker 2010-03-16 21:09:09 +00:00
parent 9120018f3d
commit ff60ee6c2a
49 changed files with 1221 additions and 416 deletions

View file

@ -94,7 +94,7 @@ void sha2_starts( sha2_context *ctx, int is224 )
ctx->is224 = is224;
}
static void sha2_process( sha2_context *ctx, unsigned char data[64] )
static void sha2_process( sha2_context *ctx, const unsigned char data[64] )
{
unsigned long temp1, temp2, W[64];
unsigned long A, B, C, D, E, F, G, H;
@ -228,7 +228,7 @@ static void sha2_process( sha2_context *ctx, unsigned char data[64] )
/*
* SHA-256 process buffer
*/
void sha2_update( sha2_context *ctx, unsigned char *input, int ilen )
void sha2_update( sha2_context *ctx, const unsigned char *input, int ilen )
{
int fill;
unsigned long left;
@ -314,7 +314,7 @@ void sha2_finish( sha2_context *ctx, unsigned char output[32] )
/*
* output = SHA-256( input buffer )
*/
void sha2( unsigned char *input, int ilen,
void sha2( const unsigned char *input, int ilen,
unsigned char output[32], int is224 )
{
sha2_context ctx;
@ -329,7 +329,7 @@ void sha2( unsigned char *input, int ilen,
/*
* output = SHA-256( file contents )
*/
int sha2_file( char *path, unsigned char output[32], int is224 )
int sha2_file( const char *path, unsigned char output[32], int is224 )
{
FILE *f;
size_t n;
@ -361,7 +361,7 @@ int sha2_file( char *path, unsigned char output[32], int is224 )
/*
* SHA-256 HMAC context setup
*/
void sha2_hmac_starts( sha2_context *ctx, unsigned char *key, int keylen,
void sha2_hmac_starts( sha2_context *ctx, const unsigned char *key, int keylen,
int is224 )
{
int i;
@ -392,7 +392,7 @@ void sha2_hmac_starts( sha2_context *ctx, unsigned char *key, int keylen,
/*
* SHA-256 HMAC process buffer
*/
void sha2_hmac_update( sha2_context *ctx, unsigned char *input, int ilen )
void sha2_hmac_update( sha2_context *ctx, const unsigned char *input, int ilen )
{
sha2_update( ctx, input, ilen );
}
@ -420,8 +420,8 @@ void sha2_hmac_finish( sha2_context *ctx, unsigned char output[32] )
/*
* output = HMAC-SHA-256( hmac key, input buffer )
*/
void sha2_hmac( unsigned char *key, int keylen,
unsigned char *input, int ilen,
void sha2_hmac( const unsigned char *key, int keylen,
const unsigned char *input, int ilen,
unsigned char output[32], int is224 )
{
sha2_context ctx;