www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Reworking crypto backend selection

Reworking crypto backend selection

From: Peter Stuge <peter_at_stuge.se>
Date: Fri, 28 Oct 2016 04:09:16 +0200

A large-ish change, but it implements everything discussed:

If libz or a crypto backend is explicitly requested on the command line
but not found then configure exits at the end.

It can look like so, when no crypto library is requested (or =auto) and
none can be found:

$ configure --without-libz
...
checking for libssl... no
checking for libgcrypt... no
checking for libmbedtls... no
checking for libbcrypt... no
checking for libcrypt32... no
checking for ntdef.h... no
checking for ntstatus.h... no
checking whether SecureZeroMemory is declared... no
configure: ERROR: No openssl crypto library found!
No libgcrypt crypto library found!
No mbedtls crypto library found!
No wincng crypto library found!
Please specify --with-crypto and/or the neccessary library search prefix.

Run configure --help to see all crypto library options.
... other checks ...
checking non-blocking sockets style... O_NONBLOCK
configure: ERROR: No openssl crypto library found!
No libgcrypt crypto library found!
No mbedtls crypto library found!
No wincng crypto library found!
Please specify --with-crypto and/or the neccessary library search prefix.

Run configure --help to see all crypto library options.
configure: error: Required dependencies are missing!
$

When a specific backend is requested but no library found:

$ configure --without-libz --with-crypto=openssl
...
checking for libssl... no
configure: ERROR: No openssl crypto library found!
Please specify --with-crypto and/or the neccessary library search prefix.

Run configure --help to see all crypto library options.
... other checks ...
checking non-blocking sockets style... O_NONBLOCK
configure: ERROR: No openssl crypto library found!
Please specify --with-crypto and/or the neccessary library search prefix.

Run configure --help to see all crypto library options.
configure: error: Required dependencies are missing!
$

If libz is requested but not found, and a crypto library *is* found:

$ configure --with-libz --with-crypto=libgcrypt
...
checking for libz... no
configure: ERROR: No libz found!
Try --with-libz-prefix=PATH if you know that you have it.
checking for libgcrypt... yes
checking how to link with libgcrypt... -lgcrypt
... other checks ...
checking non-blocking sockets style... O_NONBLOCK
configure: ERROR: No libz found!
Try --with-libz-prefix=PATH if you know that you have it.
configure: error: Required dependencies are missing!
$

Or when libz is requested but not found, and mbedtls is also not found:

$ configure --with-libz --with-crypto=mbedtls
...
checking for libz... no
configure: ERROR: No libz found!
Try --with-libz-prefix=PATH if you know that you have it.
checking for libmbedtls... no
configure: ERROR: No mbedtls crypto library found!
Please specify --with-crypto and/or the neccessary library search prefix.

Run configure --help to see all crypto library options.
... other checks ...
checking non-blocking sockets style... O_NONBLOCK
configure: ERROR: No libz found!
Try --with-libz-prefix=PATH if you know that you have it.
configure: ERROR: No mbedtls crypto library found!
Please specify --with-crypto and/or the neccessary library search prefix.

Run configure --help to see all crypto library options.
configure: error: Required dependencies are missing!
$

Finally, here is a successful configure with optional libz:

$ configure --with-crypto=libgcrypt
...
checking for libz... no
configure: Cannot find libz, disabling compression
checking for libgcrypt... yes
checking how to link with libgcrypt... -lgcrypt
...
checking non-blocking sockets style... O_NONBLOCK
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating example/Makefile
config.status: creating docs/Makefile
config.status: creating libssh2.pc
config.status: creating src/libssh2_config.h
config.status: creating example/libssh2_config.h
config.status: executing depfiles commands
config.status: executing libtool commands
configure: summary of build options:

  version: 1.8.1_DEV
  Host type: x86_64-unknown-linux-gnu
  Install prefix: /tmp/ls
  Compiler: gcc
  Compiler flags: -g -O2
  Library types: Shared=yes, Static=yes
  Crypto library: libgcrypt
  Clear memory: unsupported
  Debug build: no
  Build examples: no
  Path to sshd: /usr/sbin/sshd (only for self-tests)
  zlib compression: not found

$

Also available in branch withcrypto at http://git.stuge.se/libssh2.git

(On top of simple180, which now includes the OS400 cleanup commit.)

Please review and comment. Thanks a lot!

//Peter
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2016-10-28

the libssh2 team