warnings fixes

This commit is contained in:
mohammad1603 2018-03-12 18:16:40 +02:00 committed by itayzafrir
parent 503973bdf3
commit 8275961178
2 changed files with 11 additions and 7 deletions

View File

@ -1046,8 +1046,7 @@ psa_status_t psa_decrypt_setup(psa_cipher_operation_t *operation,
psa_key_slot_t key, psa_key_slot_t key,
psa_algorithm_t alg); psa_algorithm_t alg);
psa_status_t psa_encrypt_generate_iv(psa_cipher_operation_t *operation, psa_status_t psa_encrypt_generate_iv(unsigned char *iv,
unsigned char *iv,
size_t iv_size, size_t iv_size,
size_t *iv_length); size_t *iv_length);

View File

@ -1295,7 +1295,7 @@ psa_status_t psa_asymmetric_sign(psa_key_slot_t key,
psa_status_t psa_decrypt_setup(psa_cipher_operation_t *operation, psa_status_t psa_decrypt_setup(psa_cipher_operation_t *operation,
psa_key_slot_t key, psa_key_slot_t key,
psa_algorithm_t alg); psa_algorithm_t alg)
{ {
int ret = MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE; int ret = MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
psa_status_t status; psa_status_t status;
@ -1343,8 +1343,7 @@ psa_status_t psa_decrypt_setup(psa_cipher_operation_t *operation,
return ( PSA_SUCCESS ); return ( PSA_SUCCESS );
} }
psa_status_t psa_encrypt_generate_iv(psa_cipher_operation_t *operation, psa_status_t psa_encrypt_generate_iv(unsigned char *iv,
unsigned char *iv,
size_t iv_size, size_t iv_size,
size_t *iv_length) size_t *iv_length)
{ {
@ -1357,7 +1356,7 @@ psa_status_t psa_encrypt_generate_iv(psa_cipher_operation_t *operation,
} }
*iv_length = iv_size; *iv_length = iv_size;
retuen ( PSA_SUCCESS ); return ( PSA_SUCCESS );
} }
psa_status_t psa_encrypt_set_iv(psa_cipher_operation_t *operation, psa_status_t psa_encrypt_set_iv(psa_cipher_operation_t *operation,
@ -1388,6 +1387,9 @@ psa_status_t psa_cipher_update(psa_cipher_operation_t *operation,
{ {
int ret = MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE; int ret = MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
if ( output_size < input_length )
return ( PSA_ERROR_BUFFER_TOO_SMALL );
ret = mbedtls_cipher_update( &operation->ctx.cipher, input, ret = mbedtls_cipher_update( &operation->ctx.cipher, input,
input_length, output, output_length ); input_length, output, output_length );
if (ret != 0) if (ret != 0)
@ -1406,6 +1408,9 @@ psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation,
{ {
int ret = MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE; int ret = MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
if ( output_size < operation->block_size )
return ( PSA_ERROR_BUFFER_TOO_SMALL );
if( ! operation->key_set ) if( ! operation->key_set )
return( PSA_ERROR_BAD_STATE ); return( PSA_ERROR_BAD_STATE );
if( ! operation->iv_set ) if( ! operation->iv_set )