Re: [COSE] COSE Support for AES-CTR and AES-CBC

Russ Housley <housley@vigilsec.com> Sat, 05 November 2022 15:35 UTC

Return-Path: <housley@vigilsec.com>
X-Original-To: cose@ietfa.amsl.com
Delivered-To: cose@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 501CCC14F725 for <cose@ietfa.amsl.com>; Sat, 5 Nov 2022 08:35:26 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.906
X-Spam-Level:
X-Spam-Status: No, score=-6.906 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0tl6j5VpPWgc for <cose@ietfa.amsl.com>; Sat, 5 Nov 2022 08:35:22 -0700 (PDT)
Received: from mail3.g24.pair.com (mail3.g24.pair.com [66.39.134.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 15D9EC14F718 for <cose@ietf.org>; Sat, 5 Nov 2022 08:35:22 -0700 (PDT)
Received: from mail3.g24.pair.com (localhost [127.0.0.1]) by mail3.g24.pair.com (Postfix) with ESMTP id A4A8013A554; Sat, 5 Nov 2022 11:35:20 -0400 (EDT)
Received: from [10.0.1.2] (pfs.iad.rg.net [198.180.150.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail3.g24.pair.com (Postfix) with ESMTPSA id C2EB513A86B; Sat, 5 Nov 2022 11:35:19 -0400 (EDT)
From: Russ Housley <housley@vigilsec.com>
Message-Id: <9843ACD7-DD93-49AC-BAC5-14E3CAB21E0E@vigilsec.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_ABE6EDBA-E859-4554-9562-EE8C60DE5AD0"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\))
Date: Sat, 05 Nov 2022 11:35:18 -0400
In-Reply-To: <CAEEbLAb4eBq3HZD7dqCY0R6r0YdAcmgEJPH_cEtseZ4wsJx8Mg@mail.gmail.com>
Cc: David Brown <david.brown@linaro.org>, Stephen Farrell <stephen.farrell@cs.tcd.ie>, Hannes Tschofenig <Hannes.Tschofenig@arm.com>, "Arciszewski, Scott" <scottarc@amazon.com>, "Zundel, Brent" <brent.zundel@avast.com>, "cose@ietf.org" <cose@ietf.org>
To: Sophie Schmieg <sschmieg@google.com>
References: <CAGi82uNOmJJdO2HKcE8M491Vv_PLgk8J8vvfsEE88CMZkmALmw@mail.gmail.com> <a69db82e96374a36b1f7164da3c5556e@amazon.com> <CAEEbLAZXLmvQbXkdqJcO2erQLVBic3gfuGPv8XRTSxZRiAaAvQ@mail.gmail.com> <DBBPR08MB59154655A83674320C831E32FA329@DBBPR08MB5915.eurprd08.prod.outlook.com> <a14fb861-5575-1896-0636-478148062562@cs.tcd.ie> <93270E49-2197-433A-A5A0-C8484ED26BE5@vigilsec.com> <Y1vq7ezTZ+/TeELE@davidb.org> <CAEEbLAb4eBq3HZD7dqCY0R6r0YdAcmgEJPH_cEtseZ4wsJx8Mg@mail.gmail.com>
X-Mailer: Apple Mail (2.3445.104.21)
X-Scanned-By: mailmunge 3.10 on 66.39.134.11
Archived-At: <https://mailarchive.ietf.org/arch/msg/cose/sKcM2blEm2wFqTCbm6fOBI-TRTM>
Subject: Re: [COSE] COSE Support for AES-CTR and AES-CBC
X-BeenThere: cose@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: CBOR Object Signing and Encryption <cose.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cose>, <mailto:cose-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cose/>
List-Post: <mailto:cose@ietf.org>
List-Help: <mailto:cose-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cose>, <mailto:cose-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 05 Nov 2022 15:35:26 -0000

Sophie:

I fully understand the benefits of an AEAD.  I am one of the co-authors of AES-CCM.

That said, there is a size and performance concern in the bootloader.  We need to find a way to accommodate.  You and others seem to have fewer concerns with AES-CTR because there is no padding.  Frankly, the lack of expansion makes AES-CTR a better fit in most firmware encryption situations.

Perhaps dropping AES-CBC from this draft is a reasonable way forward.  What do you think?

Russ

> On Oct 31, 2022, at 3:30 PM, Sophie Schmieg <sschmieg=40google.com@dmarc.ietf.org> wrote:
> 
> I'd like to note that with firmware in particular, we will soon have to switch to hash based signature schemes in order to gain post-quantum readiness (firmware usually uses fixed signing keys, so this transition needs to happen soon and it needs to use hash based solutions to avoid parameter drift), where the signature is 1KB in the "best" case (this corresponds to stateful hash based signatures, RFC 8554 and RFC 8391, I put "best" in quotation marks because statefulness comes with its own challenges), and 8KB in the easier to use case (the stateless scheme Sphincs+ [1], currently being standardized by NIST), so the devices will need to be able to tolerate a substantial amount of overhead already, so that the 16 byte per chunk tags are less likely to be an issue in any case.
> 
> You mention that the signature is checked over the plaintext, and not over the ciphertext. This should immediately rule out CBC mode, as we would still suffer from CBC padding oracle problems, bypassing the encryption in that case. With CTR mode, this scheme is, if looked at in isolation, secure, although it would adversely affect the rest of the COSE ecosystem, for saving what is a fairly minuscule overhead of 16 bytes per chunk (with chunks being able to be several KB in size) for a use case that is as far as I can tell a DRM scheme (which usually do not rely on standardized approaches, as obfuscation is a major part of DRM).
> 
> [1] https://sphincs.org/ <https://sphincs.org/>
> On Fri, Oct 28, 2022 at 7:45 AM David Brown <david.brown@linaro.org <mailto:david.brown@linaro.org>> wrote:
> On Fri, Oct 28, 2022 at 10:21:30AM -0400, Russ Housley wrote:
> 
> > > For this purpose ciphers without integrity protection are used to
> > >   encrypt the firmware image.  Integrity protection for the firmware
> > >   image must, however, be provided and the the suit-parameter-image-
> > >   digest, defined in Section 8.4.8.6 of [I-D.ietf-suit-manifest], MUST
> > >   be used.
> > > 
> > > I'm not convinced by that. Why couldn't you just store
> > > the tag for each chunk wherever the signature is stored?
> > > 
> > > Overall, I'd say defining non-AEAD modes doesn't seem
> > > like a good trade-off.
> 
> > AES-CCM and AES-GCM require the authentication check to be performed
> > before any plaintext is returned.  So, one would have to have a
> > separate tag for each storage block, which adds a lot of overhead
> > and complexity, especially since there is already a digital
> > signature over the whole thing.
> 
> In the case described, there simply isn't storage space for a tag per
> block.  This use case performs a full signature check on the image
> before making use of it, as Russ mentions.
> 
> In the firmware update case, the system needs to be able to verify the
> signature of the image, even after the image has been decrypted, there
> has to be a signature that covers the entire plaintext.  Additional
> space for tags would reduce the space available for the firmware
> itself.  The decryption happens during an image upgrade state.  Any
> attack that results in modified plaintext would prevent the firmware
> from running, as the signature check would fail.
> 
> The goal here is to make these algorithms available for a use-case
> where they are already being used, and significant resource
> constraints make other solutions unavailable.  We would like to be
> able to register these algorithms in such a way that it is clear that
> they should not be adopted for any new use, while at the same time
> capturing this existing use case.
> 
> David
> 
> 
> -- 
> 
> Sophie Schmieg | Information Security Engineer | ISE Crypto | sschmieg@google.com <mailto:sschmieg@google.com>
> 
> _______________________________________________
> COSE mailing list
> COSE@ietf.org
> https://www.ietf.org/mailman/listinfo/cose