GNU logs - #79972, boring messages


Message sent to bug-coreutils@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#79972: `sha256sum` performance regression in OpenSSL v3.6
Resent-From: "Jack O'Connor" <oconnor663@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-coreutils@HIDDEN
Resent-Date: Tue, 09 Dec 2025 05:25:03 +0000
Resent-Message-ID: <handler.79972.B.176525789622488 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 79972
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: 
To: 79972 <at> debbugs.gnu.org
Cc: Samuel Neves <sneves@HIDDEN>
X-Debbugs-Original-To: bug-coreutils@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.176525789622488
          (code B ref -1); Tue, 09 Dec 2025 05:25:03 +0000
Received: (at submit) by debbugs.gnu.org; 9 Dec 2025 05:24:56 +0000
Received: from localhost ([127.0.0.1]:50916 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vSqDX-0005qW-V9
	for submit <at> debbugs.gnu.org; Tue, 09 Dec 2025 00:24:56 -0500
Received: from lists.gnu.org ([2001:470:142::17]:56598)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <oconnor663@HIDDEN>)
 id 1vSjMg-0005mD-3p
 for submit <at> debbugs.gnu.org; Mon, 08 Dec 2025 17:05:54 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <oconnor663@HIDDEN>)
 id 1vSjMa-0003gn-RK
 for bug-coreutils@HIDDEN; Mon, 08 Dec 2025 17:05:48 -0500
Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <oconnor663@HIDDEN>)
 id 1vSjMX-0006Zt-P4
 for bug-coreutils@HIDDEN; Mon, 08 Dec 2025 17:05:47 -0500
Received: by mail-qk1-x731.google.com with SMTP id
 af79cd13be357-8b2dcdde65bso775826685a.0
 for <bug-coreutils@HIDDEN>; Mon, 08 Dec 2025 14:05:45 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1765231544; x=1765836344; darn=gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=SvUgsgAUun5CBJuzcEKmLusk29Y4jY9EsL4wVAl5Ac8=;
 b=Gsf8S40fJDizKZqS2Dg+4rSmGq2Kg2eTwegVBObVgbJDaStUeZT3XVOB0UmnDm8oOV
 DW/zrd3dRNhs9pIdZG9KL+17CQ0F3vDO+dlX6sC2JWkPZIipozqgdm46fDANerE+Pewn
 lPEteuv2ocFDCIVy1q6vv9/DWAC0iW4QdI0FmzuYKNWSkPiHzDCXAKROfszpSW+q363i
 w6H043dseEcgQp5+Wzoq2g6H6YBICgiV8UDTcZ45XaE458qHns5B0z2zEjco4VqxQRGj
 LR6vgs8DStUP1Dk8PELYw+5QZVOPGUkIvMKnMkUuF9dIteLEUPnmBpFASGJNQrbJTE+N
 WQag==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1765231544; x=1765836344;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=SvUgsgAUun5CBJuzcEKmLusk29Y4jY9EsL4wVAl5Ac8=;
 b=Z2p8lf11bQZfSp3haSnURuTAOXCl2Z7KcukVfEzv2szV76AJRrK7sLGTTF3ftFKpIM
 rn9GmcEvQW166WWWjxblLPpFTyPFzMOFmMDOjMo2IC7lTQZvCP5CwYt897IX67Uwsup3
 jCh4dIJjHPwbQVvdDcy2Tj83ocQr9QoKZfNlxZl69UHzEau6O6xgUpr3wThVAfyuTsDf
 hfJdDIoDZEZ8AgoXVdLRuugyWsqVOcAIZRkP3DjxKVm905/EIPba3Wx67fepmUbuoCt6
 oDggfuQcMza5UOnuQgDLIM9vKV5HG04uVt3gHwWYd7brfHE4EndhmmGjcjPzI2fwZGB5
 IKZg==
X-Gm-Message-State: AOJu0YxlDzGL/9hqf4r7G2u+oiYQgvAxHSnAIRzbZFY+i9gYwd0UZ4p0
 eu40k9mUXIKZlgIyMk1J5S2KULYzLemujQ+FZMROHW4IFsUn2V+8yQXCpg+k1c9b+jhX7o2IFU1
 tGUzdD5ulNSoyA5X8zhBamU6jgbtP+nloWKepkUM=
X-Gm-Gg: ASbGncsw0ltEl2MFQWo+QtIJBz8+/otu6h8UdeDLqF74miigUBGx/zInQqclKBF49oa
 c9hQk/AE8lLYZJc28Ed6uKTuc9LJaQ2o1RLxGS7QI5BhFjRuXfKCqu8Dtus7SYLXpSD8PZIrTL/
 vS+798w2yZbytV9q/OQlEtV8EVfuh/gKWeUJn9qdSfGJYbJ6+zYIiHynFsK5o54f0VjkQg4/j0o
 n4NtARc/v0p31Jf6CkqQZQNh3lDCigEF12ItGR2EK8CBQiMeUrydijlFHoGjHRwLYOYSQ==
X-Google-Smtp-Source: AGHT+IEBM2kp1eLmXG318+ZJJ9F8PCF75Yka1f/wu3vPx7vwm79ELXsF+yd6cCuHm63UYrl2yKBfI+l/yyjfKJlnqgY=
X-Received: by 2002:a05:620a:4609:b0:8b1:2fab:30c9 with SMTP id
 af79cd13be357-8b6a23f8a71mr1273188585a.2.1765231543861; Mon, 08 Dec 2025
 14:05:43 -0800 (PST)
MIME-Version: 1.0
References: <CA+6di1mEt4kTQtO-5d3NeRLUJ3-N+cAwKK+Z6ontNnww6Mytfw@HIDDEN>
In-Reply-To: <CA+6di1mEt4kTQtO-5d3NeRLUJ3-N+cAwKK+Z6ontNnww6Mytfw@HIDDEN>
From: "Jack O'Connor" <oconnor663@HIDDEN>
Date: Mon, 8 Dec 2025 14:05:15 -0800
X-Gm-Features: AQt7F2o4VYq46g6dkM7ROIVdP1H7sn2gJWt_JJLGZ7as2BUBfSBhD-FyJq1uUuc
Message-ID: <CA+6di1k8AhmDxfxLCthW_auz1iMokx6w_1eTuzE+4xZWn4cqtw@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=2607:f8b0:4864:20::731;
 envelope-from=oconnor663@HIDDEN; helo=mail-qk1-x731.google.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Oops, I forgot to include a link to the OpenSSL GH issue,
   which describes the specific commit that made the change: https://github.com/openssl/openssl/issues/29340
    On Mon, Dec 8, 2025 at =?UTF-8?Q?2:02=E2=80=AFPM?= Jack O'Connor wrote: > > Upgrading OpenSSL
    from v3.5 to v3.6 causes a ~3x slowdown for > `sha256sum` (~2x for `sha1sum`)
    on machines that support SHA-NI. It > looks [...] 
 
 Content analysis details:   (1.2 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [2001:470:142:0:0:0:0:17 listed in]
                             [list.dnswl.org]
  1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
  0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
                             in digit (oconnor663[at]gmail.com)
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (oconnor663[at]gmail.com)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
X-Mailman-Approved-At: Tue, 09 Dec 2025 00:24:53 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

Oops, I forgot to include a link to the OpenSSL GH issue, which
describes the specific commit that made the change:
https://github.com/openssl/openssl/issues/29340

On Mon, Dec 8, 2025 at 2:02=E2=80=AFPM Jack O'Connor <oconnor663@HIDDEN>=
 wrote:
>
> Upgrading OpenSSL from v3.5 to v3.6 causes a ~3x slowdown for
> `sha256sum` (~2x for `sha1sum`) on machines that support SHA-NI. It
> looks like this was caused by a change in why/how
> `OPENSSL_cpuid_setup` gets called.
>
> I don't know who's "to blame" or what the proper fix will be, but as a
> hacky example here's a patch that fixes the performance regression in
> `sha256sum` by calling `OpenSSL_add_all_algorithms` early in `main`:
>
> diff --git a/src/cksum.c b/src/cksum.c
> index ac3e3f1..c7c20f0 100644
> --- a/src/cksum.c
> +++ b/src/cksum.c
> @@ -52,6 +52,9 @@
>  #if HASH_ALGO_SHA256 || HASH_ALGO_SHA224 || HASH_ALGO_CKSUM
>  # include "sha256.h"
>  #endif
> +#if HASH_ALGO_SHA256 && HAVE_OPENSSL_SHA256
> +# include <openssl/evp.h>
> +#endif
>  #if HASH_ALGO_SHA512 || HASH_ALGO_SHA384 || HASH_ALGO_CKSUM
>  # include "sha512.h"
>  #endif
> @@ -1505,6 +1508,10 @@ main (int argc, char **argv)
>       so that processes running in parallel do not intersperse their outp=
ut.  */
>    setvbuf (stdout, nullptr, _IOLBF, 0);
>
> +#if HASH_ALGO_SHA256 && HAVE_OPENSSL_SHA256
> +  OpenSSL_add_all_algorithms();
> +#endif
> +
>  #if HASH_ALGO_SUM
>    char const *short_opts =3D "rs";
>  #elif HASH_ALGO_CKSUM




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: "Jack O'Connor" <oconnor663@HIDDEN>
Subject: bug#79972: Acknowledgement (`sha256sum` performance regression in
 OpenSSL v3.6)
Message-ID: <handler.79972.B.176525789622488.ack <at> debbugs.gnu.org>
References: <CA+6di1k8AhmDxfxLCthW_auz1iMokx6w_1eTuzE+4xZWn4cqtw@HIDDEN>
X-Gnu-PR-Message: ack 79972
X-Gnu-PR-Package: coreutils
Reply-To: 79972 <at> debbugs.gnu.org
Date: Tue, 09 Dec 2025 05:25:03 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-coreutils@HIDDEN

If you wish to submit further information on this problem, please
send it to 79972 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
79972: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D79972
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-coreutils@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#79972: `sha256sum` performance regression in OpenSSL v3.6
Resent-From: Collin Funk <collin.funk1@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-coreutils@HIDDEN
Resent-Date: Tue, 09 Dec 2025 06:47:01 +0000
Resent-Message-ID: <handler.79972.B79972.176526276210667 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79972
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: 
To: "Jack O'Connor" <oconnor663@HIDDEN>
Cc: Samuel Neves <sneves@HIDDEN>, 79972 <at> debbugs.gnu.org
Received: via spool by 79972-submit <at> debbugs.gnu.org id=B79972.176526276210667
          (code B ref 79972); Tue, 09 Dec 2025 06:47:01 +0000
Received: (at 79972) by debbugs.gnu.org; 9 Dec 2025 06:46:02 +0000
Received: from localhost ([127.0.0.1]:51311 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vSrU1-0002lm-T1
	for submit <at> debbugs.gnu.org; Tue, 09 Dec 2025 01:46:02 -0500
Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:51583)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <collin.funk1@HIDDEN>)
 id 1vSrTz-0002lA-8D
 for 79972 <at> debbugs.gnu.org; Tue, 09 Dec 2025 01:46:00 -0500
Received: by mail-pg1-x531.google.com with SMTP id
 41be03b00d2f7-bc29d64b39dso3086766a12.3
 for <79972 <at> debbugs.gnu.org>; Mon, 08 Dec 2025 22:45:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1765262753; x=1765867553; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=2S5hgENkcuwKxGRe0S7yAl1EVotd69w9/2HVnd2lrJY=;
 b=CxZekGkDD7wINHip2dCCLp0NxKmFlriW7N1e6sD2Pin+VsJTjpaoih7zG6JFP83EIM
 sNqaSCb1VhGVA2r4tAy+VTTzDTAxnoB4YkAq8r3mpoM2BW7bPr+N2v4jptntN/cNAVB1
 FSVreADVHNuMV9+yi0KSmQ2qrooVSQDKSDilcinEezp6IrlPUk1FZ9s3ArsGFFalihDT
 91ZnM3GBrWeuhSTsPRcZalHu2u4ue4kx8ylwJct2t6NYtZ1I8MFR9uDGkdvpD19JVXJy
 Dxesfj/TiU6MjbLvimInZdI+LLKu54yhAHVXqXdtVPkFR6bEIV2sj5Ij56wvUDGvn2dR
 V51w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1765262753; x=1765867553;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=2S5hgENkcuwKxGRe0S7yAl1EVotd69w9/2HVnd2lrJY=;
 b=YBCBBhGTaNrvWxdOQA0iV2MMdpu5IIfwFSiWkl+QoxA/5ahlel8VIoi0uSDnS+gb5g
 w0/gpsdcyu1LuImyLAm++v/VsPZeWzhz4khxhVItvD/K1175x45G1u3X4WVl+MFwJUlD
 WoZhmZqX5tKHAMDGtl+kSQl98D5AwFht6uz9/OtcsXPSLqyMiQdDcsCYrRHoBXmJvgh0
 /jeekf4QUBr9j29wJy2GprT65ruVTMjcyEvSTyuahkpIIzpMxH6B9se6QfMEvjFjYhWT
 u8o03NkTIKoD7zyOUwFL72Z6Vuiwi7bNCBp+0NOKqIK9tgp3DyWOaJ7F6gkzYyZ+ugs8
 JVyQ==
X-Gm-Message-State: AOJu0Yz6097sYrt/mmdzMYmAp0HF0NKLP4Q1ujSfI0MpVNnLmGJw4iFd
 oUdN1/Koky+u5aQqBk59tuIRZyryyKagOmapLu21BhgYf0y+++j9hYlm
X-Gm-Gg: ASbGncsLj/xT8OLYkm8YgbCYSNJ4qEg6vBFNWF8kSLCo6vWIU35O5vuCJkGg8w9oX0v
 +MpsF8bAFO4kIzZ5WFpzW/sYpKhJ3ZQ14/BskAMXGRIIYpFRzd5nhlq0xThbPma4XtxbTGATYs4
 yXbbSgdKIcqhVEDqxhgjEAk1Cc9i4/u42aofaNzqRhdndScACm3//QpliiRVcu47cT0E5qnD0Wq
 QCqHp+PUTF+i+2U7jAG/iwyTQo+zhZmUyKasGkrj3cGK8LsVctQg7mVWhboeAAkvh+VORDd56k9
 qxHM6ZDxNTHHnE+k0Xmw0bGK9bjq4zGYjcpGM+aPVNyd1M9Z41s5M+aV9APfziosrH8Wg2qUXV+
 hMVmzz/7mo+HFz1ddKlpsDEGKf+cvqrUN+FpIQjTLvgbsW/LCXdncM3jTFpAqwrP7yz5P
X-Google-Smtp-Source: AGHT+IHSuiIwYicbhN5BY9cpNCi4LLpyaqc6Hw/NPsbfZXJGtC4kzpXy2p/0Da05MElf8SwD6rEayQ==
X-Received: by 2002:a05:693c:821b:b0:2a4:3593:dde7 with SMTP id
 5a478bee46e88-2abc71c6476mr5334355eec.20.1765262752728; 
 Mon, 08 Dec 2025 22:45:52 -0800 (PST)
Received: from fedora ([2601:646:8081:3770::d056])
 by smtp.gmail.com with ESMTPSA id
 5a478bee46e88-2aba88433fesm42622088eec.6.2025.12.08.22.45.51
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 08 Dec 2025 22:45:52 -0800 (PST)
From: Collin Funk <collin.funk1@HIDDEN>
In-Reply-To: <CA+6di1k8AhmDxfxLCthW_auz1iMokx6w_1eTuzE+4xZWn4cqtw@HIDDEN>
References: <CA+6di1mEt4kTQtO-5d3NeRLUJ3-N+cAwKK+Z6ontNnww6Mytfw@HIDDEN>
 <CA+6di1k8AhmDxfxLCthW_auz1iMokx6w_1eTuzE+4xZWn4cqtw@HIDDEN>
Date: Mon, 08 Dec 2025 22:45:50 -0800
Message-ID: <877buwnof5.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.3 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Hi Jack and Samuel,

"Jack O'Connor" <oconnor663@HIDDEN> writes:

> Oops, I forgot to include a link to the OpenSSL GH issue, which
> describes the specific commit that made the change:
> https://github.com/openssl/openssl/issues/29340
>
> On Mon, Dec 8, 2025 at 2:02=E2=80=AFPM Jack O'Connor <oconnor663@HIDDEN=
m> wrote:
>>
>> Upgrading OpenSSL from v3.5 to v3.6 causes a ~3x slowdown for
>> `sha256sum` (~2x for `sha1sum`) on machines that support SHA-NI. It
>> looks like this was caused by a change in why/how
>> `OPENSSL_cpuid_setup` gets called.
>>
>> I don't know who's "to blame" or what the proper fix will be, but as a
>> hacky example here's a patch that fixes the performance regression in
>> `sha256sum` by calling `OpenSSL_add_all_algorithms` early in `main`:

Thanks for both reports and for the debugging.

I commented on the OpenSSL bug what I think is happening here. The low
level deprecated OpenSSL functions will not call OPENSSL_cpuid_setup
like the EVP ones will. OpenSSL 3.5 would call OPENSSL_cpuid_setup when
the library was loaded, but OpenSSL 3.6 will not.

We use the low-level deprecated APIs, e.g., SHA256_Init, SHA256_Update,
and SHA256_Final, because the EVP APIs are overkill for our purposes. If
my understanding is correct, that means OpenSSL 3.6 never checks what
instructions your CPU supports.

>> diff --git a/src/cksum.c b/src/cksum.c
>> index ac3e3f1..c7c20f0 100644
>> --- a/src/cksum.c
>> +++ b/src/cksum.c
>> @@ -52,6 +52,9 @@
>>  #if HASH_ALGO_SHA256 || HASH_ALGO_SHA224 || HASH_ALGO_CKSUM
>>  # include "sha256.h"
>>  #endif
>> +#if HASH_ALGO_SHA256 && HAVE_OPENSSL_SHA256
>> +# include <openssl/evp.h>
>> +#endif
>>  #if HASH_ALGO_SHA512 || HASH_ALGO_SHA384 || HASH_ALGO_CKSUM
>>  # include "sha512.h"
>>  #endif
>> @@ -1505,6 +1508,10 @@ main (int argc, char **argv)
>>       so that processes running in parallel do not intersperse their out=
put.  */
>>    setvbuf (stdout, nullptr, _IOLBF, 0);
>>
>> +#if HASH_ALGO_SHA256 && HAVE_OPENSSL_SHA256
>> +  OpenSSL_add_all_algorithms();
>> +#endif
>> +
>>  #if HASH_ALGO_SUM
>>    char const *short_opts =3D "rs";
>>  #elif HASH_ALGO_CKSUM

Thanks, this patch is on the right track. Mine covers the rest of the
programs that use OpenSSL.

I'll hold off pushing and watch the OpenSSL bug report, since I think
this change was unintentional.

diff --git a/src/cksum.c b/src/cksum.c
index ac3e3f10e..e4d548079 100644
--- a/src/cksum.c
+++ b/src/cksum.c
@@ -67,6 +67,7 @@
=20
 /* The official name of this program (e.g., no 'g' prefix).  */
 #if HASH_ALGO_SUM
+# define OPENSSL_INIT()
 # define PROGRAM_NAME "sum"
 # define DIGEST_TYPE_STRING "BSD"
 # define DIGEST_STREAM sumfns[sum_algorithm]
@@ -74,6 +75,14 @@
 # define DIGEST_BITS 16
 # define DIGEST_ALIGN 4
 #elif HASH_ALGO_CKSUM
+# if (HAVE_OPENSSL_MD5 || HAVE_OPENSSL_SHA1 || HAVE_OPENSSL_SHA256 || \
+      HAVE_OPENSSL_SHA512 || HAVE_OPENSSL_SHA3)
+#  include <openssl/crypto.h>
+#  define OPENSSL_INIT() OPENSSL_init_crypto (OPENSSL_INIT_ADD_ALL_CIPHERS=
, \
+                                              nullptr)
+# else
+#  define OPENSSL_INIT()
+# endif
 # define MAX_DIGEST_BITS 512
 # define MAX_DIGEST_ALIGN 8
 # define PROGRAM_NAME "cksum"
@@ -83,6 +92,13 @@
 # define DIGEST_BITS MAX_DIGEST_BITS
 # define DIGEST_ALIGN MAX_DIGEST_ALIGN
 #elif HASH_ALGO_MD5
+# if HAVE_OPENSSL_MD5
+#  include <openssl/crypto.h>
+#  define OPENSSL_INIT() OPENSSL_init_crypto (OPENSSL_INIT_ADD_ALL_CIPHERS=
, \
+                                              nullptr)
+# else
+#  define OPENSSL_INIT()
+# endif
 # define PROGRAM_NAME "md5sum"
 # define DIGEST_TYPE_STRING "MD5"
 # define DIGEST_STREAM md5_stream
@@ -90,6 +106,7 @@
 # define DIGEST_REFERENCE "RFC 1321"
 # define DIGEST_ALIGN 4
 #elif HASH_ALGO_BLAKE2
+# define OPENSSL_INIT()
 # define PROGRAM_NAME "b2sum"
 # define DIGEST_TYPE_STRING "BLAKE2b"
 # define DIGEST_STREAM blake2b_stream
@@ -97,6 +114,13 @@
 # define DIGEST_REFERENCE "RFC 7693"
 # define DIGEST_ALIGN 8
 #elif HASH_ALGO_SHA1
+# if HAVE_OPENSSL_SHA1
+#  include <openssl/crypto.h>
+#  define OPENSSL_INIT() OPENSSL_init_crypto (OPENSSL_INIT_ADD_ALL_CIPHERS=
, \
+                                              nullptr)
+# else
+#  define OPENSSL_INIT()
+# endif
 # define PROGRAM_NAME "sha1sum"
 # define DIGEST_TYPE_STRING "SHA1"
 # define DIGEST_STREAM sha1_stream
@@ -104,6 +128,13 @@
 # define DIGEST_REFERENCE "FIPS-180-1"
 # define DIGEST_ALIGN 4
 #elif HASH_ALGO_SHA256
+# if HAVE_OPENSSL_SHA256
+#  include <openssl/crypto.h>
+#  define OPENSSL_INIT() OPENSSL_init_crypto (OPENSSL_INIT_ADD_ALL_CIPHERS=
, \
+                                              nullptr)
+# else
+#  define OPENSSL_INIT()
+# endif
 # define PROGRAM_NAME "sha256sum"
 # define DIGEST_TYPE_STRING "SHA256"
 # define DIGEST_STREAM sha256_stream
@@ -111,6 +142,13 @@
 # define DIGEST_REFERENCE "FIPS-180-2"
 # define DIGEST_ALIGN 4
 #elif HASH_ALGO_SHA224
+# if HAVE_OPENSSL_SHA256
+#  include <openssl/crypto.h>
+#  define OPENSSL_INIT() OPENSSL_init_crypto (OPENSSL_INIT_ADD_ALL_CIPHERS=
, \
+                                              nullptr)
+# else
+#  define OPENSSL_INIT()
+# endif
 # define PROGRAM_NAME "sha224sum"
 # define DIGEST_TYPE_STRING "SHA224"
 # define DIGEST_STREAM sha224_stream
@@ -118,6 +156,13 @@
 # define DIGEST_REFERENCE "RFC 3874"
 # define DIGEST_ALIGN 4
 #elif HASH_ALGO_SHA512
+# if HAVE_OPENSSL_SHA512
+#  include <openssl/crypto.h>
+#  define OPENSSL_INIT() OPENSSL_init_crypto (OPENSSL_INIT_ADD_ALL_CIPHERS=
, \
+                                              nullptr)
+# else
+#  define OPENSSL_INIT()
+# endif
 # define PROGRAM_NAME "sha512sum"
 # define DIGEST_TYPE_STRING "SHA512"
 # define DIGEST_STREAM sha512_stream
@@ -125,6 +170,13 @@
 # define DIGEST_REFERENCE "FIPS-180-2"
 # define DIGEST_ALIGN 8
 #elif HASH_ALGO_SHA384
+# if HAVE_OPENSSL_SHA512
+#  include <openssl/crypto.h>
+#  define OPENSSL_INIT() OPENSSL_init_crypto (OPENSSL_INIT_ADD_ALL_CIPHERS=
, \
+                                              nullptr)
+# else
+#  define OPENSSL_INIT()
+# endif
 # define PROGRAM_NAME "sha384sum"
 # define DIGEST_TYPE_STRING "SHA384"
 # define DIGEST_STREAM sha384_stream
@@ -1505,6 +1557,8 @@ main (int argc, char **argv)
      so that processes running in parallel do not intersperse their output=
.  */
   setvbuf (stdout, nullptr, _IOLBF, 0);
=20
+  OPENSSL_INIT ();
+
 #if HASH_ALGO_SUM
   char const *short_opts =3D "rs";
 #elif HASH_ALGO_CKSUM

Collin




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 9 Dec 2025 17:44:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 09 12:44:26 2025
Received: from localhost ([127.0.0.1]:55529 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vT1lB-0001KW-Rh
	for submit <at> debbugs.gnu.org; Tue, 09 Dec 2025 12:44:26 -0500
Received: from mail.cs.ucla.edu ([131.179.128.66]:57592)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
 id 1vT1l9-0001KD-N4
 for control <at> debbugs.gnu.org; Tue, 09 Dec 2025 12:44:24 -0500
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 1C9F33C0149CB
 for <control <at> debbugs.gnu.org>; Tue,  9 Dec 2025 09:44:18 -0800 (PST)
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP
 id 4f_bVR-C-v_b for <control <at> debbugs.gnu.org>;
 Tue,  9 Dec 2025 09:44:18 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id E65E83C0149F4
 for <control <at> debbugs.gnu.org>; Tue,  9 Dec 2025 09:44:17 -0800 (PST)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu E65E83C0149F4
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1765302257;
 bh=jYtIdYoZ/oa9Kpf3+fRODamD4O3XpGROJbpOsL0c/lY=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=p4fTNLwj9Rdggy0unsu4VrDfXS5+txudS2gDDLn5ffB2aqbumEYRKxnyXg7vl//zS
 ZZiEQ1UvFgCjraOmhEsH2btp9hA9gBw/lv5AupGb4bUGXzYPl81BBU02Khj7aUoJAY
 EjU5uOCbIyvSiBlRs6ftGDBuohKK825bYACVczI7H66JqISDdYdWvhr04Oj100SKBg
 3c49Rfa9rEPprnFc2YOqZmXtjLKXjJQJ2Z5gnZFY/L8RF3ZytatD9aRy3KiCR+3M9J
 38J165OZYynrIg3SHctlrhSHX07u1VhVIDLIDKGGNVJ2GfTEVGwuX023wwDUKS3ehi
 Gq0S9XfdgTv9g==
X-Virus-Scanned: amavis at mail.cs.ucla.edu
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP
 id rqdtwFlpOdlP for <control <at> debbugs.gnu.org>;
 Tue,  9 Dec 2025 09:44:17 -0800 (PST)
Received: from penguin.cs.ucla.edu
 (47-154-25-30.fdr01.snmn.ca.ip.frontiernet.net [47.154.25.30])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id CD13F3C0149CB
 for <control <at> debbugs.gnu.org>; Tue,  9 Dec 2025 09:44:17 -0800 (PST)
Message-ID: <478dea4b-a899-428f-b0c5-4e9e339b9b26@HIDDEN>
Date: Tue, 9 Dec 2025 09:44:17 -0800
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
To: control <at> debbugs.gnu.org
From: Paul Eggert <eggert@HIDDEN>
Subject: merge 79971 79972
Organization: UCLA Computer Science Department
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

merge 79971 79972





Last modified: Tue, 9 Dec 2025 18:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.