Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing crypt on glibc 2.31 #143

Closed
thom-nic opened this issue Jan 19, 2022 · 4 comments
Closed

missing crypt on glibc 2.31 #143

thom-nic opened this issue Jan 19, 2022 · 4 comments

Comments

@thom-nic
Copy link

I am cross-compiling dropbear on Ubuntu host for arm-linux-gnueabihf target. I had been using Ubuntu Bionic (glibc 2.27) building dropbear release v2017.75. I want to upgrade to Ubuntu Focal host which uses glibc 2.31 and build the most recent dropbear release. It seems versions 2018+ fail on Ubuntu Focal host with the following:

During configure

configure: Using bundled libtomcrypt and libtommath
configure:
configure: crypt() not available, dropbear server will not have password authentication
configure:
configure: Now edit options.h to choose features.

Then during make:

make -C libtomcrypt
make[1]: Entering directory '/root/etx8-linux/recovery/dropbear/libtomcrypt'
arm-linux-gnueabihf-gcc -Isrc/headers/ -I./src/headers/ -I../ -I./../ -DLTC_SOURCE -I../libtommath/ -I./../libtommath/ -I./libtomcrypt/src/headers/ -DLOCALOPTIONS_H_EXISTS -I. -I.  -Os -W -Wall -Wno-pointer-sign -fno-strict-overflow -fPIE -fstack-protector-strong -D_FORTIFY_SOURCE=2 -DDROPBEAR_SERVER -DDROPBEAR_CLIENT -c src/ciphers/aes/aes.c -o src/ciphers/aes/aes.o
In file included from ../options.h:23,
                 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:
../sysoptions.h:237:3: error: #error "DROPBEAR_SVR_PASSWORD_AUTH requires `crypt()'."
  237 |  #error "DROPBEAR_SVR_PASSWORD_AUTH requires `crypt()'."
      |   ^~~~~
make[1]: *** [Makefile:246: src/ciphers/aes/aes.o] Error 1
make[1]: Leaving directory '/root/etx8-linux/recovery/dropbear/libtomcrypt'
make: *** [Makefile:209: libtomcrypt/libtomcrypt.a] Error 2
Errors encountered, aborting!

As I understand from this thread crypt is no longer bundled in glibc. I have tried the various solutions in that post but to no avail. Wondering if someone can help me with directions for building against glibc 2.31.

I have tried adding the following to localoptions.h but it doesn't seem to help:

#define _GNU_SOURCE
#include <crypt.h>

My configure and make commands look like this:

./configure --host=arm-linux-gnueabihf --prefix=/usr \
      --disable-syslog \
      --enable-bundled-libtom \
      --disable-lastlog \
      --disable-utmp \
      --disable-utmpx \
      --disable-wtmp \
      --disable-wtmpx \
      --disable-zlib
make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"

I think maybe I need to add CFLAGS and LDFLAGS?

@mkj
Copy link
Owner

mkj commented Jan 20, 2022

Since libcrypt is standalone you will need to install the armhf dev packages too.
From https://wiki.debian.org/Multiarch/HOWTO

dpkg --add-architecture armhf

Add these to /etc/apt/sources.list.d (the normal mirrors don't seem to have armhf)

deb [arch=armhf] http://ports.ubuntu.com/ focal main restricted
deb [arch=armhf] http://ports.ubuntu.com/ focal-updates main restricted

apt-get update (there may be 404s from armhf not existing on the normal mirror, you can probably solve that by adding [arch=amd64] to those lines in /etc/apt/sources.list)

apt install libcrypt-dev:armhf

Then Dropbear configure should run successfully.

@mkj mkj closed this as completed Jan 20, 2022
@Doerthous
Copy link

I use another solution:

  1. download standalone libcrypt from https://github.com/besser82/libxcrypt/
  2. cross compile it with the following configurations (install to the cross-compiler directory):
    tar -xvf libxcrypt-4.4.28.tar.xz  
    cd libxcrypt-4.4.28
    ./configure --prefix=/usr/arm-linux-gnueabihf  CC=arm-linux-gnueabihf-gcc \
    --host=arm
    
  3. compile dropbear

Environment:

  • dropbear-dropbear-2022.82
  • libxcrypt-4.4.28
  • arm-linux-gnueabihf-gcc 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)

@harpreetsc1992
Copy link

I used the two approaches in the answer. I am still getting the same error. What information can I provide further in order to fix these issues?

@thom-nic
Copy link
Author

mkj's solution worked for me. Are you building on Focal or Jammy host @harpreetsc1992?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants