mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-09 21:44:28 +00:00
Move psa_status_to_mbedtls to ssl_misc.h
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
8398a67e31
commit
e87475d834
@ -1309,6 +1309,28 @@ psa_status_t mbedtls_cipher_to_psa( mbedtls_cipher_type_t mbedtls_cipher_type,
|
|||||||
psa_algorithm_t *alg,
|
psa_algorithm_t *alg,
|
||||||
psa_key_type_t *key_type,
|
psa_key_type_t *key_type,
|
||||||
size_t *key_size );
|
size_t *key_size );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Convert given PSA status to mbedtls error code.
|
||||||
|
*
|
||||||
|
* \param status [in] given PSA status
|
||||||
|
*
|
||||||
|
* \return corresponding mbedtls error code
|
||||||
|
*/
|
||||||
|
static inline int psa_status_to_mbedtls( psa_status_t status )
|
||||||
|
{
|
||||||
|
switch( status )
|
||||||
|
{
|
||||||
|
case PSA_SUCCESS:
|
||||||
|
return( 0 );
|
||||||
|
case PSA_ERROR_INSUFFICIENT_MEMORY:
|
||||||
|
return( MBEDTLS_ERR_CIPHER_ALLOC_FAILED );
|
||||||
|
case PSA_ERROR_NOT_SUPPORTED:
|
||||||
|
return( MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE );
|
||||||
|
default:
|
||||||
|
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||||
|
|
||||||
#endif /* MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED */
|
#endif /* MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED */
|
||||||
|
@ -669,23 +669,6 @@ typedef int ssl_tls_prf_t(const unsigned char *, size_t, const char *,
|
|||||||
const unsigned char *, size_t,
|
const unsigned char *, size_t,
|
||||||
unsigned char *, size_t);
|
unsigned char *, size_t);
|
||||||
|
|
||||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
|
||||||
static int psa_status_to_mbedtls( psa_status_t status )
|
|
||||||
{
|
|
||||||
switch( status )
|
|
||||||
{
|
|
||||||
case PSA_SUCCESS:
|
|
||||||
return( 0 );
|
|
||||||
case PSA_ERROR_INSUFFICIENT_MEMORY:
|
|
||||||
return( MBEDTLS_ERR_CIPHER_ALLOC_FAILED );
|
|
||||||
case PSA_ERROR_NOT_SUPPORTED:
|
|
||||||
return( MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE );
|
|
||||||
default:
|
|
||||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Populate a transform structure with session keys and all the other
|
* Populate a transform structure with session keys and all the other
|
||||||
* necessary information.
|
* necessary information.
|
||||||
|
@ -795,23 +795,6 @@ exit:
|
|||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
|
||||||
static int psa_status_to_mbedtls( psa_status_t status )
|
|
||||||
{
|
|
||||||
switch( status )
|
|
||||||
{
|
|
||||||
case PSA_SUCCESS:
|
|
||||||
return( 0 );
|
|
||||||
case PSA_ERROR_INSUFFICIENT_MEMORY:
|
|
||||||
return( MBEDTLS_ERR_CIPHER_ALLOC_FAILED );
|
|
||||||
case PSA_ERROR_NOT_SUPPORTED:
|
|
||||||
return( MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE );
|
|
||||||
default:
|
|
||||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
|
||||||
|
|
||||||
int mbedtls_ssl_tls13_populate_transform( mbedtls_ssl_transform *transform,
|
int mbedtls_ssl_tls13_populate_transform( mbedtls_ssl_transform *transform,
|
||||||
int endpoint,
|
int endpoint,
|
||||||
int ciphersuite,
|
int ciphersuite,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user