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

Natanael <natanael.l@gmail.com> Thu, 20 April 2023 08:42 UTC

Return-Path: <natanael.l@gmail.com>
X-Original-To: ipsec@ietfa.amsl.com
Delivered-To: ipsec@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 2C288C15171F; Thu, 20 Apr 2023 01:42:32 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.094
X-Spam-Level:
X-Spam-Status: No, score=-7.094 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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 (2048-bit key) header.d=gmail.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 pHg9oqWZL6x0; Thu, 20 Apr 2023 01:42:28 -0700 (PDT)
Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 1D3BAC15154F; Thu, 20 Apr 2023 01:42:28 -0700 (PDT)
Received: by mail-ej1-x62a.google.com with SMTP id dm2so4588597ejc.8; Thu, 20 Apr 2023 01:42:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681980146; x=1684572146; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=SoG1GpBxejBvKt84UvHdmAmFDjy1CAeZn0R/hQFgM5s=; b=NNwiQ85XDiHH/08yqDcDtaDmZAnS8wUa+VSL4xZGt2gi3zGjr9oxGv6gmqakqpOWXJ 4im7QhWkC+bknNgfNL1kbIde+5KeXjZJrz42e7rdhRwzbzDMZFEWUOF15LGFrgEgmBV3 iMRkheZ8jlXgxw5bt6I2h3l7Hgo2a2EvksVf9qah/J1Oj6RH84PeF38I6KrUmLP2trzX Mu6Rr3ohKCYfkzxIBHbBak7daS5GDCxMv/teXARNYac3XQauCBFMaJVTwucXHuclRMiF ENd57+lHWwRK42RjkZk0itx336hcnvmBS172rLnfKXR5LQznn4mHyiQhW3bxC4O7j1b3 Xc4g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681980146; x=1684572146; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SoG1GpBxejBvKt84UvHdmAmFDjy1CAeZn0R/hQFgM5s=; b=cXVn9lrddK1eCqt4d3hq7Vwvx5TD5DOw9g2WIxchLQhKgTXrbLHWR69/YgcgJP5dH4 ou116DhxSyqq1gs+qWk/vqn1xTP+xVMxkh3VMYN1tDdCMQ3C1/hd2u/8FvXRN5TZc4s3 RdcC/7pMqk4eRdboiJfYvI1UEF3NfFcHTMVkpFU/peFruV7w1yC7FJWtz2uUFH52G6/i +//v0pv1cworzzIWwnZgLDv88UaTts+E/OTh32KIaEj6xs11ZPsCcqF77fw6fSjZ5jG6 RRmgMX5TJk4VD+vYxP+WRnmahctJl0A+SHbqm1A7NqnO2SmtFtm33LboZ1RYcuFb3bgq wH1g==
X-Gm-Message-State: AAQBX9f8vzr5tDKUbb7os6U1VwMAol2l1erTZPMYyDnRt4u9QxTndbQG F/m9KPBq9/zQCCsIMRAeplUghy709aMgiJMnTBY=
X-Google-Smtp-Source: AKy350Z+0Q4iQ2oCKO+QJfea7SIep//bE6CvSt3DgtaWTu6i9qIqpCNVqyly7BAmSr92pPamu96o1jYjoQxY/sAAO4w=
X-Received: by 2002:a17:907:6d96:b0:931:cd1b:3c0 with SMTP id sb22-20020a1709076d9600b00931cd1b03c0mr6347182ejc.3.1681980145794; Thu, 20 Apr 2023 01:42:25 -0700 (PDT)
MIME-Version: 1.0
References: <083b01d9735b$97767000$c6635000$@gmail.com>
In-Reply-To: <083b01d9735b$97767000$c6635000$@gmail.com>
From: Natanael <natanael.l@gmail.com>
Date: Thu, 20 Apr 2023 10:42:13 +0200
Message-ID: <CAAt2M1_rMBKoEZENQuz8FzJYZTp-3K=dEXaptYEkqfSjs_WnJA@mail.gmail.com>
To: Valery Smyslov <smyslov.ietf@gmail.com>
Cc: cfrg@ietf.org, IPsecME WG <ipsec@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000001c034005f9c08537"
Archived-At: <https://mailarchive.ietf.org/arch/msg/ipsec/VrfgI45ABgpd3NWoy1rD66gDdQ4>
Subject: Re: [IPsec] [CFRG] Use of AEAD algorithms as pure encryption algorithms
X-BeenThere: ipsec@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: Discussion of IPsec protocols <ipsec.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ipsec>, <mailto:ipsec-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ipsec/>
List-Post: <mailto:ipsec@ietf.org>
List-Help: <mailto:ipsec-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ipsec>, <mailto:ipsec-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 20 Apr 2023 08:42:32 -0000

Den tors 20 apr. 2023 09:42Valery Smyslov <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.

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

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

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

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.

>