mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-08 07:28:58 +01:00
Fix various compiler warnings with MSVC
Fixes various compiler warnings found with Microsoft Visual Studio 2015 (and earlier versions).
This commit is contained in:
parent
1903fb312f
commit
3c6b18df3a
3 changed files with 10 additions and 9 deletions
|
|
@ -105,7 +105,7 @@ static int cmac_multiply_by_u( unsigned char *output,
|
|||
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
}
|
||||
|
||||
for( i = blocksize - 1; i >= 0; i-- )
|
||||
for( i = (int)blocksize - 1; i >= 0; i-- )
|
||||
{
|
||||
output[i] = input[i] << 1 | overflow;
|
||||
overflow = input[i] >> 7;
|
||||
|
|
@ -209,7 +209,7 @@ int mbedtls_cipher_cmac_starts( mbedtls_cipher_context_t *ctx,
|
|||
if( ctx == NULL || ctx->cipher_info == NULL || key == NULL )
|
||||
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
|
||||
if( ( retval = mbedtls_cipher_setkey( ctx, key, keybits,
|
||||
if( ( retval = mbedtls_cipher_setkey( ctx, key, (int)keybits,
|
||||
MBEDTLS_ENCRYPT ) ) != 0 )
|
||||
return( retval );
|
||||
|
||||
|
|
@ -244,8 +244,8 @@ int mbedtls_cipher_cmac_update( mbedtls_cipher_context_t *ctx,
|
|||
{
|
||||
mbedtls_cmac_context_t* cmac_ctx;
|
||||
unsigned char *state;
|
||||
int n, j, ret = 0;
|
||||
size_t olen, block_size;
|
||||
int ret = 0;
|
||||
size_t n, j, olen, block_size;
|
||||
|
||||
if( ctx == NULL || ctx->cipher_info == NULL || input == NULL ||
|
||||
ctx->cmac_ctx == NULL )
|
||||
|
|
@ -280,8 +280,9 @@ int mbedtls_cipher_cmac_update( mbedtls_cipher_context_t *ctx,
|
|||
/* n is the number of blocks including any final partial block */
|
||||
n = ( ilen + block_size - 1 ) / block_size;
|
||||
|
||||
/* Iterate across the input data in block sized chunks */
|
||||
for( j = 0; j < n - 1; j++ )
|
||||
/* Iterate across the input data in block sized chunks, excluding any
|
||||
* final partial or complete block */
|
||||
for( j = 1; j < n; j++ )
|
||||
{
|
||||
cmac_xor_block( state, input, state, block_size );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue