Explicit conversions and minor changes to prevent MSVC compiler warnings
diff --git a/library/cipher.c b/library/cipher.c
index d14781b..5edc39a 100644
--- a/library/cipher.c
+++ b/library/cipher.c
@@ -216,7 +216,7 @@
#if defined(POLARSSL_GCM_C)
if( POLARSSL_MODE_GCM == ctx->cipher_info->mode )
{
- return gcm_starts( ctx->cipher_ctx, ctx->operation,
+ return gcm_starts( (gcm_context *) ctx->cipher_ctx, ctx->operation,
ctx->iv, ctx->iv_size, ad, ad_len );
}
#endif
@@ -257,7 +257,8 @@
if( ctx->cipher_info->mode == POLARSSL_MODE_GCM )
{
*olen = ilen;
- return gcm_update( ctx->cipher_ctx, ilen, input, output );
+ return gcm_update( (gcm_context *) ctx->cipher_ctx, ilen, input,
+ output );
}
#endif
@@ -414,7 +415,7 @@
static int get_pkcs_padding( unsigned char *input, size_t input_len,
size_t *data_len )
{
- unsigned int i, padding_len = 0;
+ size_t i, padding_len = 0;
if( NULL == input || NULL == data_len )
return POLARSSL_ERR_CIPHER_BAD_INPUT_DATA;
@@ -487,7 +488,7 @@
static int get_zeros_and_len_padding( unsigned char *input, size_t input_len,
size_t *data_len )
{
- unsigned int i, padding_len = 0;
+ size_t i, padding_len = 0;
if( NULL == input || NULL == data_len )
return POLARSSL_ERR_CIPHER_BAD_INPUT_DATA;
@@ -514,7 +515,7 @@
static void add_zeros_padding( unsigned char *output,
size_t output_len, size_t data_len )
{
- unsigned char i;
+ size_t i;
for( i = data_len; i < output_len; i++ )
output[i] = 0x00;
@@ -693,7 +694,7 @@
#if defined(POLARSSL_GCM_C)
if( POLARSSL_MODE_GCM == ctx->cipher_info->mode )
- return gcm_finish( ctx->cipher_ctx, tag, tag_len );
+ return gcm_finish( (gcm_context *) ctx->cipher_ctx, tag, tag_len );
#endif
return 0;
@@ -720,8 +721,11 @@
if( tag_len > sizeof( check_tag ) )
return POLARSSL_ERR_CIPHER_BAD_INPUT_DATA;
- if( 0 != ( ret = gcm_finish( ctx->cipher_ctx, check_tag, tag_len ) ) )
+ if( 0 != ( ret = gcm_finish( (gcm_context *) ctx->cipher_ctx,
+ check_tag, tag_len ) ) )
+ {
return( ret );
+ }
/* Check the tag in "constant-time" */
for( diff = 0, i = 0; i < tag_len; i++ )