Re: [TLS] rfc7366: is encrypt-then-mac implemented?

Manuel Pégourié-Gonnard <mpg@polarssl.org> Thu, 30 October 2014 11:34 UTC

Return-Path: <mpg@polarssl.org>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id BF82B1AD0C4 for <tls@ietfa.amsl.com>; Thu, 30 Oct 2014 04:34:43 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.397
X-Spam-Level:
X-Spam-Status: No, score=0.397 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HELO_MISMATCH_COM=0.553, HOST_EQ_NL=1.545, MIME_8BIT_HEADER=0.3, SPF_PASS=-0.001] autolearn=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 OXg9W5dVT3Y0 for <tls@ietfa.amsl.com>; Thu, 30 Oct 2014 04:34:39 -0700 (PDT)
Received: from vps2.offspark.com (vps2.brainspark.nl [141.138.204.106]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 434FC1AD0C0 for <tls@ietf.org>; Thu, 30 Oct 2014 04:34:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=polarssl.org; s=exim; h=Subject:Content-Transfer-Encoding:Content-Type:In-Reply-To:References:CC:To:MIME-Version:From:Date:Message-ID; bh=7vdLR+5XJ+vJ22a26zFgcmniviD3S8OO+6mDff4XCqY=; b=At39MeiEX1woXv/w0642/36LjKYlZFKnm+k8y1XfHjAwuAtAwWOBZsSd9pSCRfg/HO2skepqjlwfOU6ET4uvw2dEz46Z/9xV/n9V2qae/574hydgrKTi9otbAz7EyiMzOxL7X7bX8S4sfnBBv/tnB4PrhvhW1aAHOHR+YLDfBD8=;
Received: from thue.elzevir.fr ([88.165.216.11] helo=[192.168.0.124]) by vps2.offspark.com with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <mpg@polarssl.org>) id 1Xjnzq-0002pT-DD; Thu, 30 Oct 2014 12:34:30 +0100
Message-ID: <5452224A.9030202@polarssl.org>
Date: Thu, 30 Oct 2014 12:34:34 +0100
From: Manuel Pégourié-Gonnard <mpg@polarssl.org>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
MIME-Version: 1.0
To: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>, Peter Gutmann <pgut001@cs.auckland.ac.nz>
References: <9A043F3CF02CD34C8E74AC1594475C739B9DBED9@uxcn10-5.UoA.auckland.ac.nz> <20141030111210.GA15345@LK-Perkele-VII>
In-Reply-To: <20141030111210.GA15345@LK-Perkele-VII>
Content-Type: text/plain; charset="windows-1252"
Content-Transfer-Encoding: 7bit
X-SA-Exim-Connect-IP: 88.165.216.11
X-SA-Exim-Mail-From: mpg@polarssl.org
X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000)
X-SA-Exim-Scanned: Yes (on vps2.offspark.com)
Archived-At: http://mailarchive.ietf.org/arch/msg/tls/-NEn001ujKX3g9qc7Zlh6sLyzbM
Cc: "<tls@ietf.org>" <tls@ietf.org>
Subject: Re: [TLS] rfc7366: is encrypt-then-mac implemented?
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.15
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: <http://www.ietf.org/mail-archive/web/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, 30 Oct 2014 11:34:43 -0000

On 30/10/2014 12:12, Ilari Liusvaara wrote:
> Thus, the length field on _wire_ does _not_ include the MAC, and the
> MAC'd data is what is on wire, bit for bit.
> 
I think that's one possible way to read the RFC indeed. I'll just repeat what
Nikos said in [1]: this is _not_ what the eid server does.

https://www.ietf.org/mail-archive/web/tls/current/msg14345.html

> E.g. 14-byte application payload, minimal padding, AES-CBC, HMAC-SHA1,
> TLS v1.2: 32 bytes, regardless of MAC truncation (whereas normally it
> would be 52 for full and e.g. 48 for 16-byte truncated MAC).
> 
And in this scenario, the eid server puts 52 (ie 00 34) on the wire. As does
every other implementation I know of.

Just to (try and) make sure the behaviour of the implementations discuss is
clear to everyone, the only difference between the two groups of implementation
I know of is that, in your example (thanks for making things concrete) is:

MAC( seq_num, type, version, 00 20, encrypted_stuff ) // eid, openssl

vs:

MAC( seq_num, type, version, 00 34, encrypted_stuff ) // nss, gnutls, polarssl

> What that sort of thing does to "middleboxes" that for some reason
> parse the TLS PDU stream could be somewhat... interesting.
> 
I think so. Even without considering middleboxes, this doesn't sound right, and
that's probably why no implementation does that, thought I agree that's one of
the conclusions that can be logically reached by strictly interpreting the RFC.

Manuel.