Fix conditional compilation (MBEDTLS_USE_PSA_CRYPTO)

Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
Przemyslaw Stekiel 2022-01-13 15:56:33 +01:00
parent 2e9711f766
commit 1fe065b235
3 changed files with 9 additions and 3 deletions

View file

@ -709,14 +709,15 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl,
#if defined(MBEDTLS_SSL_SOME_SUITES_USE_STREAM)
if( mode == MBEDTLS_MODE_STREAM )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
size_t olen;
#if defined(MBEDTLS_USE_PSA_CRYPTO)
psa_status_t status;
size_t part_len;
psa_cipher_operation_t cipher_op = PSA_CIPHER_OPERATION_INIT;
#endif /* MBEDTLS_USE_PSA_CRYPTO */
#else /* MBEDTLS_USE_PSA_CRYPTO */
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
#endif
MBEDTLS_SSL_DEBUG_MSG( 3, ( "before encrypt: msglen = %" MBEDTLS_PRINTF_SIZET ", "
"including %d bytes of padding",
@ -776,7 +777,6 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl,
mode == MBEDTLS_MODE_CCM ||
mode == MBEDTLS_MODE_CHACHAPOLY )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
unsigned char iv[12];
unsigned char *dynamic_iv;
size_t dynamic_iv_len;
@ -784,6 +784,8 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl,
ssl_transform_aead_dynamic_iv_is_explicit( transform );
#if defined(MBEDTLS_USE_PSA_CRYPTO)
psa_status_t status;
#else
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
#endif /* MBEDTLS_USE_PSA_CRYPTO */

View file

@ -669,6 +669,7 @@ typedef int ssl_tls_prf_t(const unsigned char *, size_t, const char *,
const 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 )
@ -683,6 +684,7 @@ static int psa_status_to_mbedtls( psa_status_t status )
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
}
}
#endif /* MBEDTLS_USE_PSA_CRYPTO */
/*
* Populate a transform structure with session keys and all the other

View file

@ -795,6 +795,7 @@ exit:
return( ret );
}
#if defined(MBEDTLS_USE_PSA_CRYPTO)
static int psa_status_to_mbedtls( psa_status_t status )
{
switch( status )
@ -809,6 +810,7 @@ static int psa_status_to_mbedtls( psa_status_t status )
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
}
}
#endif /* MBEDTLS_USE_PSA_CRYPTO */
int mbedtls_ssl_tls13_populate_transform( mbedtls_ssl_transform *transform,
int endpoint,