[CFRG] Re: BLAKE3 I-D

Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com> Thu, 15 August 2024 23:46 UTC

Return-Path: <jeanphilippe.aumasson@gmail.com>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E1EE8C1840CB; Thu, 15 Aug 2024 16:46:34 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.107
X-Spam-Level:
X-Spam-Status: No, score=-2.107 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 SzayO0nSUobl; Thu, 15 Aug 2024 16:46:34 -0700 (PDT)
Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 40978C151989; Thu, 15 Aug 2024 16:46:34 -0700 (PDT)
Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2cb5789297eso1089811a91.3; Thu, 15 Aug 2024 16:46:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723765594; x=1724370394; darn=ietf.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=3W2kdT6M6xsxrAGPugRKSwuEtx5izis2QeYDmGoxawk=; b=dkjX3y2Lw84gU6SSVnWGMQCcQ8aV17Cg7ljn82+D2YGlONxlRi89eqOvT1fgiIfh6p Eu2Zp6QQLa5AwEtqRD/RGEqBCTp6LQqXI4sY1L8xYkj8rRuKFOwfCHCY3k05+DibCo8I 00CtfCivfyePbPHzz2LgnXDqB0bs1bfGWCOP3BcqNPLn6QOSSrMAo+pjP201nN0DFf4F OH9jb/zR7Ivby1n/e/qIK88eZfar23GShKgteig2ng9vh9VvpGJmNVNCbzIalCfIL5x0 bDU8rihSqZ2FJsWBdCwdHNqEzOXwzpR4e6c5Df+SKCy94vhF6iZKTkG2mbvoqNeeZ/sH jY3g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723765594; x=1724370394; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3W2kdT6M6xsxrAGPugRKSwuEtx5izis2QeYDmGoxawk=; b=LM7xdpi+axmDOMldgaAiCkBi+hDASQl5Pb3TH2SGUFtre6Zl3xnJsAUnrcFE4HyUSc k9+9L3yd1gVeoUdqMzMYrblW4NAL1OE6lQS26RSVgnBryF9D71eOfFlB+5UAFTVAjO5s mSu9MzHnM8OPXDy0Fri04cG2IyyhehwR7Vr4SAUn4HymFkaeIarjciNa8nihatJWQk+0 iAncX7mlllIzORhjmnIKjWScRIQU0JDLn6j0uGJtSYIFUhp+H9SNfvDkAVB6yRmgYw4+ vO6yQL0MH+9kseDQK1zUN7cMGJ0cLKOReY3OiyWAyYpDtWVUMNXkU+arLY/mHqXrmMkd OFDg==
X-Forwarded-Encrypted: i=1; AJvYcCVE4hcdD5v5OQ8Y+U3vNPY84U1a8AVyD2RK/KojA6CEkU3WYlWWb2mNUdG54mPKVJcjVUxiLw==@ietf.org, AJvYcCW1aL6YF+d9D2gYtPOdmSvNjqRLMktDRcO0kIbJJGjoOEUlBpKThWVtYs2ppQ6mhnbXy+AwZi1wwKHpow==@ietf.org
X-Gm-Message-State: AOJu0YwK5MuhS606oFqd3hY2tqWnHnnm6D9/L4bZ9yyaaHd42MzUgc+k J8TK00Do9twm1tBaZ+BEPCK1303HYZXZ7svLd9ivAqnNlsXb/zSVJNhjd6mGUhkucj0ux/0VMrJ i2n5eiYkFI/4Yz/zabUPuh3Qbg3Y=
X-Google-Smtp-Source: AGHT+IHfiJFOokJvGSIFuBW2EoGN0LKIMUXGWLP1tjXnN1pr7VQeuBHK75XNzcZXOIiiAphMQOtFi3tpxND9hJ4FmVk=
X-Received: by 2002:a17:90a:3043:b0:2cb:4c25:f941 with SMTP id 98e67ed59e1d1-2d3dfc6b684mr1295934a91.17.1723765593464; Thu, 15 Aug 2024 16:46:33 -0700 (PDT)
MIME-Version: 1.0
References: <CAGiyFdfKZ1qsPR62kb8M_EqfGOfuU4nkEY4JjLCwBb_JOZdxOA@mail.gmail.com> <CAMr0u6kpcRvsifS3GRX0LNCD1LODo_pePZo51K7okfQtatEgNA@mail.gmail.com> <CAGiyFdfAFT4HzxNLB4QKdGs8F8QD-y5LmMpnH=C+O8+2XF8eBQ@mail.gmail.com> <CAG2Zi20x1WvGH3FdhOW0HjpDfJhgfnSJUvXsoqywgn4vy_1eGA@mail.gmail.com> <CA+6di1kw4rPcseBUfAc=kTLbQSXGyph9wHZV-fn9CEg5KjOkgA@mail.gmail.com> <CAG2Zi21v9pDu_EOB1aOyFwsJ+ztoZ5tnk7Dimhap7xGMryJttQ@mail.gmail.com> <CAGiyFdeUaYaKfDwe1xyRQmB1svW3OBpCRXKvOnA-hcyi5zec-w@mail.gmail.com> <CAG2Zi2277O_aJhY1v5N6vGFK1_TPFHQ5w89RJgmzfbSBmGhmcw@mail.gmail.com> <CA+6di1nvyi53OUquH-JBGm_nk34f+R+UTLPB81ct9mSbSmOUeQ@mail.gmail.com>
In-Reply-To: <CA+6di1nvyi53OUquH-JBGm_nk34f+R+UTLPB81ct9mSbSmOUeQ@mail.gmail.com>
From: Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com>
Date: Thu, 15 Aug 2024 16:46:17 -0700
Message-ID: <CAGiyFddACuWrNhpEWsc1c86nH8+DhA5OeGGjU_vq==Hn9uz_Jg@mail.gmail.com>
To: Jack O'Connor <oconnor663@gmail.com>
Content-Type: multipart/alternative; boundary="000000000000dfe5f6061fc1733a"
Message-ID-Hash: SGSD4F2N6CUQKQ7AE4AJFWSQTVPYFFJP
X-Message-ID-Hash: SGSD4F2N6CUQKQ7AE4AJFWSQTVPYFFJP
X-MailFrom: jeanphilippe.aumasson@gmail.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-cfrg.irtf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: cfrg@ietf.org, cfrg-chairs@ietf.org, Zooko O'Whielacronx <zookog@gmail.com>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [CFRG] Re: BLAKE3 I-D
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/HHL-PA1cVcPlvbFIiNjAnbIsmjo>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Owner: <mailto:cfrg-owner@irtf.org>
List-Post: <mailto:cfrg@irtf.org>
List-Subscribe: <mailto:cfrg-join@irtf.org>
List-Unsubscribe: <mailto:cfrg-leave@irtf.org>

Was this received by the CFRG ml? (Apologies for the double posting if yes.)

On Thu, Aug 15, 2024 at 4:34 PM Jack O'Connor <oconnor663@gmail.com> wrote:

> I'm slightly embarrassed to report that our XOF implementation is slower
> than it should be. It should benefit from all the same SIMD optimizations
> as the input side, but our current assembly implementations only
> parallelize input, and the XOF uses a slower codepath with less
> parallelism. Concretely on a CPU with AVX-512 support, for outputs longer
> than 1 KiB or so, it should be ~5x faster than it is. (Not as fast as
> hardware-accelerated AES-CTR though.)
>
> If you do have an AVX-512 Linux machine, and you want to benchmark the
> properly optimized XOF, it's currently on this branch:
> https://github.com/BLAKE3-team/BLAKE3/tree/xof_integration_rebase. I've
> been dragging my feet on shipping that, but I should go ahead and push it
> out, even though it doesn't cover all our target platforms.
>
> On Thu, Aug 15, 2024 at 2:06 PM Christopher Patton <cpatton@cloudflare.com>
> wrote:
>
>> Hi all,
>>
>> Before adopting BLAKE3, I think it would be useful to see how much of a
>> difference it would make in our applications. I would suggest looking
>> through RFCs published by CFRG and assess how performance would change if
>> they could have used BLAKE3. Off the top of my head:
>> - RFC 9180 - HPKE (replace HKDF?)
>> - draft-irtf-cfrg-opaque - OPAQUE
>> - RFC 9380 - hashing to elliptic curves
>>
>> I'll add my own data point: draft-irtf-cfrg-vdaf. This draft specifies an
>> incremental distributed point function (IDPF), a type of function secret
>> sharing used in some MPC protocols. Most of the computation is spent on XOF
>> evaluation. For performance reasons, we try to use AES wherever we can in
>> order to get hardware support. We end up with a mix of TurboSHAKE128 and
>> AES, which is not ideal. It would be much nicer if we could afford to use a
>> dedicated XOF, but TurboSHAKE128 is not fast enough in software. I threw
>> together some benchmarks for B3:
>>
>> https://github.com/cjpatton/libprio-rs/compare/main...cjpatton:libprio-rs:exp/blake3-for-idpf?expand=1
>>
>> The results were interesting. Compared to Turbo, B3 is 30% faster, as
>> expected. Compared to the baseline (mix of Turbo and AES), B3 is 2-3x
>> slower for the client operation, as expected; but the server was slightly
>> faster, which frankly is a bit of a mystery. We'll need to dig into the
>> code more to be certain, as there may be some obvious inefficiencies on the
>> client side. But preliminarily, I would say B3 is probably too slow in
>> software for this application.
>>
>> Chris P.
>>
>>
>>
>>
>>