Re: [CFRG] Use of AEAD algorithms as pure encryption algorithms

John Mattsson <john.mattsson@ericsson.com> Sat, 22 April 2023 07:12 UTC

Return-Path: <john.mattsson@ericsson.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 54D4AC14CE40; Sat, 22 Apr 2023 00:12:08 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.998
X-Spam-Level:
X-Spam-Status: No, score=-1.998 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, HTTPS_HTTP_MISMATCH=0.1, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=ericsson.com
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 4jIS1WMEn7QF; Sat, 22 Apr 2023 00:12:03 -0700 (PDT)
Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on061d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::61d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A85EEC14CE38; Sat, 22 Apr 2023 00:12:02 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DMmxndO4pRgFGRp/Nd/27zlqjPaWFzcW4lCTQL4v0rIWvlvB/z3PE9KGXwNVkzwehQ/ENwm2R+OvRlCHy8APj4lLlUSdiyE6R1qGYGxMAVuqV7C42Q9habMue4B1gUoXLeUQ42Y9n+eVW9xjOKvuEjuRRbdTsjEu+m++1gRx+vEbQjO6/vtPef4OZdy0l0NabKzd7CC16F45RNipz/2GU4Ovc/JDMtcKgv1rN1qgFKv7PXuBXAi72ki1qLedQhKLuZVKCSEE6e3PJGZYifeOsO4UQX+x4j+aiOqedeQcUgd+QEhsZR2qDNlsMgA94gBGH6pGm0fau2E9MmR0f6gUwQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3EE2oU7a6VrxhM9j7epIBC9HidtaATa3AIbxjYWfw1g=; b=HuCgz1G7Az35xosItAUebY4GonPTIbIvCjRrcMbUmUx8bJOxNnGvPkTjGzNNb7QTIKqE8huwMyfc4vWF6pfq8LYh9EwVL3jkeMEa/xGjHdLfhERDE6S34eb9HxpzTLHOmY24Subrv7uZKji+rIR5yDerNZP0t5VFBXoWVQeJgcVwwNb/u1RoOD+MT6f11mLUSM7KAzlFFs7uMQfAZyeqDYK0YQceaXkzOeVVHedreBW4FLB1RvCx3t4RKNysDLq/J0E1LnVzemOohOrO18KA8Dv/8rTcmfztVz2A6Br1u/e/izKGqiZeLgDx5gQ/vwsX8r68mNGaPhWmc4oxRp75ow==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ericsson.com; dmarc=pass action=none header.from=ericsson.com; dkim=pass header.d=ericsson.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3EE2oU7a6VrxhM9j7epIBC9HidtaATa3AIbxjYWfw1g=; b=ZtLkkCZbTqy5UpXlELYehdjQw9jJTE7jorRqnMo71bjnVq32/kPYPBb1c3pGUrd0MCYTJIK2naRtzzgfiv+IlErjb51LoPIj0fnKyK8h2CQYUs0aOBJ+6ghO+mWajWquwXnsJnL4cLaEoEXtH8iQFT7pYao4kiiESxdF4Xdag1A=
Received: from GVXPR07MB9678.eurprd07.prod.outlook.com (2603:10a6:150:114::10) by AS8PR07MB7799.eurprd07.prod.outlook.com (2603:10a6:20b:396::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.28; Sat, 22 Apr 2023 07:11:53 +0000
Received: from GVXPR07MB9678.eurprd07.prod.outlook.com ([fe80::47af:87d7:c8ce:1957]) by GVXPR07MB9678.eurprd07.prod.outlook.com ([fe80::47af:87d7:c8ce:1957%6]) with mapi id 15.20.6319.022; Sat, 22 Apr 2023 07:11:52 +0000
From: John Mattsson <john.mattsson@ericsson.com>
To: Valery Smyslov <smyslov.ietf@gmail.com>, 'Natanael' <natanael.l@gmail.com>
CC: "cfrg@ietf.org" <cfrg@ietf.org>, 'IPsecME WG' <ipsec@ietf.org>
Thread-Topic: [CFRG] Use of AEAD algorithms as pure encryption algorithms
Thread-Index: AQHZdCURJKzUgNfJf02ZwLzzcgEDv6824vHk
Date: Sat, 22 Apr 2023 07:11:51 +0000
Message-ID: <GVXPR07MB9678D4283BB499A153728DEA89619@GVXPR07MB9678.eurprd07.prod.outlook.com>
References: <083b01d9735b$97767000$c6635000$@gmail.com> <CAAt2M1_rMBKoEZENQuz8FzJYZTp-3K=dEXaptYEkqfSjs_WnJA@mail.gmail.com> <090901d97424$fd80c660$f8825320$@gmail.com>
In-Reply-To: <090901d97424$fd80c660$f8825320$@gmail.com>
Accept-Language: en-US
Content-Language: en-GB
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ericsson.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: GVXPR07MB9678:EE_|AS8PR07MB7799:EE_
x-ms-office365-filtering-correlation-id: 659fefdc-c56a-40d1-d009-08db4300d8bc
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: F5UqXiVLvfINfd91Jro/ExJGWpx6e7iw0CI3dusYs4d8KHV5ZalH4G41QfZcrjc5U8BYSOQJlpJbruwIvTIGLF3o4iS0Gmh7gS58RzW5EiteLirC6h/wAZWnmOvFwwqr2q1+1A9EszpaL/6oYqCe2djRxRuacBFOcLuGELadz/l65e0qkfKK76Ck4ENKOwrGbqlXbYLzSaESQxwjplgpdz46Xrw+pDoW9vPap3M/7p0ybAdV1MvnPg+NI/jvSy0CkJ2BDChgPcWFMhkv7U7xY05FVYwhWnajm/sqQZi2JJ9gldXz0wbN3zw9kkApp/ZYuAg15eS2sHTlVY3e8b0a3BYFTQrF2rn3/MkzTnun3E/ErMywrjJ3fOCsYQg1cJtjOdhQb9+h9hBWMvWxCBxr2otWdy+IHWqH8FMmObq/wwBottk++eQASFIBZDliNpPgF+HVkDyHJ1to9GqPIy5nMj1g4pVgaH2hc8Na+0v9mWuinS+ETcYjIMXL5S2hyUtPyzYtDy1fjtQFwvt799G3dl7iYRevX14p/Wx6dVMZqBxRv6EnBKCm/mdMEeeSB+hAJcYn4pt4B4Uinn76R05HvSGXzhXTt3wXxuh6pdYpsKyeVW6RsDUDb19m23DtME75lHSaVhc3jMbfJn2DcPMtfg==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:GVXPR07MB9678.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(346002)(39860400002)(396003)(136003)(366004)(451199021)(44832011)(52536014)(110136005)(5660300002)(54906003)(478600001)(8676002)(8936002)(86362001)(122000001)(38100700002)(2906002)(316002)(33656002)(71200400001)(7696005)(76116006)(66946007)(66446008)(64756008)(41300700001)(4326008)(66476007)(66556008)(38070700005)(166002)(6506007)(9686003)(26005)(53546011)(966005)(186003)(82960400001)(55016003)(83380400001); DIR:OUT; SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: 6ecVN721Q4GKMJ6lcIaf7UjzYT3GiyLG6hDYJsbhGPwa8o2JJ/e88rfOK5zgvADpTuObF6S+/IDuPJoPkSVqVNX322NCMQSppnELO8TsEc/+NvFAC+O/OigLVwA2AqvVcr/A69Y9cIdvihwByyNyMAqZJUrVMVC+EC2e5pgEXeId8Eyfm/rnCR9/OLmTSJDwXmwwXKar/f2zfQGniu86exyU2a08mwZhwfHM0bEooSVAcyuLh8CnA3/521qqObppVtSJdgCr3uN/HXhYOi33emkWA7Fm0moAx+MUOuCQUsS0FkxRXqCrzrcvs5tZ9PobWLyHVreEtQUgaPicNhPG9NYIxfBgmMxJt2r65BoAm9qoM9l9qrlnYVmcjodRFVWRwZM8e4W+Sd1jOsa8Hr9QFmo7wmur9fdFnyNVYIhAMTZkJ134hgcbsogfYZfh4ZEOmk2/OkbL9VuLfnoMjols8DmkZLtQYFUbbn5R4itxiJOujUc35Ctj7n42C2DihJCBhO6Ipg2N2QEFY1OihFZZUP+z/cmDI/AsLHpvXz6QYKOi6FfTla76c+kheYWL47S1wTuMdI2iwg+n0lecCIBcSZ61ppS19jnU9anwS+DFD0y2TGWw6/5ACyE5BqpyapR1462q0T0uMmahQOQvuATfyPZnfvWhwKzY7uHBKk1W5fnY+a2x417TsjEGh5Cve+juLceAqFcRo7deIyeLZMZe5PqyyzH3TdjwyFdxFulbs8O6Iaa2c4BxXDutsWEMYIi7LpP9uCdG6JgcucXz482HzyB1XaKwz2bm3i60oo1pMz8NmX95AILMgEnykEwDNvU6wnWYEnllW3mitC3/j2SjD3HnjoFx3iQHUjDE8udOtJjQQYZlp7t+kBgF290v3m2ooGm0pWmHX6CfGzCpnI4A1J0W5ltJT/bu9giMQJje3yr0PUq54+h/2AJ2QqfoyX3+zlMbZV6CHlhkiTgeFxNSWcdxDLZVb5vYIDY52KE1/7iGwp3G7hYJb49kB9SBAsUOA6/keQZe9rcyqpALhDYMOWt+O+VyLzP/4eNkBVDBogXciuOZM49EcgxrcJcA+1NmIzxu60Nbv3xie4wG3JddWlmsSJynvLIq8Yf/o1XF/+S3lELym1ve+VsuZw8MAwsEc1P/wVP8G634YRr5Msq93hWmlhG5Pt5eT+mMNrvmrjhOiQo1B32FnIdk+L8Ezcw86/Icsf1v0gIjz8VdmizD9fMKqTbizf0gUEW4sAVBi78N3usWK6qU52L/DigEfF9LUMtIKlHNGJ/3spcyFh2ZLWSoXvvZdIobiAYzj8rJIWonRiFNOSZP8Vdkq/Rx52b5Qh7Fval5/o9PkSF/dMcU4H6LZ0FFktyoLp5XlDI0/I3DDV2Roiy36Efjq3kl9n76Z3axMFpqxX4VxkSQfX9KpdmuSr5qot6CRighwKBVEDhpgaDPVjsFLhpPJ0beAxXz8PGdHbUqXR4OuV/1pzFZz97Aktp97e7qdJ3N2XkrdE0SoxThMtPSUYxICejZvDkT8al44BqmJv4zym8pJm4Vr9flgdlc7SRe2QPBCCLRdblseSM1d9rdC4t5jqqL8Sn8y6m6Plw9vYOiFe7aM8mWhsTFTAQIhkkcBRx2nvMtFkg=
Content-Type: multipart/alternative; boundary="_000_GVXPR07MB9678D4283BB499A153728DEA89619GVXPR07MB9678eurp_"
MIME-Version: 1.0
X-OriginatorOrg: ericsson.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: GVXPR07MB9678.eurprd07.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 659fefdc-c56a-40d1-d009-08db4300d8bc
X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Apr 2023 07:11:51.7871 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: QG1eIqvnocZ4v9s+qu97IQdiL4HH0eKClk0G6scKlXC0p5XQXc0ju3IsD8ZsSgfybIJX9lIg+m19kmxo6h/+GVUMMMdwM8li3GHkZBD0Z5Q=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7799
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/TI_catlfQDEIdQppHt6NvH9AnQM>
Subject: Re: [CFRG] Use of AEAD algorithms as pure encryption algorithms
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.39
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: Sat, 22 Apr 2023 07:12:08 -0000

Hi Valery,

Some quick commments.

- If the G-IKEv2 engine is not trusted to access information inside the messages,
it should probably not be trusted to modify the keys. Chaning the keys would
get however is in control of the G-IKEv2 engine access to information
encrypted with the keys. (The G-IKEv2 can force key reuse as Natanael writes).
Maybe sending two UDP datagrams is the solution? Or sending less keys and use
a KDF to derive some of the keys?

- I don't think "pure encryption algorithms" is a good term. Authenticated
encryption is "pure encryption" for IND-CCA confidentiality. I.e., confidentiality
against active attackers.

- I think is it very good to have a discussion on IND-CPA encryption and APIs for that.
While AEAD has a standardized interface C = E(K, N, P, A) in RFC 5116, IND-CPA
encryption do not. The lack of IND-CPA encryption without message expansion and
the lack of a common API are problems. We discussed this in a paper we just
submitted to the NIST LWC workshop.

https://github.com/emanjon/Publications/blob/main/Proposals%20for%20Standardization%20of%20the%20Ascon%20Family.pdf

The DTLS 1.3 and QUIC specifications use AES-ECB which is secure in their case as the plaintext is a single block, but
I have met people believing that AES-ECB is now ok in general as DTLS and QUIC use it. It would have been easier if each AEAD algorithm had an IND-CPA mode. But people using IND-CPA when they should not are also a big problem…

How should a general interface for IND-CPA look like? Should it be

C = E(K, N, P)

or should it be a special case of the AEAD interface with a zero length tag and A = ""?

C = E(K, N, P, "")

Cheers,
John

From: CFRG <cfrg-bounces@irtf.org> on behalf of Valery Smyslov <smyslov.ietf@gmail.com>
Date: Friday, 21 April 2023 at 09:44
To: 'Natanael' <natanael.l@gmail.com>
Cc: cfrg@ietf.org <cfrg@ietf.org>, 'IPsecME WG' <ipsec@ietf.org>
Subject: Re: [CFRG] Use of AEAD algorithms as pure encryption algorithms
Hi Natanael,

thank you for your response, please see inline.

Den tors 20 apr. 2023 09:42Valery Smyslov <smyslov.ietf@gmail.com<mailto:smyslov.ietf@gmail.com>> skrev:
Hi,

I have a question to the crypto community regarding the use of AEAD algorithms as pure
encryption algorithms. The use case is as follows.

In G-IKEv2 (https://datatracker.ietf.org/doc/draft-ietf-ipsecme-g-ikev2/) we have a situation
where keys are transferred inside the G-IKEv2 message. The message itself is encrypted and
integrity protected. In addition, each of individual keys inside this message is encrypted too
with a different key(s) (it can be the same key for all encrypted keys or different key for each encrypted key,
but in any case these keys are different from the key protecting the message).
The reason for this construction is to prevent the G-IKEv2 engine which forms and parses
messages from accessing any sensitive information inside the messages.

The algorithm for protecting the message itself and individual keys inside the message is the same -
it is one of IKEv2 Encryption transforms
https://www.iana.org/assignments/ikev2-parameters/ikev2-parameters.xhtml#ikev2-parameters-5
The reason for this is to simplify implementations - the algorithm for protecting the message will be
supported anyway, so there seems to be no reason to negotiate another one.
In many cases this algorithm will be an AEAD algorithm (like AES-GCM).

The problem is that there may be quite a lot of encrypted keys inside a single message,
and since G-IKEv2 operates over UDP (and over multicast!), the size of the message matters -
large messages will be fragmented by IP level and due to known issues with firewalls
might not get through, so we want to make the message small. And for each protected key
the authentication tags would consume almost the same space, as the encrypted content.

So, the design is that even when using an AEAD algorithm, the individual
keys inside the protected message are only encrypted and their authentication tags produced by the AEAD algorithm,
are not transmitted. On a receiving side it must be possible to decrypt keys without performing an integrity check.
Note, that the message itself is encrypted and integrity protected, so we are sure that all message content,
including all encrypted keys, is not altered.

My questions to the crypto community:
1. Is it generally OK to use AEAD algorithms as pure ciphers.
2. Do existing APIs to AEAD algorithms allow to decrypt an encrypted blob without checking its integrity.

Regards,
Valery.

1: No, in the general case. It's not a good idea. But there's options (see below).

Especially given that many common AEAD ciphers are built on stream ciphers they are trivially malleable if you don't check the authentication, so if an adversary knows a single plaintext block they can modify it to decrypt to anything they wish. You get none of the guarantees they're intended to give if you don't use them as intended.

          Yes, I’m aware of this.

In the context of your example this allows the adversary to eg. resend old keys, possibly forcing key reuse elsewhere.

          No, it is not possible in my use case. The message, which contains encrypted keys, is always
          encrypted and authenticated using the same AEAD algorithm, and G-IKEv2 provides replay protection,
          so no external adversary can either see or manipulate the keys.

*Even if* the individual keys have their own layer of authenticated encryption inside the encrypted stream, the authentication should bind to the session to prevent replays and more.

          As I’ve already said, replays are not possible. And there is a binding of these keys to a session too.

2: I think most APIs prevent it - in addition some algorithms makes it impossible, intentionally. See SCRAM;

https://github.com/aws/s2n-tls/tree/main/scram<https://protect2.fireeye.com/v1/url?k=31323334-501cfaf3-313273af-454445554331-86146c33258534f8&q=1&e=1376b3f0-373e-43c7-a61f-75309f93706a&u=https%3A%2F%2Fgithub.com%2Faws%2Fs2n-tls%2Ftree%2Fmain%2Fscram>

          Thank you for the pointer.

You do have other options. If you prepend a signed/authenticated Merkle Tree hash which cover the set of encrypted keys then they can be individually verified against the Merkle root without decrypting the entire message. This signature can then also bind the key bundle to the session. The size overhead can be some kilobytes. If this is worth it depends on what you mean with "quite a lot of keys". Several hundreds or more? Could be worth doing. Just some dozen? Not really.

          Well, let me be more specific. G-IKEv2 operates over UDP, so the message size should be less than path MTU to avoid IP fragmentation.
          In most cases it is 1500 bytes, but can be smaller, say 576 bytes. There are some other stuff in the message besides keys,
          so it is generally about from 300 to 1250 bytes are available for keys. To exclude a user from the group using LKH algorithm (RFC 2627)
          we have to send as many keys, as the height of the key tree, which is determined by the group size. Let us assume
          that we limit group size to say 16M users (really big value), then we have to send 24 keys. If we assume that the  size of each key is 256 bits
          (32 bytes) and it must be accompanied with some metadata (key ID etc.) which is 8 bytes and IV (say 8 bytes), then the size of each individual
          encrypted key is no less than 48 bytes. Which makes it barely fit in our optimistic case (with PMTU 1500).
          If we add an authentication tag to each key (16 bytes for AES-GCM), then that many keys won’t fit in any case.
          We should either decrease the size of the keys or limit the group size or complicate protocol to split these messages into many.

          Regards,
          Valery.