
Modernize OpenSSL digest and HMAC error handling (#2804)
* Remove support for OpenSSL < 1.1.1
OpenSSL 1.1.0+ manages threading internally and no longer requires
application-level locking callbacks. The init/cleanup functions
(ERR_load_crypto_strings, EVP_cleanup, etc.) are no-ops since 1.1.0.
- configure.ac: raise libcrypto minimum to 1.1.1, add
compile-time version check using OPENSSL_VERSION_NUMBER,
use DEPS_CFLAGS so non-default installations are
detected correctly
- openssl_auth.cpp: remove ~90 lines of dead crypto
mutex infrastructure and obsolete init/cleanup calls
- COMPILATION.md: document new minimum version
* Use shared EVP digest helper for md5 and sha256
Extract common EVP digest logic from s3fs_md5() and
s3fs_sha256() into s3fs_digest(). This replaces the
deprecated EVP_MD_CTX_create/destroy with RAII-managed
EVP_MD_CTX_new/free and adds error checking with OpenSSL
error strings for every EVP call.
The two s3fs_md5() variants (OpenSSL 1.1 and 3.0) were
identical and are now unified into a single implementation.
* Add shared EVP helper for file descriptor digests
Introduce s3fs_digest_fd(), analogous to s3fs_digest(),
to compute a message digest over a file descriptor using
RAII-managed EVP_MD_CTX with error checking and OpenSSL
error strings. Replace s3fs_sha256_fd() with a one-liner
wrapper, removing deprecated EVP_MD_CTX_create/destroy
and unchecked return values.
* Replace s3fs_md5_fd() with s3fs_digest_fd() wrapper
Both s3fs_md5_fd() variants (OpenSSL 3.0 and 1.1) are
replaced by a one-liner delegating to s3fs_digest_fd().
This removes the USE_OPENSSL_30 ifdef, the deprecated
MD5_Init/Update/Final calls, and the openssl/md5.h include.
* Remove USE_OPENSSL_30 build flag
The openssl_auth.cpp digest functions no longer have
separate code paths for OpenSSL 3.0 vs 1.1, making the
USE_OPENSSL_30 compile-time flag unused. Remove the
version detection in configure.ac, the AM_CONDITIONAL,
and the -D flag in Makefile.am.
* Add error handling to HMAC call
HMAC() returns nullptr on failure, but the return value
was not checked. Add the missing check with an OpenSSL
error message. Also add a debug message for null parameter
validation and simplify the duplicated HMAC() call by
selecting the algorithm upfront.