Re: [TLS] Encrypt-then-MAC again (was Re: padding bug) (Martin Rex) Fri, 29 November 2013 21:09 UTC

Return-Path: <>
Received: from localhost ( []) by (Postfix) with ESMTP id 7A5841AE1DF for <>; Fri, 29 Nov 2013 13:09:46 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -6.552
X-Spam-Status: No, score=-6.552 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HELO_EQ_DE=0.35, RCVD_IN_DNSWL_HI=-5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id IzQJd45_WZq5 for <>; Fri, 29 Nov 2013 13:09:44 -0800 (PST)
Received: from ( []) by (Postfix) with ESMTP id 99C481AE1DE for <>; Fri, 29 Nov 2013 13:09:44 -0800 (PST)
Received: from by (26) with ESMTP id rATL9ehW022873 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 29 Nov 2013 22:09:40 +0100 (MET)
In-Reply-To: <>
To: Taylor Hornby <>
Date: Fri, 29 Nov 2013 22:09:40 +0100 (CET)
X-Mailer: ELM [version 2.4ME+ PL125 (25)]
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="US-ASCII"
Message-Id: <>
From: (Martin Rex)
X-SAP: out
Subject: Re: [TLS] Encrypt-then-MAC again (was Re: padding bug)
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." <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Fri, 29 Nov 2013 21:09:46 -0000

Taylor Hornby wrote:
> The quantity of code changes isn't all that matters. The complexity and
> the elegance of the changes do too.

I do not consider seperate new GenericBlockCipher PDUs (one for SSLv3+TLSv1.0
and a seperate one for TLSv1.1+TLSv1.2) particularly elegant, and neither
do I think that leaving the predictable IV in SSLv3+TLSv1.0 is sensical
when we _do_ change that PDU.

> Often you can fix something with a one-line hack that makes the code
> more confusing, or you can re-write the function and do it properly.

> I suspect moving to pad-mac-encrypt instead of pad-encrypt-mac is more
> like a one-line hack that would actually make implementation harder.
> Most of the encryption APIs I've seen do the padding internally, where
> you can't access it to compute the MAC.

Admittedly, I know very few encryption APIs.  The two that I know
offer CBC with both, a function that does PKCS-padding for you,
and one that does not perform padding.
PKCS#11 v2.01 (1997) seems to have both.

There are some applications that use padding other than PKCS-padding.
XMLenc is one example (PKCS-padding is a subset of valid XML-paddings).

> Also: Won't you still have to use the padding to *find* the MAC in the
> ciphertext, in order to check the MAC before you remove the padding? If
> so, then a padding oracle is still possible.

Nope.  when using pad-mac-encrypt, then the mac will always be at the end,
and covered by the MAC computation.