Re: [CFRG] HPKE and Key Wrapping

John Mattsson <john.mattsson@ericsson.com> Wed, 30 March 2022 17:53 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 7E9193A17AD for <cfrg@ietfa.amsl.com>; Wed, 30 Mar 2022 10:53:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.113
X-Spam-Level:
X-Spam-Status: No, score=-0.113 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, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URI_DOTEDU=1.997] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=ericsson.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hTQcOH-DyHXm for <cfrg@ietfa.amsl.com>; Wed, 30 Mar 2022 10:53:18 -0700 (PDT)
Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on061b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::61b]) (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 52B363A17CA for <cfrg@irtf.org>; Wed, 30 Mar 2022 10:53:18 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ijv14JcmMJBPAh4Q+JPFsWfUtXw4WREaauPeN1QJ0j5HZmr+9s7g9bhJDHm3ZiA+CQj+272YT7XEKOpNaHsJxkLJukGUcsTMjgY4SzBfocljV0ggJOXDw8pOC9nPLd71cH+N2eshcT8XYFnzGo51F+Vui+HbdwViSeQ8ZEB/DpUMrp+hp+o/CcBJU+uIskW1EPx6B6J/57ShLaYcl8jalj1ACj5JauWlBE0iA/NQwuABiNTVu7YN0EYzqPG7dq7UYQYuq4Cn5fPWwhBzsoWdGn1pe2rGvueOA31LZWrGrsW8qaSl4SovLvx2kGx4eQ55Fc1cgifQc+sIdTIC1rxGQQ==
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=5SvUDc1actOL4GN0NKYMjak2H+CQUZlXd7Bm7C81mIg=; b=coah/+/Pz6S5L/oQO1O56dTLwknrtkb+4GUXPsrsBte2DWkyGW9d97iiuQDxicRNZrU0EYKrR2zxLtE26wyMwRA0Of0zgaDzApmitv+hPOg3sxSClbl2NRRzY13co+a7D6UMlEnmSqHsCfVvOfqcZjFBEDHF9UgvVUZZDtd1qEdJ1afYkcCy1xp4AETKqi6y46WKWBFBTsmXwwiYQg+7PIJey6OLQSWFpU1IWzXAROOmYhafwFB6DzGPkB5fvbIiXDN6k/X4bojgrdZxLtB3uQ6QsVxBbGLBxIcOwBnNVeIX++ZJrhZGN2D6m4etqzpApYtRNxw3zsio5mXg7PX7dw==
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=5SvUDc1actOL4GN0NKYMjak2H+CQUZlXd7Bm7C81mIg=; b=TknYrS+1vKTC1NC2FgUA27uymkqub0k/6vwifilW1KesPHGLOZyxFl5U9rZPO72VSjMrdu4Celxs/nTZj5juaSCr40tpyjIolLk3Qe9wmZgbL0K9GjdKdIu91P0p+lIkyNvneBe99CuyUV6z1W3YvBZ3NG3VqnMkXLnQ97afubw=
Received: from HE1PR0701MB3050.eurprd07.prod.outlook.com (2603:10a6:3:4b::8) by PR3PR07MB6953.eurprd07.prod.outlook.com (2603:10a6:102:72::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.10; Wed, 30 Mar 2022 17:53:13 +0000
Received: from HE1PR0701MB3050.eurprd07.prod.outlook.com ([fe80::b462:480e:b937:c62c]) by HE1PR0701MB3050.eurprd07.prod.outlook.com ([fe80::b462:480e:b937:c62c%7]) with mapi id 15.20.5123.019; Wed, 30 Mar 2022 17:53:13 +0000
From: John Mattsson <john.mattsson@ericsson.com>
To: Christopher Wood <caw@heapingbits.net>
CC: Taylor R Campbell <campbell+cfrg@mumble.net>, IRTF CFRG <cfrg@irtf.org>
Thread-Topic: [CFRG] HPKE and Key Wrapping
Thread-Index: AQHYRCD9/8QeXFCaAUyCD94F7Va7HKzXzr6CgAA7ZQCAACZIag==
Date: Wed, 30 Mar 2022 17:53:12 +0000
Message-ID: <HE1PR0701MB305062B2908E620E135BC472891F9@HE1PR0701MB3050.eurprd07.prod.outlook.com>
References: <HE1PR0701MB30505DA9DCB9626D0EAFE56E891F9@HE1PR0701MB3050.eurprd07.prod.outlook.com> <20220330102724.C64F260BA2@jupiter.mumble.net> <HE1PR0701MB30507A04EBAF0D19FC481DD9891F9@HE1PR0701MB3050.eurprd07.prod.outlook.com> <F4AABC95-650A-4C9D-A1E9-06F2E7E5D5DA@heapingbits.net>
In-Reply-To: <F4AABC95-650A-4C9D-A1E9-06F2E7E5D5DA@heapingbits.net>
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-office365-filtering-correlation-id: 20e1e183-0fb1-487b-6eb7-08da1276290b
x-ms-traffictypediagnostic: PR3PR07MB6953:EE_
x-microsoft-antispam-prvs: <PR3PR07MB6953E69F8D369A5E6B9D74F2891F9@PR3PR07MB6953.eurprd07.prod.outlook.com>
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: BUtX3H7iBmFqel4qw8twgfBjcQ4482Y697tB8AmUxOEK/v5BU8QiXRdrJGmgAtl9x/nnPXF6kaQyykLO6d05Vk00HBIlHjHhF427M1m+UyZzkMKfEcgNpxPb5mr3CBTmCHBscyZGdgDjf5g4WRCkwR3yGJB2/SAZhkoVRr5zR+b1ngHYhV2uvo59T4wSwCN2ryKAmtVj15DMg/jWL6o0PKLnmVd8c7Fcs5IKITevO8xzXo+TMOsW7ZCa3cbwATGYywMnvqHCRqUdBNxfjKDk/nx5cHrDyLjvynNc0tWfr150y+5ZondsxZxYSM4E+WOy0QOPRG39IjOjh/MMSRqBg9KUm755tfeSXjy/0/s9xBcpODEophR+shMKSxleA6cSgz1MeZXGofl+GmTcK+89IBDN6zwbv7xS4/1KxqpjbkXikS/kW3gfh5X/XpngHaBP/noT8IIPMiETJVfSt1wgfCLkr3IT2sCGbMeKmDERvlT7H44r+WTUmhuE2iJpgLGsWOD4dSh0NvjNpJ/c0vYy8fLHtlz/odnj3A3NRlwlxhfSGTvXUStbENEdMOQGTL/nWINbto8+KPaOlUDmEl77o3iGAvEpbtvAD+6Bv/V61APvt7It3/4F9sKsIwFpeOOsJ/Fztsf4Ujx2QoNtsvdj4YDXngzGEYBf/MUSlgrFtz2sJJp48wspZxWBFkT7oUk5GhgEChHmybSCwU8FUEdXuKbVK8OOHgUu7nma1fyVayr5cyBitT1fixt30HM7qdG858QI4meGW7Z7eBYGkU8Cv3NGlqDQRBYVN4mtsYpaDnDaYregYHoy5Je/0XDeZ+3HeYDEVZthi6YsVx/vEKTgabWpsWqBoVb/k+44Phr7Njg=
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0701MB3050.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(86362001)(4326008)(21615005)(82960400001)(66476007)(76116006)(122000001)(66946007)(64756008)(66446008)(66556008)(91956017)(26005)(6506007)(53546011)(71200400001)(9686003)(7696005)(8676002)(508600001)(38100700002)(55016003)(5660300002)(54906003)(83380400001)(44832011)(8936002)(316002)(6916009)(38070700005)(33656002)(52536014)(966005)(186003)(166002)(2906002); DIR:OUT; SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: /31fomC5t6wkH99sa0WFM0hdNfTQoYveq8K01lMZlXWhqrZOyRChYfABSHaEZakaoQeLr+9cpARyQv116tOwat0dZPzzrDPoMSfRderj6WDMjtguN2Nf65L+hsU0Kw5eYaDtgpTwdJ0nJrXZG/HDQHItKb/yT8SNjFjEsEpeClFaCIBz5E8Pox34YoArSZaXhSTfU+r9gOOFwZCM1qqiYxC0XvH28TB5Rs+uZ0uoBR6bc5x/B4uSMjgnd1BgpC9PbyUi2kZuU9ak3QKfaFxzI1OmDzwCg7ObJ40LTCbKGCyU98uPR7nS1SwY8LJ45kCRCE40dNS+03o9HKoXmMim9+Tg6Eksg7CfXIK+YXkk8Kozc1N795BDUcVrX+gjp+krYXb3tEA3frHN0pZIXNN16YYt06NFn1I2d6yP+XQqH4yjHEVtWDAfxLB8T/uSK2/T4gbbxlezLhpcohVR+V6CD2AKian3cW7a6Gfv/EukuQu9nAwFx4Xya97wtTIvR01zlfPghLy4INMJdHJHJDT5Kg1pXPTL76nFTdiremZHTZ1tcoQusTSnu/bkZa6YaV+zQSck/vjdWjIRuJDPPDZ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Gxt3H/hC4/zinF0noJmx07ZqxLKVYf3yLqgYyHhXbIx0oTCc0LIGPLZLMm5tP+VXJ8y5ueFC97PMdXF2+dPq5x1LcNhtEjzCSapPNf
Content-Type: multipart/alternative; boundary="_000_HE1PR0701MB305062B2908E620E135BC472891F9HE1PR0701MB3050_"
MIME-Version: 1.0
X-OriginatorOrg: ericsson.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: HE1PR0701MB3050.eurprd07.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 20e1e183-0fb1-487b-6eb7-08da1276290b
X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Mar 2022 17:53:12.7277 (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: /59e69pB7Q5hCQ6gH4p1faljZ6t1oPl53X4vp8IJA2Rc4tJzpfBO58+KL9OzyNa1I4u2ofi5md4LtrK/b+nrZRKyybdqo1h8ukCT2J5Cqik=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR07MB6953
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/jeymI0jBBzltGxvegGoC-5OcIm0>
Subject: Re: [CFRG] HPKE and Key Wrapping
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.29
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: Wed, 30 Mar 2022 17:53:24 -0000

Hi Chris,

I think the model in [1] does not map directly to HPKE as [1] discusses a deterministic one-layer symmetric key wrap method and HPKE is a randomized two-layer asymmetric key wrap method. As stated in [1] "So key-wrap’s raison d’ˆetre is to remove AE’s reliance on a nonce or random bits" and by NIST [2] "consideration of additional circumstances (e.g., resilience to operator error, low-quality random number generators)". My high-level summary of the key wrap attack model would be that the attacker can control all inputs but that the attacker does not know the outer secret key used in the key wrap.

- The input to AES-SIV used for key wrap would be:

ct = SIV-ENCRYPT(key, aad, pt)
pt = SIV-DECRYPT(key, aad, ct)

where pt is the key to be wrapped. Nonce and random bits are not even taken as input. This construction is secure under the assumption that the attacker does not know “key”.

- The input to RSAES-OAEP + AES-KWP [3] is

ct = RSAES-OAEP+AES-KWP-encrypt(pkR, random bits, pt)
pt = RSAES-OAEP+AES-KWP-dencrypt(skR, ct)

where “random bits” are used to generate the mask. My understanding is that this construction is secure under the assumption that the attacker does not know skR.

- The input to single-shot HPKE used for key wrap would be

ct = HPKE-single-shot-encrypt(pkR, random bits, aad, pt)
pt = HPKE-single-shot-decrypt(skR, aad, ct)

where “random bits” are used in GenerateKeyPair(). With AES-GCM this is not secure at all under the assumption that the attacker controls “random bits”. With AES-SIV I think the construction is secure under the same assumption.

Unless necessary, I would be very hesitant to move to a key wrap mechanism that relies heavily on the trust in the random number generator. Using AES-GCM might be ok for key transport in some circumstances, but I would like to also see a HPKE key wrap mode that removes the reliance on “random bits”.

Cheers,
John

[1] https://www.iacr.org/archive/eurocrypt2006/40040377/40040377.pdf
[2] https://en.wikipedia.org/wiki/Key_wrap
[3] https://cloud.google.com/kms/docs/key-wrapping

From: Christopher Wood <caw@heapingbits.net>
Date: Wednesday, 30 March 2022 at 17:18
To: John Mattsson <john.mattsson@ericsson.com>
Cc: Taylor R Campbell <campbell+cfrg@mumble.net>, IRTF CFRG <cfrg@irtf.org>
Subject: Re: [CFRG] HPKE and Key Wrapping
Apologies if I’m misunderstanding something here, but this threat model seems somewhat convoluted. In particular, it assumes an adversary that controls the RNG, and therefore key schedule state as well. The AEAD key and nonce are both derived from this state. However, the DAE security model from [1] assumes the attacker controls the message header and message itself, but not the key. (For MRAE, it assumes the attacker also controls the nonce/IV.) So it’s not clear to me why SIV or similar modes would offer meaningful improvements over the existing HPKE AEADs under the assumption that the attacker controls the nonce and key. Can someone help clarify what I’m missing?

Thanks,
Chris

[1] https://web.cs.ucdavis.edu/~rogaway/papers/keywrap.html

> On Mar 30, 2022, at 4:46 AM, John Mattsson <john.mattsson=40ericsson.com@dmarc.ietf.org> wrote:
>
> Thanks Taylor!
>
> Then it seems to me that AES-256-SIV and AES-512-SIV are the AES-based modes that should be added to HPKE to enable key wrapping security independent of the RNG. These are exactly the two AEADs suggested by draft-harkins-cfrg-dnhpke-01. Key wrapping mechanisms have in the past aimed to provide security even in the case of compromised RNG but it would be interesting to hear if someone think that property is needed in this case.
>
> Cheers,
> John
>
> From: Taylor R Campbell <campbell@mumble.net> on behalf of Taylor R Campbell <campbell+cfrg@mumble.net>
> Date: Wednesday, 30 March 2022 at 12:29
> To: John Mattsson <john.mattsson@ericsson.com>
> Cc: Dan Harkins <dharkins@lounge.org>, IRTF CFRG <cfrg@irtf.org>
> Subject: Re: [CFRG] HPKE and Key Wrapping
>
> > Date: Wed, 30 Mar 2022 08:51:44 +0000
> > From: John Mattsson <john.mattsson=40ericsson.com@dmarc.ietf.org>
> >
> > How does AES-SIV (RFC 5297) compare with AES-GCM-SIV (RFC 8452)? Do
> > we need both algorithms in the future? Does AES-GCM-SIV with a fixed
> > nonce provide the same properties as nonce-less AES-SIV or is there
> > a difference?
>
> There is a fairly substantial difference.  In the Daence paper I drew
> a table of advantage bounds for AES-SIV and AES-GCM-SIV, using the
> best formulae I could find (with the function/permutation-switching
> lemma of https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-a129ecc550c2c3ad&q=1&e=117ce771-01cf-4d9c-aa89-a8b4b42eab86&u=https%3A%2F%2Fcr.yp.to%2Fpapers.html%23permutations that gives better
> bounds than the conventional q*(q - 1)/2 used in most papers):
>
> https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-fc96309953b1fcfb&q=1&e=117ce771-01cf-4d9c-aa89-a8b4b42eab86&u=https%3A%2F%2Feprint.iacr.org%2F2020%2F067.pdf%23page%3D5
>
> Smaller advantage bounds, i.e., larger values of n in the 2^-n terms,
> are better.  1 means no advantage bound has been proven at all for
> these parameters.
>
> This table was computed using the logic at
>
> https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-ab6fc8eec24511fa&q=1&e=117ce771-01cf-4d9c-aa89-a8b4b42eab86&u=https%3A%2F%2Fgithub.com%2Friastradh%2Fdaence%2Fblob%2Fmaster%2Fadv.py
>
> which cites the sources in the literature I used for the formulae.
> You can reuse the same logic to recompute bounds for different message
> sizes/numbers if what you're looking for isn't in the table, of
> course.
>
> It may be worth noting that the security advertisment in RFC 8452 for
> AES-GCM-SIV explicitly discourages nonce reuse even between different
> users (different keys), which means you should even avoid the policy
> of sequential message numbers that, e.g., TLS 1.3 uses with AES-GCM to
> rule out a class of attacks:
>
> https://datatracker.ietf.org/doc/html/rfc8452#page-12
>
> The bottom line is that AES-GCM-SIV is designed for randomized nonces,
> with some level of protection if your RNG fails.  In contrast, AES-SIV
> is designed for security without nonces at all, and is particularly
> well-suited to key-wrap, which should come as no surprise since that's
> what it was designed for originally, as sung in Appendix F of:
>
> https://web.cs.ucdavis.edu/~rogaway/papers/keywrap.html
> _______________________________________________
> CFRG mailing list
> CFRG@irtf.org
> https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-40f7d10cf9eb7c69&q=1&e=4d15d9d4-caaf-4057-bff5-ccea9b384b51&u=https%3A%2F%2Fwww.irtf.org%2Fmailman%2Flistinfo%2Fcfrg