diff mbox series

[2/2] help: include unsafe SHA-1 build info in version

Message ID 20250328170121.157563-3-jltobler@gmail.com (mailing list archive)
State New
Headers show
Series help: include SHA build options in version info | expand

Commit Message

Justin Tobler March 28, 2025, 5:01 p.m. UTC
In 06c92dafb8 (Makefile: allow specifying a SHA-1 for non-cryptographic
uses, 2024-09-26), support for unsafe SHA-1 is added. Add the unsafe
SHA-1 build info to `git version --build-info` and update corresponding
documentation.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
---
 Documentation/git-version.adoc | 3 +++
 help.c                         | 8 ++++++++
 2 files changed, 11 insertions(+)

Comments

Christian Couder March 29, 2025, 8:42 a.m. UTC | #1
On Fri, Mar 28, 2025 at 6:05 PM Justin Tobler <jltobler@gmail.com> wrote:
>
> In 06c92dafb8 (Makefile: allow specifying a SHA-1 for non-cryptographic
> uses, 2024-09-26), support for unsafe SHA-1 is added. Add the unsafe
> SHA-1 build info to `git version --build-info` and update corresponding
> documentation.
>
> Signed-off-by: Justin Tobler <jltobler@gmail.com>
> ---
>  Documentation/git-version.adoc | 3 +++
>  help.c                         | 8 ++++++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/Documentation/git-version.adoc b/Documentation/git-version.adoc
> index 80fa7754a6..53c8ba74c1 100644
> --- a/Documentation/git-version.adoc
> +++ b/Documentation/git-version.adoc
> @@ -22,6 +22,9 @@ OPTIONS
>  --build-options::
>         Include additional information about how git was built for diagnostic
>         purposes.
> ++
> +If built to use a faster SHA-1 implementation for non-cryptographic purposes,
> +the implmentation used is denoted as "unsafe-SHA-1".

s/the implmentation used/that implementation/
diff mbox series

Patch

diff --git a/Documentation/git-version.adoc b/Documentation/git-version.adoc
index 80fa7754a6..53c8ba74c1 100644
--- a/Documentation/git-version.adoc
+++ b/Documentation/git-version.adoc
@@ -22,6 +22,9 @@  OPTIONS
 --build-options::
 	Include additional information about how git was built for diagnostic
 	purposes.
++
+If built to use a faster SHA-1 implementation for non-cryptographic purposes,
+the implmentation used is denoted as "unsafe-SHA-1".
 
 GIT
 ---
diff --git a/help.c b/help.c
index 32b5d4e6f5..7670e0a64a 100644
--- a/help.c
+++ b/help.c
@@ -784,6 +784,14 @@  static void get_sha_impl(struct strbuf *buf)
 	strbuf_addstr(buf, "SHA-1: Collision Detection\n");
 #endif
 
+#if defined(SHA1_OPENSSL_UNSAFE)
+	strbuf_addstr(buf, "unsafe-SHA-1: OpenSSL\n");
+#elif defined(SHA1_BLK_UNSAFE)
+	strbuf_addstr(buf, "unsafe-SHA-1: blk\n");
+#elif defined(SHA1_APPLE_UNSAFE)
+	strbuf_addstr(buf, "unsafe-SHA-1: Apple CommonCrypto\n");
+#endif
+
 #if defined(SHA256_OPENSSL)
 	strbuf_addstr(buf, "SHA-256: OpenSSL\n");
 #elif defined(SHA256_NETTLE)