Skip to content

Commit 1e490d3

Browse files
Abhishekmishra2808linguini1
authored andcommitted
dropbear: rename libtomcrypt symbols to avoid NuttX collisions
Rename base64_encode, base64_decode, and ecc_make_key in bundled libtomcrypt to avoid duplicate symbol link errors when dropbear is built alongside netutils/codecs and NuttX crypto (e.g. sim:dropbear). Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
1 parent 865393d commit 1e490d3

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

netutils/dropbear/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,13 @@ if(CONFIG_NETUTILS_DROPBEAR)
192192
endif()
193193

194194
target_compile_definitions(
195-
${PROGNAME} PRIVATE LOCALOPTIONS_H_EXISTS=1 DROPBEAR_NUTTX=1
196-
DROPBEAR_NUTTX_PASSWD=1)
195+
${PROGNAME}
196+
PRIVATE LOCALOPTIONS_H_EXISTS=1
197+
DROPBEAR_NUTTX=1
198+
DROPBEAR_NUTTX_PASSWD=1
199+
base64_encode=dropbear_ltc_base64_encode
200+
base64_decode=dropbear_ltc_base64_decode
201+
ecc_make_key=dropbear_ltc_ecc_make_key)
197202

198203
if(CONFIG_NETUTILS_DROPBEAR_SCP)
199204
target_compile_definitions(

netutils/dropbear/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ endif
130130
# Match the ESP-IDF port behavior: LTC_SOURCE is only for libtomcrypt sources.
131131
$(foreach src,$(TOMCRYPT_SRCS),$(eval $(src)_CFLAGS += ${DEFINE_PREFIX}LTC_SOURCE=1))
132132

133+
# Avoid duplicate symbols when NuttX/apps also provide these APIs.
134+
# Apply to all dropbear sources so libtomcrypt definitions and dropbear
135+
# callers (e.g. signkey.c) use the same renamed symbols.
136+
CFLAGS += ${DEFINE_PREFIX}base64_encode=dropbear_ltc_base64_encode
137+
CFLAGS += ${DEFINE_PREFIX}base64_decode=dropbear_ltc_base64_decode
138+
CFLAGS += ${DEFINE_PREFIX}ecc_make_key=dropbear_ltc_ecc_make_key
139+
133140
MAINSRC = dropbear_main.c
134141

135142
ifneq ($(CONFIG_NETUTILS_DROPBEAR_SCP),)

0 commit comments

Comments
 (0)