ssl: remove useless guard

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2023-03-24 07:28:49 +01:00
parent 77bdff1963
commit 77a904c761
4 changed files with 7 additions and 22 deletions

View file

@ -40,11 +40,7 @@
#include "mbedtls/dhm.h" #include "mbedtls/dhm.h"
#endif #endif
/* Adding guard for MBEDTLS_ECDSA_C to ensure no compile errors due #if defined(MBEDTLS_ECDH_C)
* to guards in TLS code. There is a gap in functionality that access to
* ecdh_ctx structure is needed for MBEDTLS_ECDSA_C which does not seem correct.
*/
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C)
#include "mbedtls/ecdh.h" #include "mbedtls/ecdh.h"
#endif #endif

View file

@ -751,16 +751,9 @@ struct mbedtls_ssl_handshake_params {
mbedtls_dhm_context dhm_ctx; /*!< DHM key exchange */ mbedtls_dhm_context dhm_ctx; /*!< DHM key exchange */
#endif #endif
/* Adding guard for MBEDTLS_ECDSA_C to ensure no compile errors due #if defined(MBEDTLS_ECDH_C) && !defined(MBEDTLS_USE_PSA_CRYPTO)
* to guards in client and server code. There is a gap in functionality that
* access to ecdh_ctx structure is needed for MBEDTLS_ECDSA_C which does not
* seem correct.
*/
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_PK_CAN_ECDSA_SOME)
#if !defined(MBEDTLS_USE_PSA_CRYPTO)
mbedtls_ecdh_context ecdh_ctx; /*!< ECDH key exchange */ mbedtls_ecdh_context ecdh_ctx; /*!< ECDH key exchange */
#endif /* !MBEDTLS_USE_PSA_CRYPTO */ #endif /* MBEDTLS_ECDH_C && !MBEDTLS_USE_PSA_CRYPTO */
#endif /* MBEDTLS_ECDH_C || MBEDTLS_ECDSA_C */
#if defined(PSA_WANT_ALG_ECDH) && \ #if defined(PSA_WANT_ALG_ECDH) && \
(defined(MBEDTLS_USE_PSA_CRYPTO) || defined(MBEDTLS_SSL_PROTO_TLS1_3)) (defined(MBEDTLS_USE_PSA_CRYPTO) || defined(MBEDTLS_SSL_PROTO_TLS1_3))

View file

@ -831,11 +831,9 @@ static int ssl_parse_supported_point_formats_ext(mbedtls_ssl_context *ssl,
while (list_size > 0) { while (list_size > 0) {
if (p[0] == MBEDTLS_ECP_PF_UNCOMPRESSED || if (p[0] == MBEDTLS_ECP_PF_UNCOMPRESSED ||
p[0] == MBEDTLS_ECP_PF_COMPRESSED) { p[0] == MBEDTLS_ECP_PF_COMPRESSED) {
#if !defined(MBEDTLS_USE_PSA_CRYPTO) && \ #if !defined(MBEDTLS_USE_PSA_CRYPTO) && (defined(MBEDTLS_ECDH_C))
(defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C))
ssl->handshake->ecdh_ctx.point_format = p[0]; ssl->handshake->ecdh_ctx.point_format = p[0];
#endif /* !MBEDTLS_USE_PSA_CRYPTO && #endif /* !MBEDTLS_USE_PSA_CRYPTO && MBEDTLS_ECDH_C */
( MBEDTLS_ECDH_C || MBEDTLS_ECDSA_C ) */
#if !defined(MBEDTLS_USE_PSA_CRYPTO) && \ #if !defined(MBEDTLS_USE_PSA_CRYPTO) && \
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
mbedtls_ecjpake_set_point_format(&ssl->handshake->ecjpake_ctx, mbedtls_ecjpake_set_point_format(&ssl->handshake->ecjpake_ctx,

View file

@ -266,11 +266,9 @@ static int ssl_parse_supported_point_formats(mbedtls_ssl_context *ssl,
while (list_size > 0) { while (list_size > 0) {
if (p[0] == MBEDTLS_ECP_PF_UNCOMPRESSED || if (p[0] == MBEDTLS_ECP_PF_UNCOMPRESSED ||
p[0] == MBEDTLS_ECP_PF_COMPRESSED) { p[0] == MBEDTLS_ECP_PF_COMPRESSED) {
#if !defined(MBEDTLS_USE_PSA_CRYPTO) && \ #if !defined(MBEDTLS_USE_PSA_CRYPTO) && defined(MBEDTLS_ECDH_C)
(defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C))
ssl->handshake->ecdh_ctx.point_format = p[0]; ssl->handshake->ecdh_ctx.point_format = p[0];
#endif /* !MBEDTLS_USE_PSA_CRYPTO && #endif /* !MBEDTLS_USE_PSA_CRYPTO && MBEDTLS_ECDH_C */
( MBEDTLS_ECDH_C || MBEDTLS_ECDSA_C ) */
#if !defined(MBEDTLS_USE_PSA_CRYPTO) && \ #if !defined(MBEDTLS_USE_PSA_CRYPTO) && \
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
mbedtls_ecjpake_set_point_format(&ssl->handshake->ecjpake_ctx, mbedtls_ecjpake_set_point_format(&ssl->handshake->ecjpake_ctx,