Fix conditional compilation (MBEDTLS_USE_PSA_CRYPTO)
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
diff --git a/library/ssl_msg.c b/library/ssl_msg.c
index fe7d1e5..6a5faa5 100644
--- a/library/ssl_msg.c
+++ b/library/ssl_msg.c
@@ -709,14 +709,15 @@
#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 @@
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 @@
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 */
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 1bd9854..3cf741e 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -669,6 +669,7 @@
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 @@
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
}
}
+#endif /* MBEDTLS_USE_PSA_CRYPTO */
/*
* Populate a transform structure with session keys and all the other
diff --git a/library/ssl_tls13_keys.c b/library/ssl_tls13_keys.c
index 99d0860..e91b123 100644
--- a/library/ssl_tls13_keys.c
+++ b/library/ssl_tls13_keys.c
@@ -795,6 +795,7 @@
return( ret );
}
+#if defined(MBEDTLS_USE_PSA_CRYPTO)
static int psa_status_to_mbedtls( psa_status_t status )
{
switch( status )
@@ -809,6 +810,7 @@
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
}
}
+#endif /* MBEDTLS_USE_PSA_CRYPTO */
int mbedtls_ssl_tls13_populate_transform( mbedtls_ssl_transform *transform,
int endpoint,