Commit Graph

16 Commits

Author SHA1 Message Date
Marcin Dabrowski
7f7dfe71cc Add OpenSSL-FIPS CMake flag
Usage of the deprecated 'SHA256_*' OpenSSL API in a FIPS compliant
environment results in OpenSSL's assertion failure with the following
description:
"OpenSSL internal error, assertion failed: Low level API call to
 digest SHA256 forbidden in FIPS mode!"

This commit adds a possibility to use the OpenSSL's 'EVP_MD*' API instead
of the deprecated 'SHA256_*' API, by extending the optional CMake flag
'USE_SHA256' with the new option called 'OpenSSL-FIPS'.
The new option is used to choose a hashing backend used by libgit2 to
calculate SHA256 hashes, in a similar way that currently existing
options like 'OpenSSL', 'OpenSSL-Dynamic', 'mbedTLS' etc do.

'OpenSSL-FIPS' is a fully opt-in option which is purposely not
interfering with the existing options, because, after running some
benchmarks, it's been discovered that using the 'EVP_MD*' API causes
hashing to be a bit slower in comparison to using the deprecated
'SHA256_*' API.

Another change introduced in this commit is the enhancement of the
Nightly workflow (nightly.yml) which will cause libgit2 to be
automatically built with '-DUSE_SHA256="OpenSSL-FIPS"' CMake flag,
on Linux, macOS and Windows.
2024-10-09 14:53:44 +02:00
Edward Thomson
f68f542eb6 http: introduce schannel streams for windows
Provide a stream interface for Schannel - the native crypto APIs - on
Windows. This allows Windows to use the same HTTP transport that all the
other platforms use, with its own native crypto.

Ultimately this allows us to deprecate WinHTTP and we need not add
support for our socket changes in two places (our HTTP stack and the
WinHTTP stack).
2023-03-21 09:09:48 +00:00
Edward Thomson
3bd9bb8d77 sha256: support dynamically loaded openssl 2022-04-04 13:29:19 -04:00
Edward Thomson
6a7d5d23c7 sha: support Win32 for SHA256
Adding SHA256 support prompted an overdue refactoring of some of the
unnecessary complexity around the CNG/CryptoAPI abstraction.
2022-03-23 08:39:19 -04:00
Edward Thomson
6b4a6faab3 sha: support OpenSSL for SHA256 2022-03-23 08:39:19 -04:00
Edward Thomson
b3e3fa10ea sha: support mbedTLS for SHA256 2022-03-23 08:39:19 -04:00
Edward Thomson
83c2778611 sha: support CommonCrypto for SHA256 2022-03-23 08:39:19 -04:00
Edward Thomson
b900981cf7 sha: add sha256 algorithm
Add support for a SHA256 hash algorithm, and add the "builtin" SHA256
hash engine (from RFC 6234).
2022-03-23 08:39:19 -04:00
Edward Thomson
8bc998f481 sha1: remove generic implementation
Remove the "generic" implementation; it should never be used; it only
existed for a no-dependencies configuration, and our bundled sha1dc
satisfies that requirement _and_ is correct.
2022-03-23 08:39:19 -04:00
Edward Thomson
c3b7ace9cf refactor: make util an object library
Instead of simply including the utility files directly, make them a
cmake object library for easy reusability between other projects within
libgit2.

Now the top-level `src` is responsible for platform selection, while the
next-level `libgit2` and `util` configurations are responsible for
identifying what objects they include.
2022-02-22 22:07:44 -05:00
Edward Thomson
2c154145a8 cmake: move sha1 source selection into CMakeLists.txt
The select hashes module selects the hash; the CMakeLists.txt selects
the files to implement it.
2021-11-14 07:25:41 -05:00
Edward Thomson
395b3dc403 cmake: refactor global variables
Update the global variables `LIBGIT2_OBJECTS` to
`LIBGIT2_DEPENDENCY_OBJECTS` for clarity and consistency.
2021-11-14 07:25:41 -05:00
Edward Thomson
c3fec45645 cmake: reformat modules
Apply the standard project cmake formatting to the modules.
2021-11-14 07:25:41 -05:00
Dmitry Lobanov
4c0ea9f06d cmake: select hashes umbrella variable has been removed.
Co-authored-by: Edward Thomson <ethomson@github.com>
2021-08-28 20:18:38 +03:00
Dmitry Lobanov
08b3ee2f83 cmake: select hashes missing umbrella header has been added. 2021-08-28 16:17:50 +03:00
Patrick Steinhardt
bc02bcd920 cmake: move modules into the "cmake/" top level dir
Our custom CMake module currently live in "cmake/Modules". As the
"cmake/" directory doesn't contain anything except the "Modules"
directory, it doesn't really make sense to have the additional
intermediate directory. So let's instead move the modules one level up
into the "cmake/" top level directory.
2020-06-01 14:06:20 +02:00