]> git.ipfire.org Git - thirdparty/dhcpcd.git/commit
Support libcrypto for hmac and sha256 (#223)
authorTobias Heider <tobias.heider@canonical.com>
Mon, 25 Sep 2023 08:49:00 +0000 (10:49 +0200)
committerGitHub <noreply@github.com>
Mon, 25 Sep 2023 08:49:00 +0000 (09:49 +0100)
commit8e316164a831e2480ae22a1ebc953dc4d6973d7a
treeb5a3d0892cbf2944f1a9b02a906827d662840e7e
parente0923934fc13e704b602bef30e969e714777f810
Support libcrypto for hmac and sha256 (#223)

* compat: Add OpenSSL libcrypto compatibility layer

Detect libcrypto in configure script.  Only fall back
to using libcrypto when /usr libs are allowed and no
other compatible implementation is available or when
--with-openssl is passed explicitly.
Make sure libcrypto and libmd are never linked at the
same time.

Add OpenSSL based SHA256 and HMAC compat shims in
compat/crypt_openssl. Depeding on version and build flags,
libcrypto ships with a compatible SHA256 API in
"openssl/sha.h".  OpenSSL 3 has deprecated the SHA API,
so if it is not detected we fall back to an EVP_DIGEST
based version.
Because the API might still be in use in OpenSSL internally,
the compatibility wrappers have a dhcpcd_ prefix to avoid
symbol conflicts.

* Add sha256 tests based on the existing hmac-md5 tests.
compat/crypt_openssl/hmac.c [new file with mode: 0644]
compat/crypt_openssl/hmac.h [new file with mode: 0644]
compat/crypt_openssl/sha256.c [new file with mode: 0644]
compat/crypt_openssl/sha256.h [new file with mode: 0644]
configure
src/dhcpcd.c
tests/crypt/Makefile
tests/crypt/run-test.c
tests/crypt/test.h
tests/crypt/test_sha256.c [new file with mode: 0644]