From owner-svn-ports-all@freebsd.org Fri Jun 9 16:38:40 2017 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94F1EBF8AE1; Fri, 9 Jun 2017 16:38:40 +0000 (UTC) (envelope-from adamw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6374C7392D; Fri, 9 Jun 2017 16:38:40 +0000 (UTC) (envelope-from adamw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v59Gcd1P070560; Fri, 9 Jun 2017 16:38:39 GMT (envelope-from adamw@FreeBSD.org) Received: (from adamw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v59GcdvF070558; Fri, 9 Jun 2017 16:38:39 GMT (envelope-from adamw@FreeBSD.org) Message-Id: <201706091638.v59GcdvF070558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adamw set sender to adamw@FreeBSD.org using -f From: Adam Weinberger Date: Fri, 9 Jun 2017 16:38:39 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r443018 - in head/devel/git: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jun 2017 16:38:40 -0000 Author: adamw Date: Fri Jun 9 16:38:39 2017 New Revision: 443018 URL: https://svnweb.freebsd.org/changeset/ports/443018 Log: Fix SHA1 checksum generation on little-endian machines. git 2.13.0 broke SHA1 checksumming on big-endian machines. They fixed it in 2.13.1 by breaking it on little-endian machines. This patch, obtained from upstream, fixes SHA1 checksumming on little-endian machines again; I don't have any BE machines but hopefully it still works on those too. Submitted by: Dan McGregor Obtained from: https://github.com/git/git/commit/76339527ccf7946751174663f9faa686f3f55335 Approved by: just-fix-it Added: head/devel/git/files/patch-SHA1-endianness (contents, props changed) Modified: head/devel/git/Makefile Modified: head/devel/git/Makefile ============================================================================== --- head/devel/git/Makefile Fri Jun 9 15:58:13 2017 (r443017) +++ head/devel/git/Makefile Fri Jun 9 16:38:39 2017 (r443018) @@ -3,6 +3,7 @@ PORTNAME= git DISTVERSION= 2.13.1 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= KERNEL_ORG/software/scm/git DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \ Added: head/devel/git/files/patch-SHA1-endianness ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/git/files/patch-SHA1-endianness Fri Jun 9 16:38:39 2017 (r443018) @@ -0,0 +1,115 @@ +From 5d184f468e59cd9c5b51b5c139540015c8e41b18 Mon Sep 17 00:00:00 2001 +From: Jeff King +Date: Tue, 6 Jun 2017 15:01:11 -0400 +Subject: [PATCH 1/2] sha1dc: ignore indent-with-non-tab whitespace violations + +The upstream sha1dc code indents some lines with spaces. +While this doesn't match Git's coding guidelines, it's better +to leave this imported code untouched than to try to make it +match our style. However, we can use .gitattributes to tell +"diff --check" and "git am" not to bother us about it. + +Signed-off-by: Jeff King +Signed-off-by: Junio C Hamano +--- + sha1dc/.gitattributes | 1 + + 1 file changed, 1 insertion(+) + create mode 100644 sha1dc/.gitattributes + +From 6b851e536b05e0c8c61f77b9e4c3e7cedea39ff8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= + +Date: Tue, 6 Jun 2017 15:12:29 +0000 +Subject: [PATCH 2/2] sha1dc: update from upstream +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Update sha1dc from the latest version by the upstream +maintainer[1]. + +See commit a0103914c2 ("sha1dc: update from upstream", 2017-05-20) for +the latest update. That update was done sans some whitespace changes +by upstream, which is why the diff here isn't the same as the upstream +cc46554..e139984. + +It also brings in a change[2] upstream made which should hopefully +address the breakage in 2.13.1 on Cygwin, see [3]. Cygwin defines both +_BIG_ENDIAN and _LITTLE_ENDIAN. + +Adam Dinwoodie reports on the mailing list that that upstream commit +fixes the issue on Cygwin[4]. + +1. https://github.com/cr-marcstevens/sha1collisiondetection/commit/e1399840b501a68ac6c8d7ed9a5cb1455480200e +2. https://github.com/cr-marcstevens/sha1collisiondetection/commit/a24eef58c0684078405f8c7a89f9b78271432005 +3. <20170606100355.GC25777@dinwoodie.org> (https://public-inbox.org/git/20170606100355.GC25777@dinwoodie.org/) +4. <20170606124323.GD25777@dinwoodie.org> (https://public-inbox.org/git/20170606124323.GD25777@dinwoodie.org/) + +Signed-off-by: Ævar Arnfjörð Bjarmason +Signed-off-by: Junio C Hamano +--- + sha1dc/sha1.c | 30 ++++++++++++++++++++++++------ + sha1dc/sha1.h | 6 +++--- + 2 files changed, 27 insertions(+), 9 deletions(-) + +diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c +index 3dff80ac727aa..facea1bb560b5 100644 +--- sha1dc/sha1.c ++++ sha1dc/sha1.c +@@ -35,15 +35,33 @@ + #ifdef SHA1DC_BIGENDIAN + #undef SHA1DC_BIGENDIAN + #endif +-#if (!defined SHA1DC_FORCE_LITTLEENDIAN) && \ +- ((defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || \ +- (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__)) || \ +- defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \ +- defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) || defined(SHA1DC_FORCE_BIGENDIAN)) + ++#if (defined(_BYTE_ORDER) || defined(__BYTE_ORDER) || defined(__BYTE_ORDER__)) ++ ++#if ((defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)) || \ ++ (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || \ ++ (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__)) ) + #define SHA1DC_BIGENDIAN ++#endif ++ ++#else ++ ++#if (defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN) || defined(__BIG_ENDIAN__) || \ ++ defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \ ++ defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || \ ++ defined(__sparc)) ++#define SHA1DC_BIGENDIAN ++#endif + +-#endif /*ENDIANNESS SELECTION*/ ++#endif ++ ++#if (defined(SHA1DC_FORCE_LITTLEENDIAN) && defined(SHA1DC_BIGENDIAN)) ++#undef SHA1DC_BIGENDIAN ++#endif ++#if (defined(SHA1DC_FORCE_BIGENDIAN) && !defined(SHA1DC_BIGENDIAN)) ++#define SHA1DC_BIGENDIAN ++#endif ++/*ENDIANNESS SELECTION*/ + + #if (defined SHA1DC_FORCE_UNALIGNED_ACCESS || \ + defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || \ +diff --git a/sha1dc/sha1.h b/sha1dc/sha1.h +index a0ff5d1305797..1e4e94be54a6d 100644 +--- sha1dc/sha1.h ++++ sha1dc/sha1.h +@@ -61,9 +61,9 @@ void SHA1DCInit(SHA1_CTX*); + Function to enable safe SHA-1 hashing: + Collision attacks are thwarted by hashing a detected near-collision block 3 times. + Think of it as extending SHA-1 from 80-steps to 240-steps for such blocks: +- The best collision attacks against SHA-1 have complexity about 2^60, +- thus for 240-steps an immediate lower-bound for the best cryptanalytic attacks would be 2^180. +- An attacker would be better off using a generic birthday search of complexity 2^80. ++ The best collision attacks against SHA-1 have complexity about 2^60, ++ thus for 240-steps an immediate lower-bound for the best cryptanalytic attacks would be 2^180. ++ An attacker would be better off using a generic birthday search of complexity 2^80. + + Enabling safe SHA-1 hashing will result in the correct SHA-1 hash for messages where no collision attack was detected, + but it will result in a different SHA-1 hash for messages where a collision attack was detected.