From cfa722324ca1618f03923b407a4ce683221cd277 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Tue, 5 Sep 2023 16:20:33 +0100 Subject: [PATCH] Fix warnings about unreachable code Signed-off-by: Dave Rodgman --- library/bignum_core.c | 2 ++ library/x509_crt.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/library/bignum_core.c b/library/bignum_core.c index 48b640bdb..85dca5530 100644 --- a/library/bignum_core.c +++ b/library/bignum_core.c @@ -99,6 +99,7 @@ static mbedtls_mpi_uint mpi_bigendian_to_host(mbedtls_mpi_uint a) /* Nothing to do on bigendian systems. */ return a; } else { +MBEDTLS_IGNORE_UNREACHABLE_BEGIN switch (sizeof(mbedtls_mpi_uint)) { case 4: return (mbedtls_mpi_uint) MBEDTLS_BSWAP32((uint32_t) a); @@ -109,6 +110,7 @@ static mbedtls_mpi_uint mpi_bigendian_to_host(mbedtls_mpi_uint a) /* Fall back to C-based reordering if we don't know the byte order * or we couldn't use a compiler-specific builtin. */ return mpi_bigendian_to_host_c(a); +MBEDTLS_IGNORE_UNREACHABLE_END } } diff --git a/library/x509_crt.c b/library/x509_crt.c index 2cbced210..8d07694a2 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -2754,8 +2754,8 @@ static int x509_inet_pton_ipv6(const char *src, void *dst) p++; } if (num_digits != 0) { - addr[nonzero_groups++] = MBEDTLS_IS_BIG_ENDIAN ? group : - (group << 8) | (group >> 8); + MBEDTLS_PUT_UINT16_BE(group, addr, nonzero_groups); + nonzero_groups++; if (*p == '\0') { break; } else if (*p == '.') {