Wrap lines to 80 columns
This commit is contained in:
parent
e553c65cc3
commit
7e9288520f
1 changed files with 14 additions and 6 deletions
|
@ -1297,7 +1297,8 @@ psa_status_t psa_asymmetric_sign(psa_key_slot_t key,
|
|||
|
||||
static psa_status_t psa_cipher_setup( psa_cipher_operation_t *operation,
|
||||
psa_key_slot_t key,
|
||||
psa_algorithm_t alg, mbedtls_operation_t cipher_operation)
|
||||
psa_algorithm_t alg,
|
||||
mbedtls_operation_t cipher_operation )
|
||||
{
|
||||
int ret = MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
|
||||
psa_status_t status;
|
||||
|
@ -1368,7 +1369,9 @@ static psa_status_t psa_cipher_setup( psa_cipher_operation_t *operation,
|
|||
|
||||
operation->key_set = 1;
|
||||
operation->alg = alg;
|
||||
operation->block_size = PSA_ALG_IS_BLOCK_CIPHER( alg ) ? PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) : 1;
|
||||
operation->block_size = ( PSA_ALG_IS_BLOCK_CIPHER( alg ) ?
|
||||
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) :
|
||||
1 );
|
||||
if( PSA_ALG_IS_BLOCK_CIPHER( alg ) || ( alg == PSA_ALG_CTR ) )
|
||||
{
|
||||
operation->iv_size = PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
|
||||
|
@ -1404,7 +1407,8 @@ psa_status_t psa_encrypt_generate_iv( psa_cipher_operation_t *operation,
|
|||
ret = PSA_ERROR_BUFFER_TOO_SMALL;
|
||||
goto exit;
|
||||
}
|
||||
ret = mbedtls_ctr_drbg_random( &global_data.ctr_drbg, iv, operation->iv_size );
|
||||
ret = mbedtls_ctr_drbg_random( &global_data.ctr_drbg,
|
||||
iv, operation->iv_size );
|
||||
if( ret != 0 )
|
||||
{
|
||||
ret = mbedtls_to_psa_error( ret );
|
||||
|
@ -1452,7 +1456,9 @@ psa_status_t psa_cipher_update( psa_cipher_operation_t *operation,
|
|||
size_t *output_length )
|
||||
{
|
||||
int ret = MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
|
||||
size_t expected_output_size = ( ( operation->ctx.cipher.unprocessed_len + input_length )/operation->block_size )*operation->block_size;
|
||||
size_t expected_output_size =
|
||||
( ( operation->ctx.cipher.unprocessed_len + input_length ) /
|
||||
operation->block_size ) * operation->block_size;
|
||||
if( ( ( PSA_ALG_IS_STREAM_CIPHER( operation->alg ) ) &&
|
||||
( output_size < input_length ) ) ||
|
||||
( ( PSA_ALG_IS_BLOCK_CIPHER( operation->alg ) ) &&
|
||||
|
@ -1487,10 +1493,12 @@ psa_status_t psa_cipher_finish( psa_cipher_operation_t *operation,
|
|||
{
|
||||
if( operation->ctx.cipher.unprocessed_len > operation->block_size )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
if( ( ( operation->alg & PSA_ALG_BLOCK_CIPHER_PADDING_MASK ) == PSA_ALG_BLOCK_CIPHER_PAD_NONE )
|
||||
if( ( ( operation->alg & PSA_ALG_BLOCK_CIPHER_PADDING_MASK )
|
||||
== PSA_ALG_BLOCK_CIPHER_PAD_NONE )
|
||||
&& ( operation->ctx.cipher.unprocessed_len != 0 ) )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
if( ( ( operation->alg & PSA_ALG_BLOCK_CIPHER_PADDING_MASK ) == PSA_ALG_BLOCK_CIPHER_PAD_PKCS7 )
|
||||
if( ( ( operation->alg & PSA_ALG_BLOCK_CIPHER_PADDING_MASK )
|
||||
== PSA_ALG_BLOCK_CIPHER_PAD_PKCS7 )
|
||||
&& ( *output_length != operation->block_size ) )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue