mkj / dropbear

Dropbear SSH
https://matt.ucc.asn.au/dropbear/dropbear.html
Other
1.68k stars 399 forks source link

Building with glibc-1.31+ #293

Open harpreetsc1992 opened 4 months ago

harpreetsc1992 commented 4 months ago

Hello, I'm using a system with glibc-1.35. It seems that crypt.h has been deprecated from 1.31. Has anyone compiled dropbear with the newer glibc versions? For context, these are the errors I'm getting: _ In file included from src/options.h:29, from src/includes.h:28, from src/buffer.c:27: src/sysoptions.h:297:36: warning: "HAVE_CRYPT" is not defined, evaluates to 0 [-Wundef]

297 | #if DROPBEAR_SVR_PASSWORD_AUTH && !HAVE_CRYPT src/sysoptions.h:298:10: error: #error "DROPBEAR_SVR_PASSWORD_AUTH requires 'crypt()'."

298 | #error "DROPBEAR_SVR_PASSWORD_AUTH requires 'crypt()'."

In file included from src/options.h:29, from src/includes.h:28, from src/dbhelpers.c:2: src/sysoptions.h:297:36: warning: "HAVE_CRYPT" is not defined, evaluates to 0 [-Wundef] 297 | #if DROPBEAR_SVR_PASSWORD_AUTH && !HAVE_CRYPT

src/sysoptions.h:298:10: error: #error "DROPBEAR_SVR_PASSWORD_AUTH requires 'crypt()'." 298 | #error "DROPBEAR_SVR_PASSWORD_AUTH requires 'crypt()'."

In file included from src/options.h:29, from src/includes.h:28, from src/dss.c:25: src/sysoptions.h:297:36: warning: "HAVE_CRYPT" is not defined, evaluates to 0 [-Wundef] 297 | #if DROPBEAR_SVR_PASSWORD_AUTH && !HAVE_CRYPT

src/sysoptions.h:298:10: error: #error "DROPBEAR_SVR_PASSWORD_AUTH requires 'crypt()'." 298 | #error "DROPBEAR_SVR_PASSWORD_AUTH requires 'crypt()'."

In file included from src/options.h:29, from src/includes.h:28, from src/dbutil.c:64: src/sysoptions.h:297:36: warning: "HAVE_CRYPT" is not defined, evaluates to 0 [-Wundef] 297 | #if DROPBEAR_SVR_PASSWORD_AUTH && !HAVE_CRYPT

src/sysoptions.h:298:10: error: #error "DROPBEAR_SVR_PASSWORD_AUTH requires 'crypt()'." 298 | #error "DROPBEAR_SVR_PASSWORD_AUTH requires 'crypt()'."

In file included from ./../src/options.h:29, from src/headers/tomcrypt_dropbear.h:2, from src/headers/tomcrypt_custom.h:13, from src/headers/tomcrypt.h:22, from src/ciphers/aes/aes.c:31: ./../src/sysoptions.h:297:36: warning: "HAVE_CRYPT" is not defined, evaluates to 0 [-Wundef] 297 | #if DROPBEAR_SVR_PASSWORD_AUTH && !HAVE_CRYPT

./../src/sysoptions.h:298:10: error: #error "DROPBEAR_SVR_PASSWORD_AUTH requires 'crypt()'." 298 | #error "DROPBEAR_SVR_PASSWORD_AUTH requires 'crypt()'."

In file included from ./../src/options.h:29, from ./../src/dbmalloc.h:4, from tommath_class.h:1322, from tommath_class.h:1305, from tommath_class.h:1305, from tommath_class.h:1305, from tommath_private.h:8, from bn_cutoffs.c:1: ./../src/sysoptions.h:297:36: warning: "HAVE_CRYPT" is not defined, evaluates to 0 [-Wundef] 297 | #if DROPBEAR_SVR_PASSWORD_AUTH && !HAVE_CRYPT

./../src/sysoptions.h:298:10: error: #error "DROPBEAR_SVR_PASSWORD_AUTH requires 'crypt()'." 298 | #error "DROPBEAR_SVR_PASSWORD_AUTH requires 'crypt()'." make[2]: [Makefile:246: src/ciphers/aes/aes.o] Error 1 make[2]: Leaving directory '/home/grads/h/harpreetsc/Documents/busybear-linux/build/dropbear-2024.84/libtomcrypt' make[1]: [Makefile:255: libtomcrypt/libtomcrypt.a] Error 2 make[1]: Waiting for unfinished jobs.... riscv64-unknown-linux-gnu-gcc -c -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fPIE -Wundef -fno-strict-overflow -Wno-pointer-sign -Os -W -Wall -I. -I../libtomcrypt/src/headers/ -I./../libtomcrypt/src/headers/ -I../ -I./../src -Wno-deprecated -I./src/../libtomcrypt/src/headers/ -I. -I./src -DDROPBEAR_SERVER -DDROPBEAR_CLIENT -I./ -Wall -Wsign-compare -Wextra -Wshadow -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wpointer-arith -Wsystem-headers -O3 -funroll-loops -fomit-frame-pointer bn_deprecated.c -o bn_deprecated.o make[2]: [Makefile:40: bn_cutoffs.o] Error 1 make[2]: Waiting for unfinished jobs.... make[1]: [Makefile:169: obj/dss.o] Error 1 make[1]: *** [Makefile:169: obj/buffer.o] Error 1 In file included from ./../src/options.h:29, from ./../src/dbmalloc.h:4, from tommath_class.h:1322, from tommath_class.h:1305, from tommath_class.h:1305, from tommath_class.h:1305, from tommath_private.h:8, from bn_deprecated.c:1: ./../src/sysoptions.h:297:36: warning: "HAVE_CRYPT" is not defined, evaluates to 0 [-Wundef] 297 | #if DROPBEAR_SVR_PASSWORD_AUTH && !HAVE_CRYPT

./../src/sysoptions.h:298:10: error: #error "DROPBEAR_SVR_PASSWORD_AUTH requires 'crypt()'." 298 | #error "DROPBEAR_SVR_PASSWORD_AUTH requires 'crypt()'."

make[2]: [Makefile:40: bn_deprecated.o] Error 1 make[2]: Leaving directory '/home/grads/h/harpreetsc/Documents/busybear-linux/build/dropbear-2024.84/libtommath' make[1]: [Makefile:258: libtommath/libtommath.a] Error 2 make[1]: [Makefile:169: obj/dbutil.o] Error 1 make[1]: [Makefile:169: obj/dbhelpers.o] Error 1 make[1]: Leaving directory '/home/grads/h/harpreetsc/Documents/busybear-linux/build/dropbear-2024.84' make: *** [Makefile:10: busybear.bin] Error 2 _

Or am I just interpreting the error wrong?

mkj commented 4 months ago

This sounds the same as https://github.com/mkj/dropbear/issues/143 , does that help?

mkj commented 4 months ago

What platform are you building on? Building against libxcrypt should have worked. Can you look in config.log what is recorded when it looks for crypt?

harpreetsc1992 commented 4 months ago

@mkj Thanks for the quick replies. My system is Linux 5.15.0-100-generic (Ubuntu Jammy) on an x86_64 system, gcc-11.4.0.

There seems to be checks at multiple places for crypt (along with other errors - which can again be version mismatch), and the message can get really long. I am attaching the config.log file with the message. Will it be okay to do so? config.log

I am not sure where exactly I'm messing up.

mkj commented 4 months ago
configure:5346: checking for crypt in -lcrypt
configure:5369: riscv64-unknown-linux-gnu-gcc -o conftest -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fPIE -Wundef -fno-strict-overflow -Wno-pointer-sign -Os -W -Wall  -Wl,-z,now -Wl,-z,relro -pie  conftest.c -lcrypt   >&5
/home/grads/h/harpreetsc/Documents/keystone/riscv/lib/gcc/riscv64-unknown-linux-gnu/13.2.0/../../../../riscv64-unknown-linux-gnu/bin/ld: cannot find -lcrypt: No such file or directory

It can't find libcrypt. Did libxcrypt get built for riscv64 and installed to a path that the riscv toolchain will find?