Re: [Cfrg] AEAD_AES_x_CBC_HMAC_SHA_y as a MAC algorithm

"David McGrew (mcgrew)" <mcgrew@cisco.com> Wed, 20 March 2013 18:18 UTC

Return-Path: <mcgrew@cisco.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 19F7611E80D1 for <cfrg@ietfa.amsl.com>; Wed, 20 Mar 2013 11:18:12 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -110.599
X-Spam-Level:
X-Spam-Status: No, score=-110.599 tagged_above=-999 required=5 tests=[AWL=0.000, BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8, USER_IN_WHITELIST=-100]
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 K17MPoi9kzdU for <cfrg@ietfa.amsl.com>; Wed, 20 Mar 2013 11:18:10 -0700 (PDT)
Received: from rcdn-iport-4.cisco.com (rcdn-iport-4.cisco.com [173.37.86.75]) by ietfa.amsl.com (Postfix) with ESMTP id BD78311E80A6 for <cfrg@irtf.org>; Wed, 20 Mar 2013 11:18:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=4162; q=dns/txt; s=iport; t=1363803490; x=1365013090; h=from:to:cc:subject:date:message-id:in-reply-to: content-id:content-transfer-encoding:mime-version; bh=pJlxGq/Y550qd2poji1klRVljKU7otSczFZFp4id30Y=; b=RfpQzgIsFD0l0bogy7YovvHgByUPWiH4roBE7rrD6fbJJ8rF6iMDf/Y9 orAajyJ8nO4woQrmUtOSPywhkndqdy8hrIdijWRJLNcoc/4pkz+Dw7qjv kGMWdWLoK+mLNqx2u+SFw71m/GdtnH82hndPMwDI74BZSjE/rUsdbMSAe 8=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AgEFACP8SVGtJV2b/2dsb2JhbABEDsUTgVIWdIIkAQEBBAEBATc0CxIBCBgKFDcLJQEBBA4FCAGICwzCTIw8giIGKweCX2EDoEyHFoJLP4Io
X-IronPort-AV: E=Sophos;i="4.84,880,1355097600"; d="scan'208";a="189683125"
Received: from rcdn-core-4.cisco.com ([173.37.93.155]) by rcdn-iport-4.cisco.com with ESMTP; 20 Mar 2013 18:18:09 +0000
Received: from xhc-rcd-x04.cisco.com (xhc-rcd-x04.cisco.com [173.37.183.78]) by rcdn-core-4.cisco.com (8.14.5/8.14.5) with ESMTP id r2KII9ju026431 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Wed, 20 Mar 2013 18:18:09 GMT
Received: from xmb-rcd-x04.cisco.com ([169.254.8.112]) by xhc-rcd-x04.cisco.com ([173.37.183.78]) with mapi id 14.02.0318.004; Wed, 20 Mar 2013 13:18:08 -0500
From: "David McGrew (mcgrew)" <mcgrew@cisco.com>
To: "Paterson, Kenny" <Kenny.Paterson@rhul.ac.uk>, "Manger, James H" <James.H.Manger@team.telstra.com>
Thread-Topic: [Cfrg] AEAD_AES_x_CBC_HMAC_SHA_y as a MAC algorithm
Thread-Index: Ac4lL9NyQFK/uhfsRx+HrnkfaTBDmQAN60qAAA4JRYA=
Date: Wed, 20 Mar 2013 18:18:08 +0000
Message-ID: <747787E65E3FBD4E93F0EB2F14DB556B183ECBC3@xmb-rcd-x04.cisco.com>
In-Reply-To: <B132B06E59C4A540A03C3393F53BC07C40B94FE1@EXCH-MB01.cc.rhul.local>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
user-agent: Microsoft-MacOutlook/14.2.1.120420
x-originating-ip: [10.117.10.227]
Content-Type: text/plain; charset="us-ascii"
Content-ID: <50EEA2CC5A824C458163FCA697A157A2@emea.cisco.com>
Content-Transfer-Encoding: quoted-printable
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 18:18:12 -0000

Hi James and Kenny,

On 3/20/13 8:36 AM, "Paterson, Kenny" <Kenny.Paterson@rhul.ac.uk> wrote:

>Hi James,
>
>Good questions. My personal view in-line. I'll be interested in hearing
>David's viewpoint.
>
>On 20 Mar 2013, at 05:57, Manger, James H wrote:
>
>> If you pass additional data (AAD), but no plaintext, to the GCM AEAD
>>algorithm you effectively get a MAC algorithm. It even has a name: GMAC.
>
>Indeed, and it's even standardised in various places :-)
>
>> 
>> Presumably it is equally trivial to create a MAC algorithm from any
>>AEAD algorithm.

Agreed.   

>> 
>> You can do this with the AEAD_AES_x_CBC_HMAC_SHA_y algorithms in
>>draft-mcgrew-aead-aes-cbc-hmac-sha2-01. However, the output is a 16-byte
>>IV, 16-byte ciphertext (encrypting a block of padding), and the
>>truncated HMAC output. This is 32 bytes more than a straight HMAC of the
>>AAD.

Yes, good observation.

>> 
>> 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.

> 
>
>> 
>> When defining a secure message format a tempting simplification is to
>>only define how to use an AEAD algorithm. Then if a particular message
>>doesn't need confidentiality just put the content into the AAD field and
>>leave the plaintext empty. This approach is less attractive if using an
>>AEAD algorithm in "MAC mode" incurs an unnecessary 32-byte overhead over
>>a dedicated MAC mode.
>> 
>> Question 2: Should draft-mcgrew-aead-aes-cbc-hmac-sha2 add a special
>>case for when the plaintext is empty?
>> If the answer to Q1 is "No", the special case might be "when the
>>plaintext is empty: set the IV to all zeros; and the output is just the
>>truncated hash (C = T), omitting the IV and ciphertext". Alternatively,
>>the special case might just involve HMAC, with no AES operations.
>> If the answer to Q1 is "Yes", the special case might be "when the
>>plaintext is empty: the output is C = IV || T, omitting the encrypted
>>padding".
>
>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


>
>Cheers,
>
>Kenny
>_______________________________________________
>Cfrg mailing list
>Cfrg@irtf.org
>http://www.irtf.org/mailman/listinfo/cfrg