[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #61333] Error in preprocessor logic setting ALTCP_MBED
From: |
Tom Collins |
Subject: |
[lwip-devel] [bug #61333] Error in preprocessor logic setting ALTCP_MBEDTLS_PLATFORM_ALLOC |
Date: |
Mon, 11 Oct 2021 23:11:20 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15 |
URL:
<https://savannah.nongnu.org/bugs/?61333>
Summary: Error in preprocessor logic setting
ALTCP_MBEDTLS_PLATFORM_ALLOC
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: tomlogic
Submitted on: Tue 12 Oct 2021 03:11:18 AM UTC
Category: apps
Severity: 3 - Normal
Item Group: Faulty Behaviour
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release: None
lwIP version: 2.1.1
_______________________________________________________
Details:
I'm using lwIP as part of Silicon Labs's Gecko SDK, and it defines macros for
mbedtls_free and mbedtls_calloc, but the compiler then throws an error when
code in altcp_tls_mbedtls_mem.c tries to call
mbedtls_platform_set_calloc_free().
Current code in altcp_tls_mbedtls_mem.c:
#if defined(MBEDTLS_PLATFORM_MEMORY) && \
(!defined(MBEDTLS_PLATFORM_FREE_MACRO) || \
defined(MBEDTLS_PLATFORM_CALLOC_MACRO))
#define ALTCP_MBEDTLS_PLATFORM_ALLOC 1
#else
#define ALTCP_MBEDTLS_PLATFORM_ALLOC 0
#endif
Recommended replacement (added *!* before check for calloc macro):
#if defined(MBEDTLS_PLATFORM_MEMORY) && \
(!defined(MBEDTLS_PLATFORM_FREE_MACRO) || \
!defined(MBEDTLS_PLATFORM_CALLOC_MACRO))
#define ALTCP_MBEDTLS_PLATFORM_ALLOC 1
#else
#define ALTCP_MBEDTLS_PLATFORM_ALLOC 0
#endif
I'm basing this on code seen in platform.h:
#if defined(MBEDTLS_PLATFORM_MEMORY)
#if defined(MBEDTLS_PLATFORM_FREE_MACRO) && \
defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
#define mbedtls_free MBEDTLS_PLATFORM_FREE_MACRO
#define mbedtls_calloc MBEDTLS_PLATFORM_CALLOC_MACRO
Inverting the logic of the second #if should be "!defined || !defined".
_______________________________________________________
Reply to this item at:
<https://savannah.nongnu.org/bugs/?61333>
_______________________________________________
Message sent via Savannah
https://savannah.nongnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-devel] [bug #61333] Error in preprocessor logic setting ALTCP_MBEDTLS_PLATFORM_ALLOC,
Tom Collins <=