Use psa_status_to_mbedtls() for psa error case
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
fe7397d8a7
commit
ce09e7d868
2 changed files with 21 additions and 21 deletions
|
@ -728,26 +728,26 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl,
|
|||
transform->psa_key_enc, transform->psa_alg );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
status = psa_cipher_set_iv( &cipher_op, transform->iv_enc, transform->ivlen );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
status = psa_cipher_update( &cipher_op,
|
||||
data, rec->data_len,
|
||||
data, rec->data_len, &olen );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
status = psa_cipher_finish( &cipher_op,
|
||||
data + olen, rec->data_len - olen,
|
||||
&part_len );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
olen += part_len;
|
||||
#else
|
||||
|
@ -849,7 +849,7 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl,
|
|||
&rec->data_len );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
#else
|
||||
if( ( ret = mbedtls_cipher_auth_encrypt_ext( &transform->cipher_ctx_enc,
|
||||
iv, transform->ivlen,
|
||||
|
@ -959,26 +959,26 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl,
|
|||
transform->psa_key_enc, transform->psa_alg );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
status = psa_cipher_set_iv( &cipher_op, transform->iv_enc, transform->ivlen );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
status = psa_cipher_update( &cipher_op,
|
||||
data, rec->data_len,
|
||||
data, rec->data_len, &olen );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
status = psa_cipher_finish( &cipher_op,
|
||||
data + olen, rec->data_len - olen,
|
||||
&part_len );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
olen += part_len;
|
||||
#else
|
||||
|
@ -1139,26 +1139,26 @@ int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context const *ssl,
|
|||
transform->psa_key_dec, transform->psa_alg );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
status = psa_cipher_set_iv( &cipher_op, transform->iv_dec, transform->ivlen );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
status = psa_cipher_update( &cipher_op,
|
||||
data, rec->data_len,
|
||||
data, rec->data_len, &olen );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
status = psa_cipher_finish( &cipher_op,
|
||||
data + olen, rec->data_len - olen,
|
||||
&part_len );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
olen += part_len;
|
||||
#else
|
||||
|
@ -1280,7 +1280,7 @@ int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context const *ssl,
|
|||
&rec->data_len );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
#else
|
||||
if( ( ret = mbedtls_cipher_auth_decrypt_ext( &transform->cipher_ctx_dec,
|
||||
iv, transform->ivlen,
|
||||
|
@ -1463,26 +1463,26 @@ int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context const *ssl,
|
|||
transform->psa_key_dec, transform->psa_alg );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
status = psa_cipher_set_iv( &cipher_op, transform->iv_dec, transform->ivlen );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
status = psa_cipher_update( &cipher_op,
|
||||
data, rec->data_len,
|
||||
data, rec->data_len, &olen );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
status = psa_cipher_finish( &cipher_op,
|
||||
data + olen, rec->data_len - olen,
|
||||
&part_len );
|
||||
|
||||
if( status != PSA_SUCCESS )
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
return( psa_status_to_mbedtls( status ) );
|
||||
|
||||
olen += part_len;
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue