1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-30 22:43:08 +03:00

Add helper function to translate mbedtls cipher type/mode pair to psa: algorithm, key type and key size.

Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
Przemyslaw Stekiel
2022-01-10 11:55:46 +01:00
parent a9f32fbb21
commit 430f337b49
2 changed files with 161 additions and 0 deletions

View File

@ -1274,6 +1274,22 @@ static inline mbedtls_svc_key_id_t mbedtls_ssl_get_opaque_psk(
return( MBEDTLS_SVC_KEY_ID_INIT );
}
/* Corresponding PSA algorithm for MBEDTLS_CIPHER_NULL */
#define MBEDTLS_SSL_NULL_CIPHER 0x04000000
/**
* Translate mbedtls cipher type/mode pair to psa: algorithm, key type and
* key size.
*
* Return PSA_SUCCESS on success or PSA_ERROR_NOT_SUPPORTED if
* conversion is not supported.
*/
psa_status_t mbedtls_cipher_to_psa( mbedtls_cipher_type_t mbedtls_cipher_type,
size_t taglen,
psa_algorithm_t *alg,
psa_key_type_t *key_type,
size_t *key_size );
#endif /* MBEDTLS_USE_PSA_CRYPTO */
#endif /* MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED */