Rename ssl_psa_status_to_mbedtls->psa_ssl_status_to_mbedtls

Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
Przemyslaw Stekiel 2022-01-31 20:22:53 +01:00
parent be47ecf5e2
commit 77aec8d181
5 changed files with 33 additions and 33 deletions

View file

@ -2056,7 +2056,7 @@ psa_status_t mbedtls_ssl_cipher_to_psa( mbedtls_cipher_type_t mbedtls_cipher_typ
* *
* \return corresponding mbedtls error code * \return corresponding mbedtls error code
*/ */
static inline int ssl_psa_status_to_mbedtls( psa_status_t status ) static inline int psa_ssl_status_to_mbedtls( psa_status_t status )
{ {
switch( status ) switch( status )
{ {

View file

@ -744,26 +744,26 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl,
transform->psa_key_enc, transform->psa_alg ); transform->psa_key_enc, transform->psa_alg );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
status = psa_cipher_set_iv( &cipher_op, transform->iv_enc, transform->ivlen ); status = psa_cipher_set_iv( &cipher_op, transform->iv_enc, transform->ivlen );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
status = psa_cipher_update( &cipher_op, status = psa_cipher_update( &cipher_op,
data, rec->data_len, data, rec->data_len,
data, rec->data_len, &olen ); data, rec->data_len, &olen );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
status = psa_cipher_finish( &cipher_op, status = psa_cipher_finish( &cipher_op,
data + olen, rec->data_len - olen, data + olen, rec->data_len - olen,
&part_len ); &part_len );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
olen += part_len; olen += part_len;
} else { } else {
@ -872,7 +872,7 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl,
&rec->data_len ); &rec->data_len );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
#else #else
if( ( ret = mbedtls_cipher_auth_encrypt_ext( &transform->cipher_ctx_enc, if( ( ret = mbedtls_cipher_auth_encrypt_ext( &transform->cipher_ctx_enc,
iv, transform->ivlen, iv, transform->ivlen,
@ -986,26 +986,26 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl,
transform->psa_key_enc, transform->psa_alg ); transform->psa_key_enc, transform->psa_alg );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
status = psa_cipher_set_iv( &cipher_op, transform->iv_enc, transform->ivlen ); status = psa_cipher_set_iv( &cipher_op, transform->iv_enc, transform->ivlen );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
status = psa_cipher_update( &cipher_op, status = psa_cipher_update( &cipher_op,
data, rec->data_len, data, rec->data_len,
data, rec->data_len, &olen ); data, rec->data_len, &olen );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
status = psa_cipher_finish( &cipher_op, status = psa_cipher_finish( &cipher_op,
data + olen, rec->data_len - olen, data + olen, rec->data_len - olen,
&part_len ); &part_len );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
olen += part_len; olen += part_len;
#else #else
@ -1177,26 +1177,26 @@ int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context const *ssl,
transform->psa_key_dec, transform->psa_alg ); transform->psa_key_dec, transform->psa_alg );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
status = psa_cipher_set_iv( &cipher_op, transform->iv_dec, transform->ivlen ); status = psa_cipher_set_iv( &cipher_op, transform->iv_dec, transform->ivlen );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
status = psa_cipher_update( &cipher_op, status = psa_cipher_update( &cipher_op,
data, rec->data_len, data, rec->data_len,
data, rec->data_len, &olen ); data, rec->data_len, &olen );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
status = psa_cipher_finish( &cipher_op, status = psa_cipher_finish( &cipher_op,
data + olen, rec->data_len - olen, data + olen, rec->data_len - olen,
&part_len ); &part_len );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
olen += part_len; olen += part_len;
} else { } else {
@ -1325,7 +1325,7 @@ int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context const *ssl,
&olen ); &olen );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
#else #else
if( ( ret = mbedtls_cipher_auth_decrypt_ext( &transform->cipher_ctx_dec, if( ( ret = mbedtls_cipher_auth_decrypt_ext( &transform->cipher_ctx_dec,
iv, transform->ivlen, iv, transform->ivlen,
@ -1512,26 +1512,26 @@ int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context const *ssl,
transform->psa_key_dec, transform->psa_alg ); transform->psa_key_dec, transform->psa_alg );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
status = psa_cipher_set_iv( &cipher_op, transform->iv_dec, transform->ivlen ); status = psa_cipher_set_iv( &cipher_op, transform->iv_dec, transform->ivlen );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
status = psa_cipher_update( &cipher_op, status = psa_cipher_update( &cipher_op,
data, rec->data_len, data, rec->data_len,
data, rec->data_len, &olen ); data, rec->data_len, &olen );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
status = psa_cipher_finish( &cipher_op, status = psa_cipher_finish( &cipher_op,
data + olen, rec->data_len - olen, data + olen, rec->data_len - olen,
&part_len ); &part_len );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
olen += part_len; olen += part_len;
#else #else

View file

@ -1015,7 +1015,7 @@ static int ssl_tls12_populate_transform( mbedtls_ssl_transform *transform,
&key_type, &key_type,
&key_bits ) ) != PSA_SUCCESS ) &key_bits ) ) != PSA_SUCCESS )
{ {
ret = ssl_psa_status_to_mbedtls( status ); ret = psa_ssl_status_to_mbedtls( status );
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_cipher_to_psa", ret ); MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_cipher_to_psa", ret );
goto end; goto end;
} }
@ -1031,7 +1031,7 @@ static int ssl_tls12_populate_transform( mbedtls_ssl_transform *transform,
PSA_BITS_TO_BYTES( key_bits ), PSA_BITS_TO_BYTES( key_bits ),
&transform->psa_key_enc ) ) != PSA_SUCCESS ) &transform->psa_key_enc ) ) != PSA_SUCCESS )
{ {
ret = ssl_psa_status_to_mbedtls( status ); ret = psa_ssl_status_to_mbedtls( status );
MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", ret ); MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", ret );
goto end; goto end;
} }
@ -1043,7 +1043,7 @@ static int ssl_tls12_populate_transform( mbedtls_ssl_transform *transform,
PSA_BITS_TO_BYTES( key_bits ), PSA_BITS_TO_BYTES( key_bits ),
&transform->psa_key_dec ) ) != PSA_SUCCESS ) &transform->psa_key_dec ) ) != PSA_SUCCESS )
{ {
ret = ssl_psa_status_to_mbedtls( status ); ret = psa_ssl_status_to_mbedtls( status );
MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", ret ); MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", ret );
goto end; goto end;
} }

View file

@ -936,8 +936,8 @@ int mbedtls_ssl_tls13_populate_transform( mbedtls_ssl_transform *transform,
&key_type, &key_type,
&key_bits ) ) != PSA_SUCCESS ) &key_bits ) ) != PSA_SUCCESS )
{ {
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_cipher_to_psa", ssl_psa_status_to_mbedtls( status ) ); MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_cipher_to_psa", psa_ssl_status_to_mbedtls( status ) );
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
} }
psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT ); psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
@ -951,8 +951,8 @@ int mbedtls_ssl_tls13_populate_transform( mbedtls_ssl_transform *transform,
PSA_BITS_TO_BYTES( key_bits ), PSA_BITS_TO_BYTES( key_bits ),
&transform->psa_key_enc ) ) != PSA_SUCCESS ) &transform->psa_key_enc ) ) != PSA_SUCCESS )
{ {
MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", ssl_psa_status_to_mbedtls( status ) ); MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", psa_ssl_status_to_mbedtls( status ) );
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
} }
psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DECRYPT ); psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DECRYPT );
@ -962,8 +962,8 @@ int mbedtls_ssl_tls13_populate_transform( mbedtls_ssl_transform *transform,
PSA_BITS_TO_BYTES( key_bits ), PSA_BITS_TO_BYTES( key_bits ),
&transform->psa_key_dec ) ) != PSA_SUCCESS ) &transform->psa_key_dec ) ) != PSA_SUCCESS )
{ {
MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", ssl_psa_status_to_mbedtls( status ) ); MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", psa_ssl_status_to_mbedtls( status ) );
return( ssl_psa_status_to_mbedtls( status ) ); return( psa_ssl_status_to_mbedtls( status ) );
} }
#endif /* MBEDTLS_USE_PSA_CRYPTO */ #endif /* MBEDTLS_USE_PSA_CRYPTO */

View file

@ -1439,7 +1439,7 @@ static int build_transforms( mbedtls_ssl_transform *t_in,
if ( status != PSA_SUCCESS) if ( status != PSA_SUCCESS)
{ {
ret = ssl_psa_status_to_mbedtls( status ); ret = psa_ssl_status_to_mbedtls( status );
goto cleanup; goto cleanup;
} }
@ -1459,7 +1459,7 @@ static int build_transforms( mbedtls_ssl_transform *t_in,
if ( status != PSA_SUCCESS) if ( status != PSA_SUCCESS)
{ {
ret = ssl_psa_status_to_mbedtls( status ); ret = psa_ssl_status_to_mbedtls( status );
goto cleanup; goto cleanup;
} }
@ -1470,7 +1470,7 @@ static int build_transforms( mbedtls_ssl_transform *t_in,
if ( status != PSA_SUCCESS) if ( status != PSA_SUCCESS)
{ {
ret = ssl_psa_status_to_mbedtls( status ); ret = psa_ssl_status_to_mbedtls( status );
goto cleanup; goto cleanup;
} }
@ -1483,7 +1483,7 @@ static int build_transforms( mbedtls_ssl_transform *t_in,
if ( status != PSA_SUCCESS) if ( status != PSA_SUCCESS)
{ {
ret = ssl_psa_status_to_mbedtls( status ); ret = psa_ssl_status_to_mbedtls( status );
goto cleanup; goto cleanup;
} }
@ -1494,7 +1494,7 @@ static int build_transforms( mbedtls_ssl_transform *t_in,
if ( status != PSA_SUCCESS) if ( status != PSA_SUCCESS)
{ {
ret = ssl_psa_status_to_mbedtls( status ); ret = psa_ssl_status_to_mbedtls( status );
goto cleanup; goto cleanup;
} }
} }