diff --git a/library/ssl_msg.c b/library/ssl_msg.c index fe7d1e5cb8..6a5faa571a 100644 --- a/library/ssl_msg.c +++ b/library/ssl_msg.c @@ -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 */ diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 1bd98548d0..3cf741e04f 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -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 diff --git a/library/ssl_tls13_keys.c b/library/ssl_tls13_keys.c index 99d0860863..e91b123e5f 100644 --- a/library/ssl_tls13_keys.c +++ b/library/ssl_tls13_keys.c @@ -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,