ColumPaget / Hashrat

Hashing tool supporting md5,sha1,sha256,sha512,whirlpool,jh and hmac versions of these. Includes recursive file hashing and other features.
GNU General Public License v3.0
63 stars 11 forks source link

Unable to use SSL/TLS with OpenSSL 1.1 #9

Closed MarcusRoeckrath closed 4 years ago

MarcusRoeckrath commented 6 years ago

Hi,

although using --enable-ssl with OpenSSL 1.1/libssl 1.1 and installed developer files configure does not recognize libssl saying

SSL/TLS NOT enabled

Does the libssl check not work with this new OpenSSL/libssl release.

Marcus

ColumPaget commented 4 years ago

Sorry, this issue report got overlooked. This seems to be fixed in version 1.10.3. If it's not, could you post what you see as output to configure, and maybe also the config.log?

MarcusRoeckrath commented 4 years ago

Thanks for your answer, but I do not get it work with SSL/TLS. Here the output of the configure run:

checking for i486-pc-linux-gnu-gcc... no checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether make sets $(MAKE)... yes checking for a BSD-compatible install... /usr/bin/install -c checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for ANSI C header files... yes checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... 64 checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking sys/extattr.h usability... no checking sys/extattr.h presence... no checking for sys/extattr.h... no checking sys/xattr.h usability... yes checking sys/xattr.h presence... yes checking for sys/xattr.h... yes checking for getxattr in -lc... yes

checking openssl/crypto.h usability... yes checking openssl/crypto.h presence... yes checking for openssl/crypto.h... yes checking openssl/ssl.h usability... yes checking openssl/ssl.h presence... yes checking for openssl/ssl.h... yes checking for SSL_library_init in -lssl... no checking for EVP_CIPHER_CTX_init in -lcrypto... no

############# Hashrat Build Config: ############# Using bundled libUseful Largefiles ( > 2GB ) enabled File system attributes (xattr) enabled SSL/TLS NOT enabled

configure: creating ./config.status config.status: creating Makefile === configuring in libUseful-4 (/usr/src/Hashrat-1.10.3/libUseful-4) configure: running /bin/sh ./configure --disable-option-checking '--prefix=/usr' '--build=i486-pc-linux-gnu' '--host=i486-pc-linux-gnu' '--enable-largefiles' '--enable-xattr' '--enable-ssl' 'build_alias=i486-pc-linux-gnu' 'host_alias=i486-pc-linux-gnu' 'CFLAGS=-O2 -g -m32 -march=i586 -mtune=i686 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables' --cache-file=/dev/null --srcdir=. checking for i486-pc-linux-gnu-gcc... no checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether make sets $(MAKE)... yes checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for ANSI C header files... yes checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... 64 checking for ptsname_r in -lc... yes checking for clearenv in -lc... yes checking for setresuid in -lc... yes checking for get_current_dir_name in -lc... yes checking for umount2 in -lc... yes checking for umount in -lc... yes checking for mkostemp in -lc... yes checking for poll in -lc... yes checking for getxattr in -lc... yes checking openssl/crypto.h usability... yes checking openssl/crypto.h presence... yes checking for openssl/crypto.h... yes checking openssl/ssl.h usability... yes checking openssl/ssl.h presence... yes checking for openssl/ssl.h... yes checking for SSL_library_init in -lssl... no checking for EVP_CIPHER_CTX_init in -lcrypto... no checking for OpenSSL_add_all_algorithms... no checking for EVP_bf_cbc... no checking for EVP_rc2_cbc... no checking for EVP_rc4... no checking for EVP_rc5_32_12_16_cbc... no checking for EVP_des_cbc... no checking for EVP_desx_cbc... no checking for EVP_cast5_cbc... no checking for EVP_idea_cbc... no checking for EVP_aes_128_cbc... no checking for EVP_aes_256_cbc... no checking for X509_check_host... no checking for SSL_set_tlsext_host_name... no checking whether OpenSSL_add_all_algorithms is declared... yes checking whether SSL_set_tlsext_host_name is declared... yes checking that OpenSSL Library is at least version 0.9.7... yes configure: creating ./config.status config.status: creating Makefile

############# libUseful Build Config: ############# Largefiles ( > 2GB ) enabled Filesystem attribues (xattr) enabled Linux sendfile syscall NOT enabled IPv6 NOT enabled SSL/TLS NOT enabled zlib NOT enabled linux namespace support NOT enabled linux capabilities support NOT enabled

I think this should be the interesting parts from config.log:

configure:3958: gcc -o conftest -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables conftest.c -lssl -lc >&5 /tmp/cc5UiNkg.o: In function main': /usr/src/hashrat/conftest.c:32: undefined reference toSSL_library_init' collect2: error: ld returned 1 exit status configure:3958: $? = 1 configure: failed program was: / confdefs.h / #define PACKAGE_NAME "" #define PACKAGE_TARNAME "" #define PACKAGE_VERSION "" #define PACKAGE_STRING "" #define PACKAGE_BUGREPORT "" #define PACKAGE_URL "" #define STDC_HEADERS 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRING_H 1 #define HAVE_MEMORY_H 1 #define HAVE_STRINGS_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_STDINT_H 1 #define HAVE_UNISTD_H 1 #define HAVE_LIBC 1 #define USE_XATTR 1 / end confdefs.h. /
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char SSL_library_init ();
int
main ()
{
return SSL_library_init ();
;
return 0;
}

configure:3967: result: no

Maybe the function SSL_library_init does not exist in openssl anymore.

MarcusRoeckrath commented 4 years ago

I want to give you more detailed informations:

openssl 1.1.1d on linux distribution eisfair-1/64 (www.eisfair.org)

/usr/include/openssl/ssl.h:
[...]
# if OPENSSL_API_COMPAT < 0x10100000L 
#  define OpenSSL_add_ssl_algorithms()   SSL_library_init()
#  define SSLeay_add_ssl_algorithms()    SSL_library_init()
# endif
[...]
# if OPENSSL_API_COMPAT < 0x10100000L
#  define SSL_library_init() OPENSSL_init_ssl(0, NULL)
# endif
[...]

Seams to me as if the init function was renamed to OPENSSL_init_ssl.

Replacing all occurences of SSL_library_init with OPENSSL_init_ssl in both configure files (main source directory and sub dir libUseful-4 configure now detects ssl correctly and activates it:

############# Hashrat Build Config: ############# Using bundled libUseful Largefiles ( > 2GB ) NOT enabled File system attributes (xattr) enabled SSL/TLS enabled

############# libUseful Build Config: ############# Largefiles ( > 2GB ) NOT enabled Filesystem attribues (xattr) enabled Linux sendfile syscall NOT enabled IPv6 NOT enabled SSL/TLS enabled zlib support enabled linux namespace support NOT enabled linux capabilities support NOT enabled

Maybe the configure program has to detect the ssl version to use the correct init function.

MarcusRoeckrath commented 4 years ago

Addition:

After changing SSL_library_init to OPENSSL_init_ssl make gives the following error:

/usr/bin/ld: libUseful-4/libUseful.a(OpenSSL.o): undefined reference to symbol 'OpenSSL_version@@OPENSSL_1_1_0' /usr/lib64/libcrypto.so.1.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status Makefile:16: recipe for target 'hashrat' failed make: *** [hashrat] Error 1

Maybe there are more changes neccesary to make hashrat work with openssl 1.1.1d.

MarcusRoeckrath commented 4 years ago

Found more of those "undefined reference to symbol" errors in config.log of libUseful-4:

/usr/bin/ld: /tmp/cc6C2vlU.o: undefined reference to symbol 'EVP_bf_cbc@@OPENSSL_1_1_0' /usr/bin/ld: /tmp/ccr7Fplc.o: undefined reference to symbol 'EVP_rc2_cbc@@OPENSSL_1_1_0' /usr/bin/ld: /tmp/ccLoba1p.o: undefined reference to symbol 'EVP_rc4@@OPENSSL_1_1_0' /usr/bin/ld: /tmp/cc2c59xU.o: undefined reference to symbol 'EVP_des_cbc@@OPENSSL_1_1_0' /usr/bin/ld: /tmp/ccBMgjL9.o: undefined reference to symbol 'EVP_desx_cbc@@OPENSSL_1_1_0' /usr/bin/ld: /tmp/ccy3ofYq.o: undefined reference to symbol 'EVP_cast5_cbc@@OPENSSL_1_1_0' /usr/bin/ld: /tmp/ccgdR42R.o: undefined reference to symbol 'EVP_aes_128_cbc@@OPENSSL_1_1_0' /usr/bin/ld: /tmp/cc68Wtc5.o: undefined reference to symbol 'EVP_aes_256_cbc@@OPENSSL_1_1_0' /usr/bin/ld: /tmp/ccXgo0Bn.o: undefined reference to symbol 'X509_check_host@@OPENSSL_1_1_0'

ColumPaget commented 4 years ago

Why? Why do they do this stuff? What was wrong with the function we had?!

It looks like the EVP functions have gone too, which seems unlikely, but configure seems to think it's the case. This is why I use libressl.

This will be effecting other projects of mine too, I think, so thanks for letting me know. I'd not have known otherwise. I'll look into this and see if I can fix it.

ColumPaget commented 4 years ago

Hi Marcus,

I believe I've fixed it, though I've not tried it on eisfair, because I can't find dhcpcd or ifconfig on that to set up the network. But I found another distro that exhibted the same error and fixed i there.

I've not made a new release yet, so this new codes is just in the latest commits to the master branch.

If you try it out, could you let me know how it goes?

Colum

MarcusRoeckrath commented 4 years ago

Hi Colum,

great seams to works

############# Hashrat Build Config: ############# Using bundled libUseful Largefiles ( > 2GB ) NOT enabled File system attributes (xattr) enabled SSL/TLS enabled

############# libUseful Build Config: ############# Largefiles ( > 2GB ) NOT enabled Filesystem attribues (xattr) enabled Linux sendfile syscall NOT enabled IPv6 NOT enabled SSL/TLS enabled zlib support enabled linux namespace support NOT enabled linux capabilities support NOT enabled

and make gives me the executable linked against libssl:

# readelf -d hashrat | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libssl.so.1.1]
 0x0000000000000001 (NEEDED)             Shared library: [libcrypto.so.1.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

Why does configure report "zlib support enabled" although I had not given --enable-zlib? I do not think that this is true on make run.

configure with --enable-zlib with or without --enable-ssl gives a make error:

libUseful-4/libUseful.a(Compression.o): In function zlibProcessorWrite': /root/tmp/libUseful-4/Compression.c:50: undefined reference todeflate' /root/tmp/libUseful-4/Compression.c:49: undefined reference to deflate' libUseful-4/libUseful.a(Compression.o): In functionzlibProcessorRead': /root/tmp/libUseful-4/Compression.c:98: undefined reference to inflate' /root/tmp/libUseful-4/Compression.c:97: undefined reference toinflate' /root/tmp/libUseful-4/Compression.c:106: undefined reference to inflateSync' libUseful-4/libUseful.a(Compression.o): In functionzlibProcessorClose': /root/tmp/libUseful-4/Compression.c:143: undefined reference to inflateEnd' /root/tmp/libUseful-4/Compression.c:144: undefined reference todeflateEnd' libUseful-4/libUseful.a(Compression.o): In function zlibProcessorInit': /root/tmp/libUseful-4/Compression.c:189: undefined reference toinflateInit' /root/tmp/libUseful-4/Compression.c:194: undefined reference to `deflateInit' /root/tmp/libUseful-4/Compression.c:188: undefined reference to inflateInit2_' /root/tmp/libUseful-4/Compression.c:193: undefined reference todeflateInit2_' collect2: error: ld returned 1 exit status Makefile:15: recipe for target 'hashrat' failed

MarcusRoeckrath commented 4 years ago

Adressing the enable-zlib problem I will open a new issue.