1 (edited by mugeno 2023-12-20 20:31:41)

Topic: WolfSSH v1.4.13: Undefined Identifier "heap" error in internal.c

Experiencing an issue in WolfSSH version 1.4.13 when used with FreeRTOS and lwIP, and combined with the most recent version of wolfSSL. The compiler is indicating an "undefined identifier 'heap'" error within the internal.c file.

Error Details:

  • Error Message: #20 identifier "heap" is undefined

  • Location in Code: internal.c Line 1052 (GitHub Link)

  • WolfSSH Version: v1.4.13

  • Additional Environment: FreeRTOS + lwIP, wolfSSL latest version

Questions:

  • Has anyone experienced a similar issue with the "heap" identifier in WolfSSH v1.4.13? If so, how was it resolved?

  • Could this error be related to specific configurations or dependencies required for integrating WolfSSH with FreeRTOS and lwIP (e.g., WolfSSL/WolfCrypt)?

  • Are there any particular user settings that should be verified or adjusted to resolve this issue?

  • Would upgrading or downgrading WolfSSH potentially solve this problem, or are there known workarounds for this version?

user_settings.h File:

#ifndef WOLFSSH_USER_SETTINGS_H
#define WOLFSSH_USER_SETTINGS_H
#ifdef __cplusplus
extern "C" {
#endif

#include <wolfssl/wolfcrypt/types.h>

#define FREERTOS
#define WOLFSSH_LWIP
#undef USE_WINDOWS_API
#define WOLFSSH_USE_AES_CBC
#define HAVE_ECC
#define HAVE_ECC_DHE
#define HAVE_ECDH
#define WOLFSSL_NO_WORD64_OPS
#define HAVE_ECC256
#define WOLFSSH_AES_CBC
#define WOLFSSH_AES_CTR
#define WOLFSSH_AES_GCM
#undef WOLFSSL_NUCLEUS
//#define WOLFSSH_SFTP
//#define WOLFSSH_SCP
#define NO_APITEST_MAIN_DRIVER
#define NO_TESTSUITE_MAIN_DRIVER
#define NO_UNITTEST_MAIN_DRIVER
#define NO_MAIN_DRIVER
#define WS_NO_SIGNAL
#define WS_USE_TEST_BUFFERS
#define NO_WOLFSSL_DIR
#define WOLFSSH_NO_NONBLOCKING
#define DEFAULT_WINDOW_SZ (128 * 128)
#define WOLFSSH_MAX_SFTP_RW 8192
//#define STATIC_BUFFER_LEN 160
#undef WOLFSSH_NO_ECDH_SHA2_NISTP256

#ifdef __cplusplus
}
#endif
#ifndef EPIPE
#define EPIPE           32  /* Broken pipe */
#endif
#ifndef EINTR
#define EINTR            4  /* Interrupted system call */
#endif
#ifndef EWOULDBLOCK
#define EWOULDBLOCK     EAGAIN  /* Operation would block */
#endif
#ifndef ECONNRESET
#define ECONNRESET     104  /* Connection reset by peer */
#endif
#ifndef EAGAIN
#define EAGAIN          11  /* Try again */
#endif
#ifndef ECONNABORTED
#define ECONNABORTED   103  /* Software caused connection abort */
#endif
#ifndef ECONNREFUSED
#define ECONNREFUSED   111  /* Connection refused */
#endif
#ifndef errno
extern int errno;
#endif

#endif /* WOLFSSH_USER_SETTINGS_H */

Share

Re: WolfSSH v1.4.13: Undefined Identifier "heap" error in internal.c

Has anyone experienced a similar issue with the "heap" identifier in WolfSSH v1.4.13? If so, how was it resolved?

We did when we added Zephyr support. We set it to the correct value. That particular case you indicated should be ctx->heap. If you aren't using a custom heap with your own memory allocator functions, you could use NULL for the heap.

Could this error be related to specific configurations or dependencies required for integrating WolfSSH with FreeRTOS and lwIP (e.g., WolfSSL/WolfCrypt)?

It's happening in builds that aren't using the default memory allocators. For Linux/macOS/Windows, the WMALLOC() macro is ignoring the heap parameter. That's why I missed it.

Are there any particular user settings that should be verified or adjusted to resolve this issue?

No.

Would upgrading or downgrading WolfSSH potentially solve this problem, or are there known workarounds for this version?

This issue is fixed and will be available in the v1.4.15 release in the next few days.

--John