From patchwork Fri Apr 22 09:53:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12823160 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F36EDC433EF for ; Fri, 22 Apr 2022 09:53:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446269AbiDVJ4W (ORCPT ); Fri, 22 Apr 2022 05:56:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386031AbiDVJ4V (ORCPT ); Fri, 22 Apr 2022 05:56:21 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3C2F53B53 for ; Fri, 22 Apr 2022 02:53:24 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id q7so2637895wrm.5 for ; Fri, 22 Apr 2022 02:53:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Sd3lSCkl9NLhcZ2ZkGYLROWgtYjQOG9zT1SG37D8hOg=; b=EL7sPK37YgvHijetPm1l+OWbaDaD/MySB4wWPcWPa5GzC0xWzRz9sa6WoCRbtpY/Ty lEJdazKVWYbRRk5o6Wbfd3AjjnIZLOnhFmesz7sel6viCL/JBA99V9aiK/t8K9UurbkQ GL21wdmHdB+LZgdnYyld+qNsmqdzmyID1Bkot3gi0DRthlYVSYoEebnJONZhpTUvNH4T 4jihZm7j060bNiu6w8zl1DID1EdVeRoZaZApIN4eL1foNDUNO+CjbbtTe8n9c4chUqsc xKVRvYRPu1rQA+vtCb4Y4/Wx9CoV7IUF4SWtYo+TUM1ZPmmVZxf9VTi7ieGLotMKkbz5 w2uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Sd3lSCkl9NLhcZ2ZkGYLROWgtYjQOG9zT1SG37D8hOg=; b=qKhUMPs7pJfWzh9MYxvQ8ZOIPPtQJ4nM2/0zgb8bKPl1ZGj3Ar7cNpUMD0uuF66rxl NWzzgDEuCdsY34D9xEwpjxBy1ptxay1O/ChkzUyZYCOot4Jr/KN8HJ89AMYeJ/8gn34A SvjAiqz7pGs7pJg/Dm+n1xCp/nMdrduc7M+VrMHC5HvsE49xVAaEtE2fiQi4ErqXRaBW 1AqudgEmcJnBbCjVFFQSW8ESmk5UtMAv6aH3CdSI174jTJdgjrowBjsTVJ0VtDwoFH5U V14y38am7EW3uPHLw7ka5oQr5GjoNl2ulCq42Zj3WJgd2i6BmybhvTvMgdc/xVtF4Y6R N1lA== X-Gm-Message-State: AOAM531crtAy9wFKyeiPKizlCdCCT+8A0txDwa6+COLH8ozHtC51S2gU UjRIHQkODG8r6kLeF74nEyUazoky+6Nkbg== X-Google-Smtp-Source: ABdhPJwFFWUdx7koTXabp10q4UsvltE+qS8BOENFvmmvGJVs1pC8l2/NNIyaGHfhXBK7j2szUnyc6Q== X-Received: by 2002:a5d:5144:0:b0:207:9a13:ca73 with SMTP id u4-20020a5d5144000000b002079a13ca73mr3072712wrt.268.1650621203067; Fri, 22 Apr 2022 02:53:23 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id i6-20020adfa506000000b0020ac34ec647sm1365561wrb.110.2022.04.22.02.53.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 02:53:22 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , "brian m . carlson" , Carlo Arenas , Mike Hommey , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 1/5] Makefile: create and use sections for "define" flag listing Date: Fri, 22 Apr 2022 11:53:12 +0200 Message-Id: X-Mailer: git-send-email 2.36.0.879.g56a83971f3f In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Since the "Define ..." template of comments at the top of the Makefile was started in 5bdac8b3269 ([PATCH] Improve the compilation-time settings interface, 2005-07-29) we've had a lot more flags added, including flags that come in "groups". Not having any obvious structure to the >500 line comment at the top of the Makefile has made it hard to follow. This change is almost entirely a move-only change, the two paragraphs at the start of the first two sections are new, and so are the added sections themselves, but other than that no lines are changed, only moved. We now list Makefile-only flags at the start, followed by stand-alone flags, and then cover "optional library" flags in their respective groups, followed by SHA-1 and SHA-256 flags, and finally DEVELOPER-specific flags. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 212 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 118 insertions(+), 94 deletions(-) diff --git a/Makefile b/Makefile index f8bccfab5e9..246f6729022 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,20 @@ all:: # Import tree-wide shared Makefile behavior and libraries include shared.mak +# == Makefile defines == +# +# These defines change the behavior of the Makefile itself, but have +# no impact on what it builds: +# # Define V=1 to have a more verbose compile. # +# == Portability and optional library defines == +# +# These defines indicate what Git can expect from the OS, what +# libraries are available etc. Much of this is auto-detected in +# config.mak.uname, or in configure.ac when using the optional "make +# configure && ./configure" (see INSTALL). +# # Define SHELL_PATH to a POSIX shell if your /bin/sh is broken. # # Define SANE_TOOL_PATH to a colon-separated list of paths to prepend @@ -30,68 +42,8 @@ include shared.mak # # Define NO_OPENSSL environment variable if you do not have OpenSSL. # -# Define USE_LIBPCRE if you have and want to use libpcre. Various -# commands such as log and grep offer runtime options to use -# Perl-compatible regular expressions instead of standard or extended -# POSIX regular expressions. -# -# Only libpcre version 2 is supported. USE_LIBPCRE2 is a synonym for -# USE_LIBPCRE, support for the old USE_LIBPCRE1 has been removed. -# -# Define LIBPCREDIR=/foo/bar if your PCRE header and library files are -# in /foo/bar/include and /foo/bar/lib directories. -# # Define HAVE_ALLOCA_H if you have working alloca(3) defined in that header. # -# Define NO_CURL if you do not have libcurl installed. git-http-fetch and -# git-http-push are not built, and you cannot use http:// and https:// -# transports (neither smart nor dumb). -# -# Define CURLDIR=/foo/bar if your curl header and library files are in -# /foo/bar/include and /foo/bar/lib directories. -# -# Define CURL_CONFIG to curl's configuration program that prints information -# about the library (e.g., its version number). The default is 'curl-config'. -# -# Define CURL_LDFLAGS to specify flags that you need to link when using libcurl, -# if you do not want to rely on the libraries provided by CURL_CONFIG. The -# default value is a result of `curl-config --libs`. An example value for -# CURL_LDFLAGS is as follows: -# -# CURL_LDFLAGS=-lcurl -# -# Define NO_EXPAT if you do not have expat installed. git-http-push is -# not built, and you cannot push using http:// and https:// transports (dumb). -# -# Define EXPATDIR=/foo/bar if your expat header and library files are in -# /foo/bar/include and /foo/bar/lib directories. -# -# Define EXPAT_NEEDS_XMLPARSE_H if you have an old version of expat (e.g., -# 1.1 or 1.2) that provides xmlparse.h instead of expat.h. -# -# Define NO_GETTEXT if you don't want Git output to be translated. -# A translated Git requires GNU libintl or another gettext implementation, -# plus libintl-perl at runtime. -# -# Define USE_GETTEXT_SCHEME and set it to 'fallthrough', if you don't trust -# the installed gettext translation of the shell scripts output. -# -# Define HAVE_LIBCHARSET_H if you haven't set NO_GETTEXT and you can't -# trust the langinfo.h's nl_langinfo(CODESET) function to return the -# current character set. GNU and Solaris have a nl_langinfo(CODESET), -# FreeBSD can use either, but MinGW and some others need to use -# libcharset.h's locale_charset() instead. -# -# Define CHARSET_LIB to the library you need to link with in order to -# use locale_charset() function. On some platforms this needs to set to -# -lcharset, on others to -liconv . -# -# Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't -# need -lintl when linking. -# -# Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt -# doesn't support GNU extensions like --check and --statistics -# # Define HAVE_PATHS_H if you have paths.h and want to use the default PATH # it specifies. # @@ -152,40 +104,6 @@ include shared.mak # and do not want to use Apple's CommonCrypto library. This allows you # to provide your own OpenSSL library, for example from MacPorts. # -# Define BLK_SHA1 environment variable to make use of the bundled -# optimized C SHA1 routine. -# -# Define PPC_SHA1 environment variable when running make to make use of -# a bundled SHA1 routine optimized for PowerPC. -# -# Define DC_SHA1 to unconditionally enable the collision-detecting sha1 -# algorithm. This is slower, but may detect attempted collision attacks. -# Takes priority over other *_SHA1 knobs. -# -# Define DC_SHA1_EXTERNAL in addition to DC_SHA1 if you want to build / link -# git with the external SHA1 collision-detect library. -# Without this option, i.e. the default behavior is to build git with its -# own built-in code (or submodule). -# -# Define DC_SHA1_SUBMODULE in addition to DC_SHA1 to use the -# sha1collisiondetection shipped as a submodule instead of the -# non-submodule copy in sha1dc/. This is an experimental option used -# by the git project to migrate to using sha1collisiondetection as a -# submodule. -# -# Define OPENSSL_SHA1 environment variable when running make to link -# with the SHA1 routine from openssl library. -# -# Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed -# in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO -# wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined. -# -# Define BLK_SHA256 to use the built-in SHA-256 routines. -# -# Define GCRYPT_SHA256 to use the SHA-256 routines in libgcrypt. -# -# Define OPENSSL_SHA256 to use the SHA-256 routines in OpenSSL. -# # Define NEEDS_CRYPTO_WITH_SSL if you need -lcrypto when using -lssl (Darwin). # # Define NEEDS_SSL_WITH_CRYPTO if you need -lssl when using -lcrypto (Darwin). @@ -480,6 +398,112 @@ include shared.mak # `compat/fsmonitor/fsm-listen-.c` that implements the # `fsm_listen__*()` routines. # +# === Optional library: libintl === +# +# Define NO_GETTEXT if you don't want Git output to be translated. +# A translated Git requires GNU libintl or another gettext implementation, +# plus libintl-perl at runtime. +# +# Define USE_GETTEXT_SCHEME and set it to 'fallthrough', if you don't trust +# the installed gettext translation of the shell scripts output. +# +# Define HAVE_LIBCHARSET_H if you haven't set NO_GETTEXT and you can't +# trust the langinfo.h's nl_langinfo(CODESET) function to return the +# current character set. GNU and Solaris have a nl_langinfo(CODESET), +# FreeBSD can use either, but MinGW and some others need to use +# libcharset.h's locale_charset() instead. +# +# Define CHARSET_LIB to the library you need to link with in order to +# use locale_charset() function. On some platforms this needs to set to +# -lcharset, on others to -liconv . +# +# Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't +# need -lintl when linking. +# +# Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt +# doesn't support GNU extensions like --check and --statistics +# +# === Optional library: libexpat === +# +# Define NO_EXPAT if you do not have expat installed. git-http-push is +# not built, and you cannot push using http:// and https:// transports (dumb). +# +# Define EXPATDIR=/foo/bar if your expat header and library files are in +# /foo/bar/include and /foo/bar/lib directories. +# +# Define EXPAT_NEEDS_XMLPARSE_H if you have an old version of expat (e.g., +# 1.1 or 1.2) that provides xmlparse.h instead of expat.h. + +# === Optional library: libcurl === +# +# Define NO_CURL if you do not have libcurl installed. git-http-fetch and +# git-http-push are not built, and you cannot use http:// and https:// +# transports (neither smart nor dumb). +# +# Define CURLDIR=/foo/bar if your curl header and library files are in +# /foo/bar/include and /foo/bar/lib directories. +# +# Define CURL_CONFIG to curl's configuration program that prints information +# about the library (e.g., its version number). The default is 'curl-config'. +# +# Define CURL_LDFLAGS to specify flags that you need to link when using libcurl, +# if you do not want to rely on the libraries provided by CURL_CONFIG. The +# default value is a result of `curl-config --libs`. An example value for +# CURL_LDFLAGS is as follows: +# +# CURL_LDFLAGS=-lcurl +# +# === Optional library: libpcre2 === +# +# Define USE_LIBPCRE if you have and want to use libpcre. Various +# commands such as log and grep offer runtime options to use +# Perl-compatible regular expressions instead of standard or extended +# POSIX regular expressions. +# +# Only libpcre version 2 is supported. USE_LIBPCRE2 is a synonym for +# USE_LIBPCRE, support for the old USE_LIBPCRE1 has been removed. +# +# Define LIBPCREDIR=/foo/bar if your PCRE header and library files are +# in /foo/bar/include and /foo/bar/lib directories. +# +# == SHA-1 and SHA-256 defines == +# +# Define BLK_SHA1 environment variable to make use of the bundled +# optimized C SHA1 routine. +# +# Define PPC_SHA1 environment variable when running make to make use of +# a bundled SHA1 routine optimized for PowerPC. +# +# Define DC_SHA1 to unconditionally enable the collision-detecting sha1 +# algorithm. This is slower, but may detect attempted collision attacks. +# Takes priority over other *_SHA1 knobs. +# +# Define DC_SHA1_EXTERNAL in addition to DC_SHA1 if you want to build / link +# git with the external SHA1 collision-detect library. +# Without this option, i.e. the default behavior is to build git with its +# own built-in code (or submodule). +# +# Define DC_SHA1_SUBMODULE in addition to DC_SHA1 to use the +# sha1collisiondetection shipped as a submodule instead of the +# non-submodule copy in sha1dc/. This is an experimental option used +# by the git project to migrate to using sha1collisiondetection as a +# submodule. +# +# Define OPENSSL_SHA1 environment variable when running make to link +# with the SHA1 routine from openssl library. +# +# Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed +# in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO +# wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined. +# +# Define BLK_SHA256 to use the built-in SHA-256 routines. +# +# Define GCRYPT_SHA256 to use the SHA-256 routines in libgcrypt. +# +# Define OPENSSL_SHA256 to use the SHA-256 routines in OpenSSL. +# +# == DEVELOPER defines == +# # Define DEVELOPER to enable more compiler warnings. Compiler version # and family are auto detected, but could be overridden by defining # COMPILER_FEATURES (see config.mak.dev). You can still set From patchwork Fri Apr 22 09:53:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12823165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C04BC433F5 for ; Fri, 22 Apr 2022 09:53:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446281AbiDVJ4j (ORCPT ); Fri, 22 Apr 2022 05:56:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446263AbiDVJ4X (ORCPT ); Fri, 22 Apr 2022 05:56:23 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D311753E1A for ; Fri, 22 Apr 2022 02:53:25 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id c10so10292416wrb.1 for ; Fri, 22 Apr 2022 02:53:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sePqX8f+H4jaUZ6Quh8ZPFqH9dadargF7IBbj4gV1CA=; b=oaqNR+vaqlZJW+R4sGGx7+9RDaMCZNkB7fUsurX/momLrnuiusYlb69Vv6f0RbjjDg jSI9scEwcMlc7sQ/Sfks3+XDxAO2GOUGezfNEOSqCkLfQiH//A/MK4BOhLNIdC4oIKw+ ogtNdHSKheWpByBEaw+kRhwe3EW9lLb7pFtDWSTXXBPE0TQyVmg/EFnZYH/MIGS769WT tJILjR/7pcumKE57LdIMti30uFQwGp+X88o2yj/nnD1Olk7/N30JRdeKcraaxZYwaj1F dFleQxLFgn2cN819o4ec2S6harPlHimAlt/ADymie1FVBY9Rhn//w2PHT/qyREIfgv8t ssqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sePqX8f+H4jaUZ6Quh8ZPFqH9dadargF7IBbj4gV1CA=; b=4+zTcAB7rkjMK655qXsq1HqehvA1++D5CGHAHzG7QRbnSCfhg3Lz33uwXXQ66c/ZrH 4wz+B+QOvyosIoCHTOdPordqQxJ6rrtuQEfZgpRI7fhndCwQw/324Q299mTbIyg5sQLy HO5oU2DGHdaC0+Yz6DpmvCo0dlB/EFrsekjXqoBU56ZLt2nODJDWrC5oEQaucrjIcEVU 1QZIt8REt7BbozxyZmttP0nLScgs2OlgxySTttLKEFgH7jGtKtdQ0uzeBf1EUpqB5RkC xMG3uyt16lvp11ZTzgLnx6F56/ZW7kdWWPiYk33oSPQV+8OETUgPBj/+o/ijQ/4Cbu3O u+ng== X-Gm-Message-State: AOAM531tsRg7XkhayLE73kyY421AckRm7cmPW0OLvVsUfRv/1J+AFYEK ennY1hcJBSfzPbD101pCoTB2+iDcPWSuQA== X-Google-Smtp-Source: ABdhPJznPv5bFvA4Y7XuW7KhOTM0zuJ346oYgY2kGubb+ixF9V3Z+AHPT8fu7qKvwcsEzqn+YyjVoA== X-Received: by 2002:a5d:5904:0:b0:20a:bde8:ed8e with SMTP id v4-20020a5d5904000000b0020abde8ed8emr3043306wrd.215.1650621204081; Fri, 22 Apr 2022 02:53:24 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id i6-20020adfa506000000b0020ac34ec647sm1365561wrb.110.2022.04.22.02.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 02:53:23 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , "brian m . carlson" , Carlo Arenas , Mike Hommey , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 2/5] Makefile: really use and document sha1collisiondetection by default Date: Fri, 22 Apr 2022 11:53:13 +0200 Message-Id: X-Mailer: git-send-email 2.36.0.879.g56a83971f3f In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When the sha1collisiondetection library was added and made the default in [1] we never updated the documentation added in [2] early in that series once the default was flipped to DC_SHA1 in [3]. Furthermore the INSTALL file has been claiming that we use OpenSSL by default since [4], and hadn't been updated for the sha1collisiondetection switch. The interaction between NO_APPLE_COMMON_CRYPTO and DC_SHA1 seems to have been missed in [3], so ever since DC_SHA1 was made the default we've still used Apple's CommonCrypto instead of sha1collisiondetection on Darwin and Mac OS X. Instead off all of this we now: * Don't have a DC_SHA1 know anymore (using it is an error), you need to set NO_DC_SHA1 instead to use any optional *_SHA1 implementation. * Re-arranged the algorithm inclusion in hash.h to correspond to NO_DC_SHA1, and "#error" if we have no defined SHA_*, rather than silently picking block-sha1/sha1.h as a fallback. * Have an INSTALL that reflects reality. We were still claiming to use OpenSSL's SHA-1 hashing by default. * Have Darwin and Mac OS X use sha1collisiondetection, like everywhere else. There is still a NO_APPLE_COMMON_CRYPTO knob, but it's used for things unrelated to SHA-1 (see [6]). * Have a rewritten discussion of SHA-1 and SHA-256 in the Makefile which covers all of this. 1. 48b3693d3ce (Merge branch 'jk/sha1dc', 2017-03-24) 2. 8325e43b82d (Makefile: add DC_SHA1 knob, 2017-03-16) 3. e6b07da2780 (Makefile: make DC_SHA1 the default, 2017-03-17) 4. 5beb577db8c (INSTALL: Describe dependency knobs from Makefile, 2009-09-10) 5. 4dcd7732db0 (Makefile: add support for Apple CommonCrypto facility, 2013-05-19) 6. 3ef2bcad02e (imap-send: use Apple's Security framework for base64 encoding, 2013-07-29) Signed-off-by: Ævar Arnfjörð Bjarmason --- INSTALL | 11 +-- Makefile | 108 ++++++++++++++++++---------- contrib/buildsystems/CMakeLists.txt | 3 +- hash.h | 10 +-- t/t0013-sha1dc.sh | 4 +- 5 files changed, 88 insertions(+), 48 deletions(-) diff --git a/INSTALL b/INSTALL index 4140a3f5c8b..8fc350fc124 100644 --- a/INSTALL +++ b/INSTALL @@ -133,10 +133,13 @@ Issues of note: you are using libcurl older than 7.34.0. Otherwise you can use NO_OPENSSL without losing git-imap-send. - By default, git uses OpenSSL for SHA1 but it will use its own - library (inspired by Mozilla's) with either NO_OPENSSL or - BLK_SHA1. Also included is a version optimized for PowerPC - (PPC_SHA1). + - Git uses an altered version of SHA-1 by default which + detects the SHAttered attack via the sha1collisiondetection + counter-cryptanalysis library. For SHA-256 we'll select a + working implementation (and ship a fallback + implementation). See the "SHA-1 and SHA-256 defines" section + in the Makefile for details. You should not need to tweak + those settings. - "libcurl" library is used for fetching and pushing repositories over http:// or https://, as well as by diff --git a/Makefile b/Makefile index 246f6729022..12bb9edd70a 100644 --- a/Makefile +++ b/Makefile @@ -468,33 +468,65 @@ include shared.mak # # == SHA-1 and SHA-256 defines == # -# Define BLK_SHA1 environment variable to make use of the bundled -# optimized C SHA1 routine. +# === SHA-1 backend === # -# Define PPC_SHA1 environment variable when running make to make use of -# a bundled SHA1 routine optimized for PowerPC. +# Due to the SHAttered (https://shattered.io) attack vector on SHA-1 +# Git uses the sha1collisiondetection counter-cryptanalysis library +# for SHA-1 hashing. +# +# You're strongly advised not to override this for any usage of Git +# where you don't 100% trust the repository content. +# +# ==== Options common to all SHA-1 implementations ==== +# +# Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed +# in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO +# wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined. # -# Define DC_SHA1 to unconditionally enable the collision-detecting sha1 -# algorithm. This is slower, but may detect attempted collision attacks. -# Takes priority over other *_SHA1 knobs. +# ===== Options for the default sha1collisiondetection implementations ===== # -# Define DC_SHA1_EXTERNAL in addition to DC_SHA1 if you want to build / link +# Define DC_SHA1_EXTERNAL if you want to build / link # git with the external SHA1 collision-detect library. # Without this option, i.e. the default behavior is to build git with its # own built-in code (or submodule). # -# Define DC_SHA1_SUBMODULE in addition to DC_SHA1 to use the +# Define DC_SHA1_SUBMODULE to use the # sha1collisiondetection shipped as a submodule instead of the # non-submodule copy in sha1dc/. This is an experimental option used # by the git project to migrate to using sha1collisiondetection as a # submodule. # +# ==== Alternate implementations ==== +# +# Git still ships with alternate SHA-1 implementations. These are +# faster than the default, which is useful when hashing speed +# is imperative, consider using them if you're confident that you +# won't need to worry about SHA-1 collision attacks. +# +# To use them you must define NO_DC_SHA1 and one of the *_SHA1 +# variables below: +# +# Define BLK_SHA1 environment variable to make use of the bundled +# optimized C SHA1 routine. +# # Define OPENSSL_SHA1 environment variable when running make to link # with the SHA1 routine from openssl library. # -# Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed -# in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO -# wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined. +# Define PPC_SHA1 environment variable when running make to make use of +# a bundled SHA1 routine optimized for PowerPC. +# +# Define APPLE_SHA1 to use Apple's CommonCrypto SHA-1 routines on +# Darwin/Mac OS X. +# +# The APPLE_SHA1 option is unrelated to the NO_APPLE_COMMON_CRYPTO +# flag, which determines if Apple's crypto libraries are used for +# things that aren't SHA-1. +# +# === SHA-256 backend === +# +# Unlike SHA-1 the SHA-256 algorithm does not suffer from any known +# vulnerabilities, so any implementation will do. BLK_SHA256 is +# currently the default implementation (but that may change). # # Define BLK_SHA256 to use the built-in SHA-256 routines. # @@ -1434,7 +1466,6 @@ ifeq ($(uname_S),Darwin) endif ifndef NO_APPLE_COMMON_CRYPTO NO_OPENSSL = YesPlease - APPLE_COMMON_CRYPTO = YesPlease COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO endif NO_REGEX = YesPlease @@ -1796,30 +1827,15 @@ ifdef NO_POSIX_GOODIES BASIC_CFLAGS += -DNO_POSIX_GOODIES endif -ifdef APPLE_COMMON_CRYPTO - # Apple CommonCrypto requires chunking - SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L +ifdef DC_SHA1 +$(error the DC_SHA1 flag is no longer used, and has become the default. Adjust your build scripts accordingly) endif - -ifdef OPENSSL_SHA1 - EXTLIBS += $(LIB_4_CRYPTO) - BASIC_CFLAGS += -DSHA1_OPENSSL -else -ifdef BLK_SHA1 - LIB_OBJS += block-sha1/sha1.o - BASIC_CFLAGS += -DSHA1_BLK -else -ifdef PPC_SHA1 - LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o - BASIC_CFLAGS += -DSHA1_PPC -else -ifdef APPLE_COMMON_CRYPTO - COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL - BASIC_CFLAGS += -DSHA1_APPLE -else - DC_SHA1 := YesPlease - BASIC_CFLAGS += -DSHA1_DC +ifndef NO_DC_SHA1 + ifneq ($(OPENSSL_SHA1)$(BLK_SHA1)$(PPC_SHA1)$(APPLE_SHA1),) +$(error no other *_SHA1 option can be defined unless NO_DC_SHA1 is defined) + endif LIB_OBJS += sha1dc_git.o + ifdef DC_SHA1_EXTERNAL ifdef DC_SHA1_SUBMODULE ifneq ($(DC_SHA1_SUBMODULE),auto) @@ -1843,6 +1859,26 @@ endif -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" \ -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" endif +else # !NO_DC_SHA1 +BASIC_CFLAGS += -DNO_SHA1_DC +ifdef OPENSSL_SHA1 + EXTLIBS += $(LIB_4_CRYPTO) + BASIC_CFLAGS += -DSHA1_OPENSSL +else +ifdef BLK_SHA1 + LIB_OBJS += block-sha1/sha1.o + BASIC_CFLAGS += -DSHA1_BLK +else +ifdef PPC_SHA1 + LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o + BASIC_CFLAGS += -DSHA1_PPC +else +ifdef APPLE_SHA1 + COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL + BASIC_CFLAGS += -DSHA1_APPLE +else +$(error when defining NO_DC_SHA1 another valid *_SHA1 variable must be defined!) +endif endif endif endif @@ -2884,7 +2920,7 @@ GIT-BUILD-OPTIONS: FORCE @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+ @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+ @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+ - @echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+ + @echo NO_DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(NO_DC_SHA1)))'\' >>$@+ @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+ @echo X=\'$(X)\' >>$@+ ifdef FSMONITOR_DAEMON_BACKEND diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 185f56f414f..10616188e4e 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -996,7 +996,6 @@ set(NO_PERL ) set(NO_PTHREADS ) set(NO_PYTHON ) set(PAGER_ENV "LESS=FRX LV=-c") -set(DC_SHA1 YesPlease) set(RUNTIME_PREFIX true) set(NO_GETTEXT ) @@ -1032,7 +1031,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DC_SHA1='${DC_SHA1}'\n") +file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_DC_SHA1=''\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n") diff --git a/hash.h b/hash.h index 5d40368f18a..20012167ce4 100644 --- a/hash.h +++ b/hash.h @@ -4,16 +4,18 @@ #include "git-compat-util.h" #include "repository.h" -#if defined(SHA1_PPC) +#if !defined(NO_SHA1_DC) +#include "sha1dc_git.h" +#elif defined(SHA1_PPC) #include "ppc/sha1.h" #elif defined(SHA1_APPLE) #include #elif defined(SHA1_OPENSSL) #include -#elif defined(SHA1_DC) -#include "sha1dc_git.h" -#else /* SHA1_BLK */ +#elif defined(SHA1_BLK) #include "block-sha1/sha1.h" +#else +#error "need a SHA1_* implementation defined" #endif #if defined(SHA256_GCRYPT) diff --git a/t/t0013-sha1dc.sh b/t/t0013-sha1dc.sh index 9ad76080aa4..539270a2665 100755 --- a/t/t0013-sha1dc.sh +++ b/t/t0013-sha1dc.sh @@ -6,9 +6,9 @@ TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh TEST_DATA="$TEST_DIRECTORY/t0013" -if test -z "$DC_SHA1" +if test -n "$NO_DC_SHA1" then - skip_all='skipping sha1 collision tests, DC_SHA1 not set' + skip_all='skipping sha1 collision tests, NO_DC_SHA1 set' test_done fi From patchwork Fri Apr 22 09:53:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12823163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CC90C433EF for ; Fri, 22 Apr 2022 09:53:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446046AbiDVJ4i (ORCPT ); Fri, 22 Apr 2022 05:56:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446258AbiDVJ4X (ORCPT ); Fri, 22 Apr 2022 05:56:23 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18E6A53E1D for ; Fri, 22 Apr 2022 02:53:27 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id v12so3470690wrv.10 for ; Fri, 22 Apr 2022 02:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1EzsCpAjWZwhLkrV00aw0GMWluLOtwJO4WHCO47vYDw=; b=PmXd3TKqE9UyXaB+1G/fPen08N2m5dYt14geUOzWAYdGzIFqYOr0EkukMXvuj3326w 3NgtU6QWBcon4dhpj0S/1Bp0RBlLeiPKjQAO8+/86vsSui1F0KEH4QJ67BEons6wwd8J A9x5DyrUsqvdFSlc5KwMQClWV3A8qXBBo1c0oOfzgC+1sdgAZ38qnv8j1hgSc+pr+Q2m 9KiZQLBemlVxVMp7S3pIom5pNbq3/iagiwHAmQCpC7nfa2w//xULDjDqxpClpp49SCsU omgWduHgxXZjCD8n8ndUcdzYkhuK2l2bYzkmF30sCMK/tUAEndxJoo3eR9Dnf6v0K8dR SYOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1EzsCpAjWZwhLkrV00aw0GMWluLOtwJO4WHCO47vYDw=; b=jFJeDIPwgDV9t6NA254eg9bORZkJ7ACjlj5h8WKUGUic/l8pRtYuKbyodFBDxuwEfH Z7KaRBZx8LoX2bKNahJvkgfGfbEpHWsPx/BzevOpAAB4vgzz+nUfW/Ll7vZMqsAr/7n6 8fTJgHAFZSE6cW6aMOfMI1QtgIXQcLV068F/KBP1gZyIhGQMAz1TUgyB4Vnm4HJ9Mj/Z UVKPDzZwon504dJ7ZkCjkxfDEUV3TtDmD+hZ7iFat8mjkquJrMjJO2t4j+rRPZdbgoi/ 5Tt/G+iEtWZG8GJFtNjSEvdz+SQmX2HNEok02xXY5YLGtAZXmEg+EVSi/q/E10SumS/Y xjHQ== X-Gm-Message-State: AOAM531zoznhdZa7ataiyGujw94i1BZXSzE+qMJxC27BLZSn5f/Q2yb0 413v33+dNAOiAPzxJYL2sI453WiUQGr06Q== X-Google-Smtp-Source: ABdhPJxAMcKgPm3wOYeFX+ZUcgfUgW6QIpLCy76XSLmnZKEL3pQlluMonUlpsxtNRyfb4SRGqbTpcg== X-Received: by 2002:adf:e4c1:0:b0:20a:aa0f:ea77 with SMTP id v1-20020adfe4c1000000b0020aaa0fea77mr3033642wrm.447.1650621205270; Fri, 22 Apr 2022 02:53:25 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id i6-20020adfa506000000b0020ac34ec647sm1365561wrb.110.2022.04.22.02.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 02:53:24 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , "brian m . carlson" , Carlo Arenas , Mike Hommey , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 3/5] Makefile: rephrase the discussion of *_SHA1 knobs Date: Fri, 22 Apr 2022 11:53:14 +0200 Message-Id: X-Mailer: git-send-email 2.36.0.879.g56a83971f3f In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In the preceding commit the discussion of the *_SHA1 knobs was left as-is to benefit from a smaller diff, but since we're changing these let's use the same phrasing we use for most other knobs. E.g. "define X", not "define X environment variable", and get rid of the "when running make to link with" entirely. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 12bb9edd70a..d317c6aba06 100644 --- a/Makefile +++ b/Makefile @@ -506,14 +506,14 @@ include shared.mak # To use them you must define NO_DC_SHA1 and one of the *_SHA1 # variables below: # -# Define BLK_SHA1 environment variable to make use of the bundled -# optimized C SHA1 routine. +# Define BLK_SHA1 to make use of optimized C SHA-1 routines bundled +# with git (in the block-sha1/ directory). # -# Define OPENSSL_SHA1 environment variable when running make to link -# with the SHA1 routine from openssl library. +# Define OPENSSL_SHA1 to link to the the SHA-1 routines from +# the OpenSSL library. # -# Define PPC_SHA1 environment variable when running make to make use of -# a bundled SHA1 routine optimized for PowerPC. +# Define PPC_SHA1 to make use of optimized (in assembly) +# PowerPC SHA-1 routines. # # Define APPLE_SHA1 to use Apple's CommonCrypto SHA-1 routines on # Darwin/Mac OS X. From patchwork Fri Apr 22 09:53:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12823166 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0078C433EF for ; Fri, 22 Apr 2022 09:53:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446287AbiDVJ4l (ORCPT ); Fri, 22 Apr 2022 05:56:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446274AbiDVJ40 (ORCPT ); Fri, 22 Apr 2022 05:56:26 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52C8E53E22 for ; Fri, 22 Apr 2022 02:53:28 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id v12so3470767wrv.10 for ; Fri, 22 Apr 2022 02:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8dYtrybFApAj6+mIS2i3WVeuEoYjDVDLJotcnaGAfaU=; b=jAe0DTZkmedgPCTAKqGemIKCmM9MUqz17MUK2hWZSKZ6psrmQftOCv7ALNgDeDnsXM f4Op+KE8EjT3PVQMdo6o5W8kYpKvcOoqVk0eyfDPlYl/yG8jd2l0DUwAmBRQQ+F7KnFr 6YvEImpMJLvIBGDfv+iMNWj2ueOM7t0U/MK7eJWl+o85sOFYyzmQ7+num+d7m6hg6/gh NoWKpSsPS4cQmroYdy/vGhdGuJwgFmebN60AAkVneobxd+bdMwA8Hl/3jMVNAnVKf1Np hExDxSSS2rKDpognveCxVMCK6oN8g23JgtL/vDqg/BNyAIoYOhxSIbzXdDH+FRWMQWr9 PZPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8dYtrybFApAj6+mIS2i3WVeuEoYjDVDLJotcnaGAfaU=; b=D/2PKHC4SUFB6D3qF6WjUZ4bTq+yrzrEGfKuuHUPaxEqNczKO6HL/i9CVmzySobbeS kkBss2j1J/8ZAPOgGtOS0brvrOCLj+VHK+XFYfpHUzkG3I7gzOp3ri/IOnpydXYWjAQK /867fInNw+wvTfK+dCjqSRylEg2BxUzvgl+YmV6pvquGRtaWN1JPGQjKXOr9KFxCoZxv ttmseeSw9z6W1L47PUqIfZGwmh5HjKesJxgcWIVep20zfR1ozCrKdH5KiNwZEGFPXtlP 1A0aqXYRmGmMXemVsMXb+4dUXQL5w0Oao+x0aqcB3G5iN0ZpDIwC8M/k51cu/KRPF/H6 KYDA== X-Gm-Message-State: AOAM532CkRaI/Fk9RMIAKMeKkSMxSo3SGJAY968NJWW/C4ZB+lKEnNiM znxKO0DnfoU7wfOHjWyb/htZaObQab7Fyw== X-Google-Smtp-Source: ABdhPJyyP8sxmPr+oFExUiSZSRIHlPaoANRpA1j5VpJTrESl7Wz3fnCWxlpjsYjV0NbxeIkQiKfMmQ== X-Received: by 2002:adf:efc6:0:b0:207:b89b:232b with SMTP id i6-20020adfefc6000000b00207b89b232bmr2898207wrp.403.1650621206170; Fri, 22 Apr 2022 02:53:26 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id i6-20020adfa506000000b0020ac34ec647sm1365561wrb.110.2022.04.22.02.53.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 02:53:25 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , "brian m . carlson" , Carlo Arenas , Mike Hommey , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 4/5] Makefile + hash.h: remove PPC_SHA1 implementation Date: Fri, 22 Apr 2022 11:53:15 +0200 Message-Id: X-Mailer: git-send-email 2.36.0.879.g56a83971f3f In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Remove the PPC_SHA1 implementation added in a6ef3518f9a ([PATCH] PPC assembly implementation of SHA1, 2005-04-22). When this was added Apple consumer hardware used the PPC architecture, and the implementation was intended to improve SHA-1 speed there. Since it was added we've moved to using sha1collisiondetection by default, and anyone wanting hard-rolled non-DC SHA-1 implementation can use OpenSSL's via the OPENSSL_SHA1 knob. Furthermore this doesn't run on the modern PPC processors which anyone who's concerned about performance on PPC is likely to be using these days, i.e. the IBM POWER series. It originally originally targeted 32 bit PPC, but there's some mailing list references to this being tried on G5 (PPC 970). I can't get it to do anything but segfault on both the BE and LE POWER machines in the GCC compile farm. There have been proposals to entirely remove non-sha1collisiondetection implementations from the tree[1]. I think per [2] that would be a bit overzealous. I.e. there are various set-ups git's speed is going to be more important than the relatively implausible SHA-1 collision attack, or where such attacks are entirely mitigated by other means (e.g. by incoming objects being checked with DC_SHA1). But that really doesn't apply to PPC_SHA1 in particular, which seems to have outlived its usefulness. As this gets rid of the only in-tree *.S assembly file we can remove the small bits of logic from the Makefile needed to build objects from *.S (as opposed to *.c) The code being removed here was also throwing warnings with the "-pedantic" flag, it could have been fixed as 544d93bc3b4 (block-sha1: remove use of obsolete x86 assembly, 2022-03-10) did for block-sha1/*, but as noted above let's remove it instead. 1. https://lore.kernel.org/git/20200223223758.120941-1-mh@glandium.org/ 2. https://lore.kernel.org/git/20200224044732.GK1018190@coredump.intra.peff.net/ Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 19 ++--- configure.ac | 3 - hash.h | 4 +- ppc/sha1.c | 72 ---------------- ppc/sha1.h | 25 ------ ppc/sha1ppc.S | 224 -------------------------------------------------- 6 files changed, 6 insertions(+), 341 deletions(-) delete mode 100644 ppc/sha1.c delete mode 100644 ppc/sha1.h delete mode 100644 ppc/sha1ppc.S diff --git a/Makefile b/Makefile index d317c6aba06..6f8272ae4a4 100644 --- a/Makefile +++ b/Makefile @@ -512,9 +512,6 @@ include shared.mak # Define OPENSSL_SHA1 to link to the the SHA-1 routines from # the OpenSSL library. # -# Define PPC_SHA1 to make use of optimized (in assembly) -# PowerPC SHA-1 routines. -# # Define APPLE_SHA1 to use Apple's CommonCrypto SHA-1 routines on # Darwin/Mac OS X. # @@ -1830,8 +1827,11 @@ endif ifdef DC_SHA1 $(error the DC_SHA1 flag is no longer used, and has become the default. Adjust your build scripts accordingly) endif +ifdef PPC_SHA1 +$(error the PPC_SHA1 flag has been removed along with the PowerPC-specific SHA-1 implementation.) +endif ifndef NO_DC_SHA1 - ifneq ($(OPENSSL_SHA1)$(BLK_SHA1)$(PPC_SHA1)$(APPLE_SHA1),) + ifneq ($(OPENSSL_SHA1)$(BLK_SHA1)$(APPLE_SHA1),) $(error no other *_SHA1 option can be defined unless NO_DC_SHA1 is defined) endif LIB_OBJS += sha1dc_git.o @@ -1869,10 +1869,6 @@ ifdef BLK_SHA1 LIB_OBJS += block-sha1/sha1.o BASIC_CFLAGS += -DSHA1_BLK else -ifdef PPC_SHA1 - LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o - BASIC_CFLAGS += -DSHA1_PPC -else ifdef APPLE_SHA1 COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL BASIC_CFLAGS += -DSHA1_APPLE @@ -1882,7 +1878,6 @@ endif endif endif endif -endif ifdef OPENSSL_SHA256 EXTLIBS += $(LIB_4_CRYPTO) @@ -2621,14 +2616,10 @@ missing_compdb_dir = compdb_args = endif -ASM_SRC := $(wildcard $(OBJECTS:o=S)) -ASM_OBJ := $(ASM_SRC:S=o) -C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS)) +C_OBJ = $(OBJECTS) $(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir) $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $< -$(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir) - $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $< %.s: %.c GIT-CFLAGS FORCE $(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $< diff --git a/configure.ac b/configure.ac index 316a31d2313..bbfbcc63af0 100644 --- a/configure.ac +++ b/configure.ac @@ -237,9 +237,6 @@ AC_MSG_NOTICE([CHECKS for site configuration]) # tests. These tests take up a significant amount of the total test time # but are not needed unless you plan to talk to SVN repos. # -# Define PPC_SHA1 environment variable when running make to make use of -# a bundled SHA1 routine optimized for PowerPC. -# # Define NO_OPENSSL environment variable if you do not have OpenSSL. # # Define OPENSSLDIR=/foo/bar if your openssl header and library files are in diff --git a/hash.h b/hash.h index 20012167ce4..248615df11d 100644 --- a/hash.h +++ b/hash.h @@ -6,8 +6,6 @@ #if !defined(NO_SHA1_DC) #include "sha1dc_git.h" -#elif defined(SHA1_PPC) -#include "ppc/sha1.h" #elif defined(SHA1_APPLE) #include #elif defined(SHA1_OPENSSL) @@ -32,7 +30,7 @@ * platform's underlying implementation of SHA-1; could be OpenSSL, * blk_SHA, Apple CommonCrypto, etc... Note that the relevant * SHA-1 header may have already defined platform_SHA_CTX for our - * own implementations like block-sha1 and ppc-sha1, so we list + * own implementations like block-sha1, so we list * the default for OpenSSL compatible SHA-1 implementations here. */ #define platform_SHA_CTX SHA_CTX diff --git a/ppc/sha1.c b/ppc/sha1.c deleted file mode 100644 index 1b705cee1fe..00000000000 --- a/ppc/sha1.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * SHA-1 implementation. - * - * Copyright (C) 2005 Paul Mackerras - * - * This version assumes we are running on a big-endian machine. - * It calls an external sha1_core() to process blocks of 64 bytes. - */ -#include -#include -#include "sha1.h" - -void ppc_sha1_core(uint32_t *hash, const unsigned char *p, - unsigned int nblocks); - -int ppc_SHA1_Init(ppc_SHA_CTX *c) -{ - c->hash[0] = 0x67452301; - c->hash[1] = 0xEFCDAB89; - c->hash[2] = 0x98BADCFE; - c->hash[3] = 0x10325476; - c->hash[4] = 0xC3D2E1F0; - c->len = 0; - c->cnt = 0; - return 0; -} - -int ppc_SHA1_Update(ppc_SHA_CTX *c, const void *ptr, unsigned long n) -{ - unsigned long nb; - const unsigned char *p = ptr; - - c->len += (uint64_t) n << 3; - while (n != 0) { - if (c->cnt || n < 64) { - nb = 64 - c->cnt; - if (nb > n) - nb = n; - memcpy(&c->buf.b[c->cnt], p, nb); - if ((c->cnt += nb) == 64) { - ppc_sha1_core(c->hash, c->buf.b, 1); - c->cnt = 0; - } - } else { - nb = n >> 6; - ppc_sha1_core(c->hash, p, nb); - nb <<= 6; - } - n -= nb; - p += nb; - } - return 0; -} - -int ppc_SHA1_Final(unsigned char *hash, ppc_SHA_CTX *c) -{ - unsigned int cnt = c->cnt; - - c->buf.b[cnt++] = 0x80; - if (cnt > 56) { - if (cnt < 64) - memset(&c->buf.b[cnt], 0, 64 - cnt); - ppc_sha1_core(c->hash, c->buf.b, 1); - cnt = 0; - } - if (cnt < 56) - memset(&c->buf.b[cnt], 0, 56 - cnt); - c->buf.l[7] = c->len; - ppc_sha1_core(c->hash, c->buf.b, 1); - memcpy(hash, c->hash, 20); - return 0; -} diff --git a/ppc/sha1.h b/ppc/sha1.h deleted file mode 100644 index 9b24b326159..00000000000 --- a/ppc/sha1.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * SHA-1 implementation. - * - * Copyright (C) 2005 Paul Mackerras - */ -#include - -typedef struct { - uint32_t hash[5]; - uint32_t cnt; - uint64_t len; - union { - unsigned char b[64]; - uint64_t l[8]; - } buf; -} ppc_SHA_CTX; - -int ppc_SHA1_Init(ppc_SHA_CTX *c); -int ppc_SHA1_Update(ppc_SHA_CTX *c, const void *p, unsigned long n); -int ppc_SHA1_Final(unsigned char *hash, ppc_SHA_CTX *c); - -#define platform_SHA_CTX ppc_SHA_CTX -#define platform_SHA1_Init ppc_SHA1_Init -#define platform_SHA1_Update ppc_SHA1_Update -#define platform_SHA1_Final ppc_SHA1_Final diff --git a/ppc/sha1ppc.S b/ppc/sha1ppc.S deleted file mode 100644 index 1711eef6e71..00000000000 --- a/ppc/sha1ppc.S +++ /dev/null @@ -1,224 +0,0 @@ -/* - * SHA-1 implementation for PowerPC. - * - * Copyright (C) 2005 Paul Mackerras - */ - -/* - * PowerPC calling convention: - * %r0 - volatile temp - * %r1 - stack pointer. - * %r2 - reserved - * %r3-%r12 - Incoming arguments & return values; volatile. - * %r13-%r31 - Callee-save registers - * %lr - Return address, volatile - * %ctr - volatile - * - * Register usage in this routine: - * %r0 - temp - * %r3 - argument (pointer to 5 words of SHA state) - * %r4 - argument (pointer to data to hash) - * %r5 - Constant K in SHA round (initially number of blocks to hash) - * %r6-%r10 - Working copies of SHA variables A..E (actually E..A order) - * %r11-%r26 - Data being hashed W[]. - * %r27-%r31 - Previous copies of A..E, for final add back. - * %ctr - loop count - */ - - -/* - * We roll the registers for A, B, C, D, E around on each - * iteration; E on iteration t is D on iteration t+1, and so on. - * We use registers 6 - 10 for this. (Registers 27 - 31 hold - * the previous values.) - */ -#define RA(t) (((t)+4)%5+6) -#define RB(t) (((t)+3)%5+6) -#define RC(t) (((t)+2)%5+6) -#define RD(t) (((t)+1)%5+6) -#define RE(t) (((t)+0)%5+6) - -/* We use registers 11 - 26 for the W values */ -#define W(t) ((t)%16+11) - -/* Register 5 is used for the constant k */ - -/* - * The basic SHA-1 round function is: - * E += ROTL(A,5) + F(B,C,D) + W[i] + K; B = ROTL(B,30) - * Then the variables are renamed: (A,B,C,D,E) = (E,A,B,C,D). - * - * Every 20 rounds, the function F() and the constant K changes: - * - 20 rounds of f0(b,c,d) = "bit wise b ? c : d" = (^b & d) + (b & c) - * - 20 rounds of f1(b,c,d) = b^c^d = (b^d)^c - * - 20 rounds of f2(b,c,d) = majority(b,c,d) = (b&d) + ((b^d)&c) - * - 20 more rounds of f1(b,c,d) - * - * These are all scheduled for near-optimal performance on a G4. - * The G4 is a 3-issue out-of-order machine with 3 ALUs, but it can only - * *consider* starting the oldest 3 instructions per cycle. So to get - * maximum performance out of it, you have to treat it as an in-order - * machine. Which means interleaving the computation round t with the - * computation of W[t+4]. - * - * The first 16 rounds use W values loaded directly from memory, while the - * remaining 64 use values computed from those first 16. We preload - * 4 values before starting, so there are three kinds of rounds: - * - The first 12 (all f0) also load the W values from memory. - * - The next 64 compute W(i+4) in parallel. 8*f0, 20*f1, 20*f2, 16*f1. - * - The last 4 (all f1) do not do anything with W. - * - * Therefore, we have 6 different round functions: - * STEPD0_LOAD(t,s) - Perform round t and load W(s). s < 16 - * STEPD0_UPDATE(t,s) - Perform round t and compute W(s). s >= 16. - * STEPD1_UPDATE(t,s) - * STEPD2_UPDATE(t,s) - * STEPD1(t) - Perform round t with no load or update. - * - * The G5 is more fully out-of-order, and can find the parallelism - * by itself. The big limit is that it has a 2-cycle ALU latency, so - * even though it's 2-way, the code has to be scheduled as if it's - * 4-way, which can be a limit. To help it, we try to schedule the - * read of RA(t) as late as possible so it doesn't stall waiting for - * the previous round's RE(t-1), and we try to rotate RB(t) as early - * as possible while reading RC(t) (= RB(t-1)) as late as possible. - */ - -/* the initial loads. */ -#define LOADW(s) \ - lwz W(s),(s)*4(%r4) - -/* - * Perform a step with F0, and load W(s). Uses W(s) as a temporary - * before loading it. - * This is actually 10 instructions, which is an awkward fit. - * It can execute grouped as listed, or delayed one instruction. - * (If delayed two instructions, there is a stall before the start of the - * second line.) Thus, two iterations take 7 cycles, 3.5 cycles per round. - */ -#define STEPD0_LOAD(t,s) \ -add RE(t),RE(t),W(t); andc %r0,RD(t),RB(t); and W(s),RC(t),RB(t); \ -add RE(t),RE(t),%r0; rotlwi %r0,RA(t),5; rotlwi RB(t),RB(t),30; \ -add RE(t),RE(t),W(s); add %r0,%r0,%r5; lwz W(s),(s)*4(%r4); \ -add RE(t),RE(t),%r0 - -/* - * This is likewise awkward, 13 instructions. However, it can also - * execute starting with 2 out of 3 possible moduli, so it does 2 rounds - * in 9 cycles, 4.5 cycles/round. - */ -#define STEPD0_UPDATE(t,s,loadk...) \ -add RE(t),RE(t),W(t); andc %r0,RD(t),RB(t); xor W(s),W((s)-16),W((s)-3); \ -add RE(t),RE(t),%r0; and %r0,RC(t),RB(t); xor W(s),W(s),W((s)-8); \ -add RE(t),RE(t),%r0; rotlwi %r0,RA(t),5; xor W(s),W(s),W((s)-14); \ -add RE(t),RE(t),%r5; loadk; rotlwi RB(t),RB(t),30; rotlwi W(s),W(s),1; \ -add RE(t),RE(t),%r0 - -/* Nicely optimal. Conveniently, also the most common. */ -#define STEPD1_UPDATE(t,s,loadk...) \ -add RE(t),RE(t),W(t); xor %r0,RD(t),RB(t); xor W(s),W((s)-16),W((s)-3); \ -add RE(t),RE(t),%r5; loadk; xor %r0,%r0,RC(t); xor W(s),W(s),W((s)-8); \ -add RE(t),RE(t),%r0; rotlwi %r0,RA(t),5; xor W(s),W(s),W((s)-14); \ -add RE(t),RE(t),%r0; rotlwi RB(t),RB(t),30; rotlwi W(s),W(s),1 - -/* - * The naked version, no UPDATE, for the last 4 rounds. 3 cycles per. - * We could use W(s) as a temp register, but we don't need it. - */ -#define STEPD1(t) \ - add RE(t),RE(t),W(t); xor %r0,RD(t),RB(t); \ -rotlwi RB(t),RB(t),30; add RE(t),RE(t),%r5; xor %r0,%r0,RC(t); \ -add RE(t),RE(t),%r0; rotlwi %r0,RA(t),5; /* spare slot */ \ -add RE(t),RE(t),%r0 - -/* - * 14 instructions, 5 cycles per. The majority function is a bit - * awkward to compute. This can execute with a 1-instruction delay, - * but it causes a 2-instruction delay, which triggers a stall. - */ -#define STEPD2_UPDATE(t,s,loadk...) \ -add RE(t),RE(t),W(t); and %r0,RD(t),RB(t); xor W(s),W((s)-16),W((s)-3); \ -add RE(t),RE(t),%r0; xor %r0,RD(t),RB(t); xor W(s),W(s),W((s)-8); \ -add RE(t),RE(t),%r5; loadk; and %r0,%r0,RC(t); xor W(s),W(s),W((s)-14); \ -add RE(t),RE(t),%r0; rotlwi %r0,RA(t),5; rotlwi W(s),W(s),1; \ -add RE(t),RE(t),%r0; rotlwi RB(t),RB(t),30 - -#define STEP0_LOAD4(t,s) \ - STEPD0_LOAD(t,s); \ - STEPD0_LOAD((t+1),(s)+1); \ - STEPD0_LOAD((t)+2,(s)+2); \ - STEPD0_LOAD((t)+3,(s)+3) - -#define STEPUP4(fn, t, s, loadk...) \ - STEP##fn##_UPDATE(t,s,); \ - STEP##fn##_UPDATE((t)+1,(s)+1,); \ - STEP##fn##_UPDATE((t)+2,(s)+2,); \ - STEP##fn##_UPDATE((t)+3,(s)+3,loadk) - -#define STEPUP20(fn, t, s, loadk...) \ - STEPUP4(fn, t, s,); \ - STEPUP4(fn, (t)+4, (s)+4,); \ - STEPUP4(fn, (t)+8, (s)+8,); \ - STEPUP4(fn, (t)+12, (s)+12,); \ - STEPUP4(fn, (t)+16, (s)+16, loadk) - - .globl ppc_sha1_core -ppc_sha1_core: - stwu %r1,-80(%r1) - stmw %r13,4(%r1) - - /* Load up A - E */ - lmw %r27,0(%r3) - - mtctr %r5 - -1: - LOADW(0) - lis %r5,0x5a82 - mr RE(0),%r31 - LOADW(1) - mr RD(0),%r30 - mr RC(0),%r29 - LOADW(2) - ori %r5,%r5,0x7999 /* K0-19 */ - mr RB(0),%r28 - LOADW(3) - mr RA(0),%r27 - - STEP0_LOAD4(0, 4) - STEP0_LOAD4(4, 8) - STEP0_LOAD4(8, 12) - STEPUP4(D0, 12, 16,) - STEPUP4(D0, 16, 20, lis %r5,0x6ed9) - - ori %r5,%r5,0xeba1 /* K20-39 */ - STEPUP20(D1, 20, 24, lis %r5,0x8f1b) - - ori %r5,%r5,0xbcdc /* K40-59 */ - STEPUP20(D2, 40, 44, lis %r5,0xca62) - - ori %r5,%r5,0xc1d6 /* K60-79 */ - STEPUP4(D1, 60, 64,) - STEPUP4(D1, 64, 68,) - STEPUP4(D1, 68, 72,) - STEPUP4(D1, 72, 76,) - addi %r4,%r4,64 - STEPD1(76) - STEPD1(77) - STEPD1(78) - STEPD1(79) - - /* Add results to original values */ - add %r31,%r31,RE(0) - add %r30,%r30,RD(0) - add %r29,%r29,RC(0) - add %r28,%r28,RB(0) - add %r27,%r27,RA(0) - - bdnz 1b - - /* Save final hash, restore registers, and return */ - stmw %r27,0(%r3) - lmw %r13,4(%r1) - addi %r1,%r1,80 - blr From patchwork Fri Apr 22 09:53:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12823164 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF012C433FE for ; Fri, 22 Apr 2022 09:53:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446273AbiDVJ4j (ORCPT ); Fri, 22 Apr 2022 05:56:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446277AbiDVJ40 (ORCPT ); Fri, 22 Apr 2022 05:56:26 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86C6F53E24 for ; Fri, 22 Apr 2022 02:53:28 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id e2so3999543wrh.7 for ; Fri, 22 Apr 2022 02:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=274u9YaugV/Hqu0TaIZDvO+dOsahuSqOk80Eg04ak3s=; b=nWdEslWW2tGthCKEVCYp9vov7Ji7vzs2Oq0isx/4CEv9eAIDPs2n2B5Ao8T5YQWRK+ frrZ9vZb6qUFqc+dagUVJqXwp8C+rhDqZPPFRWCAtnsaue5c8iLH3XLGLVwV8sBvhYB8 pTj/f+y64ZjFLqWWhyEX3W6JtFBwWjn39uNgrqSGBA6RdUs9FdVGugOtzfl1h0gWYvh3 KbEJe3+NFSHzBf1n4rZeVwBM/ts5x2XZ2k2dFQBK8hnPNWyqvDKYj173scdEq9PFYaYf f3ya3FTikhvOtSADWTDwV2RH4fVLV7PVkdfjmHtcCXefkFoOyMg6tOBcrpPaXVR8FDVW YYOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=274u9YaugV/Hqu0TaIZDvO+dOsahuSqOk80Eg04ak3s=; b=laap1fuiLB42LDl+lQ1kB09KsJ0qhgw32K84O1DcuCpXEqG4X0pVHNVVbUH0TIPuL7 zvccnSEoBe//KCgFA5EL3LrKnpyP90XZPyJUwNi8Mnw3TmWBvXo6w3XuLfCvZ4orDWDM 3Eyaj+fdv0DycKuetM+RXBdBuL7fEeXS79Y4ZRT4DPG8Z55d5cqFmmqLmVJhWxCkd3Hg U42qjhgI9fSyAkAEwei4nmDiwrIXXyPfN3HVg1ZdWJZnzbpaxjezmBQlnr/l/bA0THBb A3ovGJZXPeVWrjt8yF0ACpAB76KkOYccBIW2sbyOii/FsuO1sA1EouoTLXUJHIPDL/Z2 BoZA== X-Gm-Message-State: AOAM530e1WmvElRuIoI99qpUeMjKhKJD+sA0LcV9kBukx1NWNJUY2ihD JaMVqgjnV8nmDFmp5VnY2R10KBVlAT9IZg== X-Google-Smtp-Source: ABdhPJyXWtpMTMyOm9mIivnlHkRYgLCmkhs4PpCiwVl7YlK2nT8bBSIJ4VimBLA6TF7l5UGpG9RLtg== X-Received: by 2002:adf:fa86:0:b0:207:aadd:bff5 with SMTP id h6-20020adffa86000000b00207aaddbff5mr2934143wrr.469.1650621206897; Fri, 22 Apr 2022 02:53:26 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id i6-20020adfa506000000b0020ac34ec647sm1365561wrb.110.2022.04.22.02.53.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 02:53:26 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , "brian m . carlson" , Carlo Arenas , Mike Hommey , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 5/5] Makefile: use $(OBJECTS) instead of $(C_OBJ) Date: Fri, 22 Apr 2022 11:53:16 +0200 Message-Id: X-Mailer: git-send-email 2.36.0.879.g56a83971f3f In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In the preceding commit $(C_OBJ) added in c373991375a (Makefile: list generated object files in OBJECTS, 2010-01-26) became synonymous with $(OBJECTS). Let's avoid the indirection and use the $(OBJECTS) variable directly instead. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6f8272ae4a4..ff6bab134d2 100644 --- a/Makefile +++ b/Makefile @@ -2616,9 +2616,7 @@ missing_compdb_dir = compdb_args = endif -C_OBJ = $(OBJECTS) - -$(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir) +$(OBJECTS): %.o: %.c GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir) $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $< %.s: %.c GIT-CFLAGS FORCE @@ -2764,7 +2762,7 @@ XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \ --keyword=gettextln --keyword=eval_gettextln XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \ --keyword=__ --keyword=N__ --keyword="__n:1,2" -LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H) +LOCALIZED_C = $(OBJECTS:o=c) $(LIB_H) $(GENERATED_H) LOCALIZED_SH = $(SCRIPT_SH) LOCALIZED_SH += git-sh-setup.sh LOCALIZED_PERL = $(SCRIPT_PERL) @@ -3014,7 +3012,7 @@ t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS) $(REFTABLE_TEST_LIB) check-sha1:: t/helper/test-tool$X t/helper/test-sha1.sh -SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ)) +SP_OBJ = $(patsubst %.o,%.sp,$(OBJECTS)) $(SP_OBJ): %.sp: %.c %.o $(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \