Re: [TLS] ESNI padding the Certificate message

Viktor Dukhovni <ietf-dane@dukhovni.org> Thu, 13 December 2018 15:27 UTC

Return-Path: <ietf-dane@dukhovni.org>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id A5101124408 for <tls@ietfa.amsl.com>; Thu, 13 Dec 2018 07:27:50 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.201
X-Spam-Level:
X-Spam-Status: No, score=-4.201 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VGhoBw_w3Tkq for <tls@ietfa.amsl.com>; Thu, 13 Dec 2018 07:27:49 -0800 (PST)
Received: from straasha.imrryr.org (straasha.imrryr.org [100.2.39.101]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 03C971200B3 for <tls@ietf.org>; Thu, 13 Dec 2018 07:27:49 -0800 (PST)
Received: from [192.168.1.161] (unknown [192.168.1.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by straasha.imrryr.org (Postfix) with ESMTPSA id 27842AE004 for <tls@ietf.org>; Thu, 13 Dec 2018 10:27:47 -0500 (EST)
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\))
From: Viktor Dukhovni <ietf-dane@dukhovni.org>
In-Reply-To: <876187a2-df66-2eb0-5a55-b6e67cf668f6@cs.tcd.ie>
Date: Thu, 13 Dec 2018 10:27:46 -0500
Content-Transfer-Encoding: quoted-printable
Reply-To: IETF TLS WG <tls@ietf.org>
Message-Id: <B3D20A93-3332-4541-8108-E4EFB08FBF6F@dukhovni.org>
References: <876187a2-df66-2eb0-5a55-b6e67cf668f6@cs.tcd.ie>
To: IETF TLS WG <tls@ietf.org>
X-Mailer: Apple Mail (2.3445.102.3)
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/9uT2pQX1fmoMBeFDGVgYwz76m8o>
Subject: Re: [TLS] ESNI padding the Certificate message
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <tls.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tls>, <mailto:tls-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tls/>
List-Post: <mailto:tls@ietf.org>
List-Help: <mailto:tls-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tls>, <mailto:tls-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 13 Dec 2018 15:27:51 -0000

> On Dec 13, 2018, at 8:10 AM, Stephen Farrell <stephen.farrell@cs.tcd.ie> wrote:
> 
> Was just adding code for this and I noticed that the draft says
> a server: "SHOULD pad the Certificate message, via padding at
> the record layer, such that its length equals the size of the
> largest possible Certificate (message) covered by the same ESNI
> key."

"Largest possible" is not always a knowable target.  One often does
not know anything about the sizes of the other potential certificate
chains in advance of serving such a chain.  Far more sensible would
be to add random padding whose size is commensurate with the size of
the certificate message.

I would generate a random nibble, and count the first $k$
non-zero bits.  Then $1 + k$ times add independently
random([0, N/2]) bytes of padding to an $N$ byte message,
giving an additional $~N$ bytes on average, but occasionally
up to $2.5N$ additional bytes.

-- 
	Viktor.