ssl_write_encrypt_then_mac_ext(): adapt to psa crypto
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
89dad93a78
commit
2c87a200a3
1 changed files with 11 additions and 0 deletions
|
@ -2035,7 +2035,13 @@ static void ssl_write_encrypt_then_mac_ext( mbedtls_ssl_context *ssl,
|
||||||
{
|
{
|
||||||
unsigned char *p = buf;
|
unsigned char *p = buf;
|
||||||
const mbedtls_ssl_ciphersuite_t *suite = NULL;
|
const mbedtls_ssl_ciphersuite_t *suite = NULL;
|
||||||
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
|
psa_key_type_t key_type;
|
||||||
|
psa_algorithm_t alg;
|
||||||
|
size_t key_bits;
|
||||||
|
#else
|
||||||
const mbedtls_cipher_info_t *cipher = NULL;
|
const mbedtls_cipher_info_t *cipher = NULL;
|
||||||
|
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||||
|
|
||||||
if( ssl->session_negotiate->encrypt_then_mac == MBEDTLS_SSL_ETM_DISABLED )
|
if( ssl->session_negotiate->encrypt_then_mac == MBEDTLS_SSL_ETM_DISABLED )
|
||||||
{
|
{
|
||||||
|
@ -2051,8 +2057,13 @@ static void ssl_write_encrypt_then_mac_ext( mbedtls_ssl_context *ssl,
|
||||||
*/
|
*/
|
||||||
if( ( suite = mbedtls_ssl_ciphersuite_from_id(
|
if( ( suite = mbedtls_ssl_ciphersuite_from_id(
|
||||||
ssl->session_negotiate->ciphersuite ) ) == NULL ||
|
ssl->session_negotiate->ciphersuite ) ) == NULL ||
|
||||||
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
|
( mbedtls_ssl_cipher_to_psa( suite->cipher, 0, &alg, &key_type, &key_bits ) != PSA_SUCCESS) ||
|
||||||
|
alg != PSA_ALG_CBC_NO_PADDING )
|
||||||
|
#else
|
||||||
( cipher = mbedtls_cipher_info_from_type( suite->cipher ) ) == NULL ||
|
( cipher = mbedtls_cipher_info_from_type( suite->cipher ) ) == NULL ||
|
||||||
cipher->mode != MBEDTLS_MODE_CBC )
|
cipher->mode != MBEDTLS_MODE_CBC )
|
||||||
|
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||||
{
|
{
|
||||||
*olen = 0;
|
*olen = 0;
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue