Re: [Cfrg] new authenticated encryption draft

David McGrew <mcgrew@cisco.com> Tue, 12 September 2006 19:59 UTC

Received: from [127.0.0.1] (helo=stiedprmman1.va.neustar.com) by megatron.ietf.org with esmtp (Exim 4.43) id 1GNEPk-0006wH-1r; Tue, 12 Sep 2006 15:59:24 -0400
Received: from [10.91.34.44] (helo=ietf-mx.ietf.org) by megatron.ietf.org with esmtp (Exim 4.43) id 1GNEPi-0006wC-S9 for cfrg@ietf.org; Tue, 12 Sep 2006 15:59:22 -0400
Received: from sj-iport-2-in.cisco.com ([171.71.176.71] helo=sj-iport-2.cisco.com) by ietf-mx.ietf.org with esmtp (Exim 4.43) id 1GNEPH-0002uq-HF for cfrg@ietf.org; Tue, 12 Sep 2006 15:59:22 -0400
Received: from sj-dkim-2.cisco.com ([171.71.179.186]) by sj-iport-2.cisco.com with ESMTP; 12 Sep 2006 12:58:55 -0700
X-IronPort-AV: i="4.09,155,1157353200"; d="scan'208"; a="341069611:sNHT37836146"
Received: from sj-core-2.cisco.com (sj-core-2.cisco.com [171.71.177.254]) by sj-dkim-2.cisco.com (8.12.11.20060308/8.12.11) with ESMTP id k8CJwsnG004782; Tue, 12 Sep 2006 12:58:54 -0700
Received: from xbh-sjc-231.amer.cisco.com (xbh-sjc-231.cisco.com [128.107.191.100]) by sj-core-2.cisco.com (8.12.10/8.12.6) with ESMTP id k8CJwsYp009989; Tue, 12 Sep 2006 12:58:54 -0700 (PDT)
Received: from xfe-sjc-212.amer.cisco.com ([171.70.151.187]) by xbh-sjc-231.amer.cisco.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 12 Sep 2006 12:58:54 -0700
Received: from [192.168.1.100] ([10.32.254.211]) by xfe-sjc-212.amer.cisco.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 12 Sep 2006 12:58:53 -0700
In-Reply-To: <f207274d0609111132w655f9b7er2e55c20e67973da5@mail.gmail.com>
References: <74A5A0C3-8E6E-47B4-A67B-C51ED97B2897@mindspring.com> <da7b3ce30608201147u12c0c2f6s61694713e59cfa4a@mail.gmail.com> <p06230910c10e98a55c4c@10.30.1.9> <f207274d0608221905t2797ca6ew2a769dd5d9e3d410@mail.gmail.com> <3D640F53-58F3-4AE4-AEFC-145BBD9BC9A0@cisco.com> <f207274d0609011652m3bb76587xdd6cd9e1d3140e63@mail.gmail.com> <7BA4156B-14B4-4BB1-BEAD-2237F5B3834D@cisco.com> <f207274d0609111132w655f9b7er2e55c20e67973da5@mail.gmail.com>
Mime-Version: 1.0 (Apple Message framework v752.2)
Content-Type: text/plain; charset="US-ASCII"; delsp="yes"; format="flowed"
Message-Id: <1C7CA0AE-3BCC-437B-891F-0D2831BFBFBC@cisco.com>
Content-Transfer-Encoding: 7bit
From: David McGrew <mcgrew@cisco.com>
Subject: Re: [Cfrg] new authenticated encryption draft
Date: Tue, 12 Sep 2006 12:58:50 -0700
To: John Wilkinson <wilkjohn@gmail.com>
X-Mailer: Apple Mail (2.752.2)
X-OriginalArrivalTime: 12 Sep 2006 19:58:53.0777 (UTC) FILETIME=[DFB50C10:01C6D6A5]
DKIM-Signature: a=rsa-sha1; q=dns; l=12353; t=1158091134; x=1158955134; c=relaxed/simple; s=sjdkim2002; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=mcgrew@cisco.com; z=From:David=20McGrew=20<mcgrew@cisco.com> |Subject:Re=3A=20[Cfrg]=20new=20authenticated=20encryption=20draft; X=v=3Dcisco.com=3B=20h=3DbEwS0oJgdOC6R0v1cvsFzhF5aNU=3D; b=zOAXyA2j70pJhTezSpVyq4Xso2s1WZxAJPHn1V4ER0NbdH9VNQDN/tWbQAbdb6BXR3Ue42LA svGqpyUg7dJsejTyABzDo7EiUPmkskfsv7d1mJQt6Zr3Vp8uVj2i372r;
Authentication-Results: sj-dkim-2.cisco.com; header.From=mcgrew@cisco.com; dkim=pass ( sig from cisco.com verified; );
X-Spam-Score: 0.0 (/)
X-Scan-Signature: 025f8c5000216988bfe31585db759250
Cc: cfrg@ietf.org
X-BeenThere: cfrg@ietf.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.ietf.org>
List-Unsubscribe: <https://www1.ietf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@ietf.org?subject=unsubscribe>
List-Post: <mailto:cfrg@ietf.org>
List-Help: <mailto:cfrg-request@ietf.org?subject=help>
List-Subscribe: <https://www1.ietf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@ietf.org?subject=subscribe>
Errors-To: cfrg-bounces@ietf.org

Hi John,

thanks again for your comments.

On Sep 11, 2006, at 11:32 AM, John Wilkinson wrote:

> David,
>
> I have read your draft more carefully now, and I see that you have
> specified both "deterministic" and "random" AEAD schemes. In the case
> of an encryption operation where the "IV" is generated randomly,
> obviously it must be returned to the user so that it can be passed
> along to the decryption operation. May I ask the purpose of specifying
> algorithms with random (non-deterministic) IVs? Are there any cases
> where this is truly necessary?
>

Yes, there are several cases where a random IV is useful because it  
is difficult to use a unique IV.  These cases should have been  
mentioned in the draft.

When a key is used over a time period that extends across multiple  
restarts of a device, a provision must be made in order to ensure  
that a deterministic IV maintains its uniqueness across all of those  
restarts.  This can be done, for instance, by periodically  
checkpointing the IV value into non-volatile memory.  However,  
checkpointing is a non-trivial process, and many encryption systems  
do not already contain facilities to support it.  There are also  
systems with limited non-volatile memory capabilities, in which it is  
difficult or undesirable to frequently write new values into memory.

When a single key is used by multiple encryptors, a unique IV needs  
to have a distinct IV contribution for each encryptor.  In some  
cases, it may not be convenient for the encryptors to coordinate  
among themselves to agree on the values of the IV contribution.   It  
is undesirable to rely on human coordination, and automated systems  
may not be available.  For example, consider the case in which there  
is a cluster of devices that share an encryption key in order to  
provide a load balancing or failover capability.  When a  
deterministic IV is used with that key, the cluster must provide  
distinct IV contributions, or it must carefully coordinate the IV  
usage in some other way.  When a random IV is used by encryption  
process, this need for additional coordination goes away.


> It seems that in the example you give in section 5.3 (generic
> composition of AES-CBC encryption and HMAC-SHA1 authentication),
> randomness isn't really required for security. It suffices to have the
> IV be unpredictable to the attacker, which could be easily
> accomplished deterministically by the following (using your notation):
>
> IV = leftmost(HMAC_SHA1(K, "IV" | IV_contribution), 128);
>
> Where the user's IV_contribution is concatenated with the string "IV"
> to form the message to be MACed. More elegant formulations of
> generating ENC_KEY, MAC_KEY, and IV are also possible.
>
> It seems to me that this method of deterministically generating IV's
> is likely to be more reliable than relying on any external source of
> randomness. As long as the IV contribution from the user is a "number
> used once" (nonce), this AEAD scheme is secure in the sense of
> IND-CCA2 (assuming that AES is IND-CPA, etc.). Is there any reason to
> prefer the random IV formulation? If not, I would recommend removing
> the non-deterministic algorithms from your specification, removing the
> requirement to return the (now deterministically generated) IV to the
> user, and removing the requirement that the IV contribution be used
> "verbatim". I too value simplicity and ease of use in crypto
> algorithms, and requiring that all AEAD algorithms conforming to this
> specification accept a nonce for both encryption and decryption, and
> dispensing with non-determinism and having to keep track of separate
> IVs and IV contributions seems simpler and more robust, at least to me
> anyway.
>
> -John
>
> P.S. If no one else has pointed it out yet, your specification for
> AEAD_AES_256_HMAC_SHA1 in section 5.3.2 isn't quite complete, since it
> fails to explain how one generates a 256-bit AES key from HMAC-SHA1.
> (One can, of course, imagine many ways of doing this, but it should be
> spelled out.) Also, if the keys and IVs were generated pseudorandomly
> using HMAC-SHA1, should that be considered to have "a cryptographic
> strength equivalent to that of AES-256"?

Thanks; some others have pointed it out as well.  Jack Lloyd  
suggested using something like IEEE 1363's KDF2, which is essentially  
SHA1 in counter mode.  It would be FIPS-140-2 compliant, which is  
appealing.

David

>
> On 9/6/06, David McGrew <mcgrew@cisco.com> wrote:
>> Hi John,
>>
>> On Sep 1, 2006, at 4:52 PM, John Wilkinson wrote:
>>
>> > David (McGrew),
>> >
>> > I understand and accept your rationale for placing "IV" generation
>> > under the control of the AEAD algorithm. It was clear to me from  
>> the
>> > first draft, though your revised language is even more explicit. I
>> > think it's a good idea for precisely the reasons you state.  
>> However,
>> > two things I do not agree with are:
>> >
>> > 1) Requiring that the IV be an *output* of the encryption  
>> algorithm,
>> > rather than a value only used internally to the algorithm. What  
>> is the
>> > purpose of making it an output? Is it not simpler to require the  
>> input
>> > of a nonce to the encryption algorithm, and the input of the same
>> > nonce to the decryption algorithm? I see no need to make the  
>> internal
>> > workings of the algorithm (including the IV) visible to the  
>> user. GCM,
>> > to pick an example you are undoubtedly familiar with, does not  
>> return
>> > the IV to the user, so why require it here?
>>
>> it's returned so that the user can send the IV along with the
>> ciphertext and tag.  When it is the encryption algorithm rather than
>> the user that's generating the IV, the user needs to be told that  
>> value.
>>
>> >
>> > 2) Requiring that the "IV contribution" be included "verbatim"  
>> in the
>> > (preferably internal) IV of the algorithm. I would remove this
>> > language entirely. It is unclear what "verbatim" means in this
>> > context, and I think the requirement is counterproductive.
>>
>> Yeah, others have told me that "verbatim" is confusing too.  What I'd
>> meant was that the IV contribution must appear as part of the IV,
>> e.g. as the prefix or as the suffix, or as some other contiguous sub-
>> sequence of bits.
>>
>> > As long as
>> > the user supplies a nonce, and the algorithm creates from that  
>> nonce
>> > an internal IV, the form of that IV shouldn't be restricted. Again,
>> > GCM does not use the user-supplied "IV contribution" (nonce)  
>> directly
>> > (verbatim?) when the nonce is other than 96-bits long, so why  
>> should
>> > you be more restrictive here?
>>
>> I think that crypto modules should trade off some flexibility for
>> some usability.  The idea is that an AEAD module as defined in the
>> spec is harder to misue, and easier to test and to validate, than a
>> module that implements a set of block cipher modes or other lower
>> level primitives.
>>
>> I'll rewrite the draft and try to make the situation w.r.t. the IV
>> and IV Contribution more clear, over the next week or so.  I'll value
>> your thoughts on the new text.
>>
>> David
>>
>> >
>> > -John
>> >
>> > On 8/28/06, David McGrew <mcgrew@cisco.com> wrote:
>> >> Hi John,
>> >>
>> >> On Aug 22, 2006, at 7:05 PM, John Wilkinson wrote:
>> >> >
>> >> > David, while I've only briefly skimmed your draft, Hal and  
>> Gregg's
>> >> > comments make me wonder about the way you're treating IVs in  
>> your
>> >> > specification.
>> >>
>> >> I've heard from others that the motivation for why IVs are  
>> handled in
>> >> the document is not clear.  Thanks for your comments; I clearly  
>> have
>> >> more explaining to do :-)
>> >>
>> >> > Why do you feel that IVs must be an _output_ of the
>> >> > encryption algorithm, rather than a purely internal value?
>> >>
>> >> There is a rationale given in Section 2, but I'll try to  
>> amplify it -
>> >> here's a rewrite of that part.  Please let me know what you think.
>> >>
>> >> <new>
>> >> Rationale.  Proper IV generation is a crucial for security, and  
>> the
>> >> requirements on how IVs are generated are different for different
>> >> algorithms.  By making the IV an output of the AEAD algorithm  
>> rather
>> >> than an input, the IV is put under the control of that algorithm.
>> >> This use of the 'information hiding' design principle frees the  
>> user
>> >> from needing to understand the particulars of IV generation, thus
>> >> making the interface easier to use correctly.  Also, because IV
>> >> generation is a security-critical operation, it makes sense to
>> >> include it with the algorithm, which will typically be  
>> implemented in
>> >> a crypto module.  Including IV generation in this module makes it
>> >> more self-contained and easier to test and to validate.
>> >>
>> >> Several security issues have arisen due to improper use of block
>> >> cipher modes of operation.  Several standards have suggested
>> >> incorrect uses of cipher block chaining (CBC) encryption (e.g.  
>> using
>> >> a previous ciphertext block as an IV, which allows an adversary to
>> >> predict the IV).  Modes that require distinct IVs, such as counter
>> >> mode, are especially sensitive to misuse of IVs, which can void  
>> the
>> >> security services that they provide.  Giving the AEAD algorithm  
>> the
>> >> responsibility for generating its own IV helps to avoid these
>> >> security issues.
>> >> </new>
>> >>
>> >> > Further,
>> >> > what, exactly, do you mean by the requirement that "A  
>> deterministic
>> >> > AEAD encryption algorithm MUST accept an additional input,  
>> and that
>> >> > value [the IV contribution] MUST be included _verbatim_  
>> [emphasis
>> >> > added] in the IV."
>> >>
>> >> Several crypto algorithms, including CCM and GCM as used in  
>> ESP, form
>> >> their IVs by prepending a value that is fixed (for the lifetime of
>> >> the key) to a sequence number that increments once per packet.   
>> The
>> >> IV contribution is needed in order to support these algorithms,  
>> and
>> >> it is needed in order to allow CTR-based modes (like CCM, GCM, and
>> >> EAX) to be useable in a situation in which there are multiple  
>> devices
>> >> doing encryption with a single key.  The IV contribution  
>> provides a
>> >> place within which each encryptor can put a distinct value, to  
>> ensure
>> >> that the IVs are distinct over all uses of that key.
>> >>
>> >> >
>> >> > It seems to me that it would be a better abstraction of the AEAD
>> >> > mechanism if the IV is used purely internally to the  
>> algorithm, so
>> >> > that the only input required is a nonce, and that the same  
>> nonce is
>> >> > used for encryption and decryption.
>> >>
>> >> Here we've gotten stuck on the terminological thicket.  What  
>> you're
>> >> calling a nonce is what the draft calls an IV.  I should add
>> >> definitions I guess.
>> >>
>> >> > Furthermore, the requirement that
>> >> > the "IV contribution" must be used "verbatim" in the IV could be
>> >> read
>> >> > to exclude, for example, Bellare, Rogaway, and Wagner's EAX
>> >> mode. EAX
>> >> > uses a user-supplied nonce, which may be of any length, and
>> >> computes a
>> >> > MAC on this nonce to generate the initial counter for counter- 
>> mode
>> >> > encryption.
>> >> >
>> >>
>> >> The GCM mode of operation has the same property (it will accept  
>> an IV
>> >> of any length, though it is optimized to handle 96-bit IVs).
>> >> However, there does not seem to be any significant use for this
>> >> facility in practice, so I decided to use a simpler and more
>> >> consistent interface for the AEAD algorithms.  EAX could  
>> certainly be
>> >> added, but obviously we'd need to mandate a particular IV format.
>> >>
>> >> David
>> >>
>> >
>> > _______________________________________________
>> > Cfrg mailing list
>> > Cfrg@ietf.org
>> > https://www1.ietf.org/mailman/listinfo/cfrg
>>
>
> _______________________________________________
> Cfrg mailing list
> Cfrg@ietf.org
> https://www1.ietf.org/mailman/listinfo/cfrg

_______________________________________________
Cfrg mailing list
Cfrg@ietf.org
https://www1.ietf.org/mailman/listinfo/cfrg