Re: [TLS] Possible timing attack on TLS 1.3 padding mechanism

Martin Thomson <martin.thomson@gmail.com> Fri, 02 March 2018 01:12 UTC

Return-Path: <martin.thomson@gmail.com>
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 7C6F412426E for <tls@ietfa.amsl.com>; Thu, 1 Mar 2018 17:12:59 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] 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 ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vISmM277hOnd for <tls@ietfa.amsl.com>; Thu, 1 Mar 2018 17:12:58 -0800 (PST)
Received: from mail-ot0-x241.google.com (mail-ot0-x241.google.com [IPv6:2607:f8b0:4003:c0f::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 504D21241F3 for <tls@ietf.org>; Thu, 1 Mar 2018 17:12:58 -0800 (PST)
Received: by mail-ot0-x241.google.com with SMTP id w2so7417313otg.2 for <tls@ietf.org>; Thu, 01 Mar 2018 17:12:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5GDUIr+X/26E30CVhONwjuQOqrnH4HFCUGh75i23Mhc=; b=Xdarc9CBZ4llbQucjyPWTf8u4+wUdhAEX3xryx83KDQPQAghcemvyrvacvRff2TG9n vX4xhdoIfA18zoSbJaiuW6CWwOo+XxUndmB+LMxC6l0PiqWwu9018PFmcYlY8MlrWYXE gdNNeO8BVFK1B5wRCN7gwdnJJN7HHE58XuaY/kEpiP5rQheuQwG1rbT13LCmy3Fmzypu FPxpGcZ9a/QSbMMu8c6rA0dTPdlDpYsEojWpB9XOpcPVQQHuhlAxt7yH2sMmk9KAME8q +l8lt7SShkoP6b6ZW6oEHw84OAzaQt2pB6sFcMjosSISPDuQqZvEASw0spQiKC7bhWRM Rfsg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=5GDUIr+X/26E30CVhONwjuQOqrnH4HFCUGh75i23Mhc=; b=LDYvnokdfEprbV7CkRmQXvJSIxvNkegoIcOSb+9s/ZETsqIrvRmjo1DMj1A9oHIWAk BtBFb4h/Jd4CSu+Vr4v7aSQpz0z+5DnhvHwe06x7z125sz4F24oE8+kJtU0WnMp1hcyg LHKTpz2vT9DRvDOYNP0xdWGv/JzAF2Q97DMDSq6xCdYN5zaRNqMWTGge4qXEHpXgKdaO /KidhYO3G8IoogJQnkNO2qicFZ+ndoaiGIpUPVN4cSZubLditTWgZvBnz8fLuw0tx3ej 3rHIZfeypcJBX0olbMyZbDGg2bP5Alz+CWsgcwVxu91wKjH+DLTUB1iSYr5EA05szitJ Afnw==
X-Gm-Message-State: APf1xPAfVVawdg+Nm/JeFPhbZ4XaxcON5VMVOjUDT124mNgQ037CQ6f3 kUYt1IDe1AhlMkb0vroKI6uWMGHJ3EMtUQsn9HU=
X-Google-Smtp-Source: AG47ELtSxwRD7+6dVI/8dP+8sxnhWPtG1d1NGyu3rQ83TMQjMGSZYBYorcPUO4oXjygUSIGlSrk9i/9fw167Yn/+awI=
X-Received: by 10.157.32.114 with SMTP id n105mr2651539ota.394.1519953177592; Thu, 01 Mar 2018 17:12:57 -0800 (PST)
MIME-Version: 1.0
Received: by 10.157.16.85 with HTTP; Thu, 1 Mar 2018 17:12:57 -0800 (PST)
In-Reply-To: <87zi3rs7mh.fsf@fifthhorseman.net>
References: <16A9FD3A-7805-4130-8438-39D0D3E7E3AB@rhul.ac.uk> <87zi3rs7mh.fsf@fifthhorseman.net>
From: Martin Thomson <martin.thomson@gmail.com>
Date: Fri, 02 Mar 2018 12:12:57 +1100
Message-ID: <CABkgnnVEMj7DGN0GxtSwWSfyDhhdXfXoiwA8XE6M5xgLAHo-iQ@mail.gmail.com>
To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Cc: "Paterson, Kenny" <Kenny.Paterson@rhul.ac.uk>, "<tls@ietf.org>" <tls@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/ybF54PcfT98mXoIesWYqqD7d1hw>
Subject: Re: [TLS] Possible timing attack on TLS 1.3 padding mechanism
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.22
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: Fri, 02 Mar 2018 01:12:59 -0000

On Fri, Mar 2, 2018 at 10:23 AM, Daniel Kahn Gillmor
<dkg@fifthhorseman.net> wrote:
> You could of course check from the front of the plaintext, keeping every
> non-zero value:
>
>   char ptype = 0;
>   for (i = 0; i < plaintext_len; i++)
>     if plaintext[i]
>       ptype = plaintext[i];

What about ?

size_t l[2];
size_t t[2];
for (i = 0; i < plaintext_len; ++i) {
  l[plaintext[i] != 0] = i;
  t[plaintext[i] != 0] = plaintext[i];
}
unpadded_len = l[0] - 1;
content_type = t[1];