Re: [openpgp] OpenPGP encryption block modes

Bruce Walzer <bwalzer@59.ca> Mon, 15 August 2022 14:50 UTC

Return-Path: <bwalzer@59.ca>
X-Original-To: openpgp@ietfa.amsl.com
Delivered-To: openpgp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 7D4D1C1524BC for <openpgp@ietfa.amsl.com>; Mon, 15 Aug 2022 07:50:10 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.909
X-Spam-Level:
X-Spam-Status: No, score=-6.909 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id otTd2jaISrvO for <openpgp@ietfa.amsl.com>; Mon, 15 Aug 2022 07:50:09 -0700 (PDT)
Received: from mail.59.ca (mail.59.ca [205.200.229.83]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA512) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E4CF3C1524B9 for <openpgp@ietf.org>; Mon, 15 Aug 2022 07:50:08 -0700 (PDT)
Received: from [10.0.0.2] (helo=ohm.59.ca) by mail.59.ca with esmtpsa (TLS1.3) tls TLS_CHACHA20_POLY1305_SHA256 (Exim 4.94.2) (envelope-from <bwalzer@59.ca>) id 1oNbPg-000IlL-Rz; Mon, 15 Aug 2022 09:49:56 -0500
Date: Mon, 15 Aug 2022 09:49:55 -0500
From: Bruce Walzer <bwalzer@59.ca>
To: "brian m. carlson" <sandals@crustytoothpaste.net>, openpgp@ietf.org
Message-ID: <YvpdE46HHwohGDQr@ohm.59.ca>
References: <YuKpxp0/Dy1DfC19@watt.59.ca> <875yjhjg2c.fsf@thinkbox> <87r124m64c.fsf@wheatstone.g10code.de> <YulX9jI1+wOCwLJq@ohm.59.ca> <Q6EUpbQm0e5f1OiU-77Old9p9FXyLCaFZ8pMm7PTt8VTLQJaXRQzWIDSwc3db6yI-56imyOaTNdt9TC8Zrm1jN_kPKxFYH4OqEu6o-Wfquo=@protonmail.com> <YuvlHdLz0Sfle7Ot@ohm.59.ca> <87a68ji1bv.fsf@wheatstone.g10code.de> <YvPGY8ArcKD7Hr1p@watt.59.ca> <YvQoC1g5rzKCfCVp@tapette.crustytoothpaste.net> <871qtnozkr.fsf@wheatstone.g10code.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <871qtnozkr.fsf@wheatstone.g10code.de>
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/VzYuBXEQMplSVVsD4vvcLPz7AiE>
Subject: Re: [openpgp] OpenPGP encryption block modes
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/openpgp>, <mailto:openpgp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/openpgp/>
List-Post: <mailto:openpgp@ietf.org>
List-Help: <mailto:openpgp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/openpgp>, <mailto:openpgp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 15 Aug 2022 14:50:10 -0000

On Thu, Aug 11, 2022 at 12:16:04PM +0200, Werner Koch wrote:

[...]

> I can throw in some other numbers from Libgcrypt 1.10.1 [0]

[...]

> On a AMD Ryzen 7 4800U NUC:
> 
>  AES256         |  nanosecs/byte   mebibytes/sec   cycles/byte  auto Mhz
>         CFB enc |     0.819 ns/B      1164 MiB/s      3.50 c/B      4269
>         CFB dec |     0.113 ns/B      8431 MiB/s     0.481 c/B      4256
>         GCM enc |     0.242 ns/B      3938 MiB/s      1.03 c/B      4260±1
>         GCM dec |     0.243 ns/B      3931 MiB/s      1.04 c/B      4268±3
>        GCM auth |     0.120 ns/B      7931 MiB/s     0.513 c/B      4264±1
>         OCB enc |     0.134 ns/B      7142 MiB/s     0.569 c/B      4259
>         OCB dec |     0.131 ns/B      7297 MiB/s     0.556 c/B      4258±1
>        OCB auth |     0.132 ns/B      7210 MiB/s     0.563 c/B      4259
>  SHA1           |     0.443 ns/B      2151 MiB/s      1.89 c/B      4262±1
>  SHA256         |     0.475 ns/B      2010 MiB/s      2.02 c/B      4265
>  SHA512         |      1.22 ns/B     783.6 MiB/s      5.17 c/B      4245±4
> 
> 

What am I doing wrong here? All in cycles per byte (c/B).

> I can't find our GnuPG benchmarks comparing CFB and OCB right now, but
> the above numbers should give some hints: For the Ryzen OCB encryption
> is roughly 15 times faster than CFB+SHA1.

(3.50 + 1.89) / 0.569 = 9.5 (different result)

> Decryption is 4 times faster.

(0.481 + 1.89) / 0.556 = 4.3 (same result)

Bruce