Re: [Cfrg] Discuss/standardize Preview extension to AEAD abstraction?

Damien Miller <djm@mindrot.org> Thu, 03 December 2015 00:28 UTC

Return-Path: <djm@mindrot.org>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B7F6D1B2EFB for <cfrg@ietfa.amsl.com>; Wed, 2 Dec 2015 16:28:31 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.497
X-Spam-Level:
X-Spam-Status: No, score=-3.497 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HELO_EQ_AU=0.377, HOST_EQ_AU=0.327, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001] autolearn=ham
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 5O8Ipz5SBSJR for <cfrg@ietfa.amsl.com>; Wed, 2 Dec 2015 16:28:29 -0800 (PST)
Received: from newmailhub.uq.edu.au (mailhub1.soe.uq.edu.au [130.102.132.208]) by ietfa.amsl.com (Postfix) with ESMTP id C12C01B2EFA for <Cfrg@irtf.org>; Wed, 2 Dec 2015 16:28:27 -0800 (PST)
Received: from smtp1.soe.uq.edu.au (smtp1.soe.uq.edu.au [10.138.113.40]) by newmailhub.uq.edu.au (8.14.5/8.14.5) with ESMTP id tB30SLsu001620; Thu, 3 Dec 2015 10:28:21 +1000
Received: from mailhub.eait.uq.edu.au (hazel.eait.uq.edu.au [130.102.60.17]) by smtp1.soe.uq.edu.au (8.14.5/8.14.5) with ESMTP id tB30SLmq044468 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 3 Dec 2015 10:28:21 +1000
Received: from natsu.mindrot.org (natsu.mindrot.org [130.102.96.2]) by mailhub.eait.uq.edu.au (8.15.1/8.15.1) with ESMTP id tB30SLH5001771; Thu, 3 Dec 2015 10:28:21 +1000 (AEST)
Received: by natsu.mindrot.org (Postfix, from userid 1000) id E8871A4F32; Thu, 3 Dec 2015 11:28:20 +1100 (AEDT)
Received: from localhost (localhost [127.0.0.1]) by natsu.mindrot.org (Postfix) with ESMTP id E7D4EA4F31; Thu, 3 Dec 2015 11:28:20 +1100 (AEDT)
Date: Thu, 03 Dec 2015 11:28:20 +1100
From: Damien Miller <djm@mindrot.org>
To: Bryan Ford <brynosaurus@gmail.com>
In-Reply-To: <8F1E4FEC-1FED-491B-BC6A-B00C27864414@gmail.com>
Message-ID: <alpine.BSO.2.20.1512031055120.12629@natsu.mindrot.org>
References: <8F1E4FEC-1FED-491B-BC6A-B00C27864414@gmail.com>
User-Agent: Alpine 2.20 (BSO 67 2015-01-07)
MIME-Version: 1.0
Content-Type: multipart/mixed; BOUNDARY="15775414878208-2139875679-1449102500=:12629"
X-Scanned-By: MIMEDefang 2.73 on UQ Mailhub
X-Scanned-By: MIMEDefang 2.75 on 130.102.60.17
X-UQ-FilterTime: 1449102502
Archived-At: <http://mailarchive.ietf.org/arch/msg/cfrg/9rRuoEAq0LDtLjP5tfJHP0CK8HQ>
Cc: Cfrg@irtf.org
Subject: Re: [Cfrg] Discuss/standardize Preview extension to AEAD abstraction?
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/cfrg>, <mailto:cfrg-request@irtf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg/>
List-Post: <mailto:cfrg@irtf.org>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Thu, 03 Dec 2015 00:28:31 -0000


On Mon, 30 Nov 2015, Bryan Ford wrote:

> A few days ago I started a thread on the TLS list on encrypting TLS
> headers, like SSH has been doing for a long time, to add (limited but
> useful) protection against passive fingerprinting and traffic analysis
> attacks. I then learned that there’s a parallel discussion thread
> touching on the same topic on the SSH mailing list. I don’t want to
> start yet another discussion thread on the merits of header-encryption
> in general (see either of those two existing threads if you want to
> jump in on that :) ) - but I wanted to bring up the technical issue
> of how header-encryption interacts with the shift toward AEAD cipher
> designs. This seemed like a potentially interesting CFRG topic.
>
> The general problem (for TLS or SSH or many other protocols) is that
> we might like to encrypt both the header and the payload, but the
> header typically includes the length field, and the receiver needs
> that length field to know how big of a blob to read and pass to the
> AEAD for decryption and integrity-checking. Thus, we really would
> like a three-stage receive process: (1) decrypt header to retrieve
> length, (2) read the cipher text payload, (3) decrypt the payload and
> integrity-check both the header and payload. Is it worth considering
> a fairly simple extension to the AEAD abstraction that would support
> this form of operation?

Speaking as an application developer, I want a primitive that allows
me to "seal" zero or more bytes of plaintext to be encrypted and
authenticated along with zero or more bytes of AAD to be authenticated
into a self-delimiting blob that preserves the integrity and
*optionally the privacy* of the lengths of the plaintext and AAD.

At the other end, I want to, given enough of the header of that blob,
be able to determine a) how many bytes I need to read to get the whole
thing, b) how much space I'll need to extract the plaintext (if any) and
c) how much space I'll need to extract the AAD (if any).

This is pretty close to the crypto_box abstraction in NaCl or
BoringSSL's EVP_AEAD_CTX_seal, but it goes a little further in making
the result *including length fields* entirely opaque to the application
developer.

IMO this would cover most (not all) application use-cases with a simple,
hard to misuse primitive.

Something like this:

size_t box_seal_need(struct cipher *ctx,
    size_t plaintext_len, size_t aad_len);

int box_seal(struct cipher *ctx,
    const u_char *plaintext, size_t plaintext_len,
    const u_char *aad, size_t aad_len,
    u_char *sealtext, size_t sealtext_len);

size_t seal_header_need(struct cipher *ctx);

int box_open_need(struct cipher *ctx,
    const u_char *seal_header, size_t seal_header_len,
    size_t *sealtext_len, size_t *plaintext_len, size_t *aad_len);

int box_open(struct cipher *ctx,
    const u_char *sealtext, size_t sealtext_len,
    u_char *plaintext, size_t plaintext_len,
    u_char *aad, size_t aad_len);

-d