Re: [Cfrg] AEAD_AES_x_CBC_HMAC_SHA_y as a MAC algorithm

"Manger, James H" <James.H.Manger@team.telstra.com> Wed, 20 March 2013 23:20 UTC

Return-Path: <James.H.Manger@team.telstra.com>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 7F76111E80F5 for <cfrg@ietfa.amsl.com>; Wed, 20 Mar 2013 16:20:12 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.507
X-Spam-Level:
X-Spam-Status: No, score=-1.507 tagged_above=-999 required=5 tests=[AWL=-0.606, BAYES_00=-2.599, HELO_EQ_AU=0.377, HOST_EQ_AU=0.327, RELAY_IS_203=0.994]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CKLbG6wf2n0Q for <cfrg@ietfa.amsl.com>; Wed, 20 Mar 2013 16:20:11 -0700 (PDT)
Received: from ipxavo.tcif.telstra.com.au (ipxavo.tcif.telstra.com.au [203.35.135.200]) by ietfa.amsl.com (Postfix) with ESMTP id 3E72711E80F4 for <cfrg@irtf.org>; Wed, 20 Mar 2013 16:20:10 -0700 (PDT)
X-IronPort-AV: E=Sophos;i="4.84,880,1355058000"; d="scan'208";a="124428719"
Received: from unknown (HELO ipcdvi.tcif.telstra.com.au) ([10.97.217.212]) by ipoavi.tcif.telstra.com.au with ESMTP; 21 Mar 2013 10:20:09 +1100
X-IronPort-AV: E=McAfee;i="5400,1158,7020"; a="120153702"
Received: from wsmsg3751.srv.dir.telstra.com ([172.49.40.172]) by ipcdvi.tcif.telstra.com.au with ESMTP; 21 Mar 2013 10:20:09 +1100
Received: from WSMSG3153V.srv.dir.telstra.com ([172.49.40.159]) by WSMSG3751.srv.dir.telstra.com ([172.49.40.172]) with mapi; Thu, 21 Mar 2013 10:20:08 +1100
From: "Manger, James H" <James.H.Manger@team.telstra.com>
To: "David McGrew (mcgrew)" <mcgrew@cisco.com>, "Paterson, Kenny" <Kenny.Paterson@rhul.ac.uk>
Date: Thu, 21 Mar 2013 10:20:07 +1100
Thread-Topic: [Cfrg] AEAD_AES_x_CBC_HMAC_SHA_y as a MAC algorithm
Thread-Index: Ac4lL9NyQFK/uhfsRx+HrnkfaTBDmQAN60qAAA4JRYAABlT2MA==
Message-ID: <255B9BB34FB7D647A506DC292726F6E1150BBD92CD@WSMSG3153V.srv.dir.telstra.com>
References: <B132B06E59C4A540A03C3393F53BC07C40B94FE1@EXCH-MB01.cc.rhul.local> <747787E65E3FBD4E93F0EB2F14DB556B183ECBC3@xmb-rcd-x04.cisco.com>
In-Reply-To: <747787E65E3FBD4E93F0EB2F14DB556B183ECBC3@xmb-rcd-x04.cisco.com>
Accept-Language: en-US, en-AU
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
acceptlanguage: en-US, en-AU
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
Cc: IRTF CFRG <cfrg@irtf.org>
Subject: Re: [Cfrg] AEAD_AES_x_CBC_HMAC_SHA_y as a MAC algorithm
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <http://www.irtf.org/mailman/options/cfrg>, <mailto:cfrg-request@irtf.org?subject=unsubscribe>
List-Archive: <http://www.irtf.org/mail-archive/web/cfrg>
List-Post: <mailto:cfrg@irtf.org>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Subscribe: <http://www.irtf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Wed, 20 Mar 2013 23:20:12 -0000

> >> Question 1: Is HMAC over AAD-plus-random-IV better cryptographically
> >>than HMAC over just the AAD?
> >
> >No, there's no security advantage (that I know of) to having HMAC over
> >"AAD plus random IV" compared to HMAC over just the AAD.
> 
> Agreed.

> >> Question 2: Should draft-mcgrew-aead-aes-cbc-hmac-sha2 add a special
> >>case for when the plaintext is empty?
> >
> >I see the rationale of reducing overhead. Your proposal would also
> reduce
> >the randomness requirements of the scheme for this "MAC only" mode.
> >
> >But even so I'd prefer not to go down this route because of the
> potential
> >for confusion and mis-impementation. A single, clean design without
> too
> >many options feels better in that respect.
> >
> >While I don't see any security issues immediately, I'd also be
> concerned
> >about having a special case that might somehow interact badly with the
> >general case. Do you see anything troubling there?
> 
> I recognize both the motivation for reducing bandwidth and the concern
> about special cases that might inadvertently cause trouble.
> 
> If there are implementations that would use AEAD_CBC_HMAC as a MAC,
> then I
> think it makes sense to do the bandwidth optimization, *if* we can
> convince ourselves that there is no potential for badness on the
> decryption side.  It seems as though the change would come in Steps 2
> and
> 4 of Section 2.2 "Decryption", which would change to something like:
> 
>    2. If C contains exactly T_LEN octets, then S is the zero-length
>       String.  Otherwise, ...
> 
> ...
> 
>    4. If S is the zero-length string, then P is set to the zero-length
> string.
>       Otherwise, ...
> 
> 
> At Step 2 of Section 2.1 "Encryption", we would need to say "If P
> contains
> exactly zero octets, then S is the zero-length string; skip to step 5."
> 
> 
> It looks innocuous, but deserves more analysis I think.  My inclination
> is that we should only add this if there are plans to use the algorithm as
> a MAC.  Are there scenarios in which AEAD_CBC_HMAC would be available,
> but the underlying HMAC would not? I can see value in minimizing the number
> of entry points to a crypto implementation, but on the other hand, HMAC is
> already broadly available.
> 
> David

I suspect HMAC would always be available when AEAD_CBC_HMAC is. Lack of direct access to HMAC cannot motivate this change.

I had been thinking about the structures in JOSE (crypto in a web-friendly format, using JSON, not ASN.1). JOSE supports AEAD operations with a per-message key from a key agreement/exchange/wrap operation. JOSE also supports MACs with a pre-established secret key, but not with a per-message key. JOSE packages MAC functionality together with asymmetric digital signatures. An alternative approach would be to package MAC functionality as a subset of AEAD functionality, in which case AEAD_CBC_HMAC working efficiently as a MAC would be useful. 

[P.S. Another possibility would be to define HMAC as a pseudo-AEAD algorithm that only worked when there was no plaintext, only AAD (ie P_MAX = 0). RFC4543 "GMAC in IPsec ESP and AH" does a vaguely similar trick when defining ENCR_NULL_AUTH_AES_GMAC.]

David’s changes do look small and innocuous so I am very tempted to say "yes please, let’s make those changes". I suspect the right solution for JOSE, though, is to have AEAD and MAC operations as separate explicitly-supported "first-class citizens": separate from asymmetric signatures; and separate from a key agreement/exchange/wrap step. My inclination now is not to the change draft-mcgrew-aead-aes-cbc-hmac-sha2. Thankyou for the considering the idea.

--
James Manger