[Sframe] Question about the use of HKDF-Extract

"Mularczyk, Marta" <mulmarta@amazon.ch> Thu, 03 August 2023 14:00 UTC

Return-Path: <prvs=572caf8b9=mulmarta@amazon.ch>
X-Original-To: sframe@ietfa.amsl.com
Delivered-To: sframe@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id A6ABAC14CF13 for <sframe@ietfa.amsl.com>; Thu, 3 Aug 2023 07:00:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.103
X-Spam-Level:
X-Spam-Status: No, score=-7.103 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=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
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=amazon.ch
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 pedHwHrZ2Yn7 for <sframe@ietfa.amsl.com>; Thu, 3 Aug 2023 06:59:59 -0700 (PDT)
Received: from smtp-fw-52004.amazon.com (smtp-fw-52004.amazon.com [52.119.213.154]) (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 02E88C151556 for <sframe@ietf.org>; Thu, 3 Aug 2023 06:59:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.ch; i=@amazon.ch; q=dns/txt; s=amazon201209; t=1691071199; x=1722607199; h=from:to:subject:date:message-id:mime-version; bh=rU4mLgfhoMj5iPGDRAFPUkYB/81wioLm61IzfDgZJ6c=; b=s/rllE6D8W8WKt0LBSbxht/df4BP//fGQuZYyTqhnsUEmd4OrXPHNy1r 2itnrRekpoBBtZAhfwS7Ty6gQSNzWDT1vxQruo/E408Gt0bPriJKyNjE3 ohWr4dg8ASXvYxCFqaWzU+SWaIDnYZoGbIbqWba6GseowZMtLIfge6MNH Y=;
X-IronPort-AV: E=Sophos;i="6.01,252,1684800000"; d="scan'208,217";a="146482653"
Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-pdx-2c-m6i4x-8c5b1df3.us-west-2.amazon.com) ([10.43.8.2]) by smtp-border-fw-52004.iad7.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2023 13:59:58 +0000
Received: from EX19D018EUA004.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2c-m6i4x-8c5b1df3.us-west-2.amazon.com (Postfix) with ESMTPS id 07FCC40DBF for <sframe@ietf.org>; Thu, 3 Aug 2023 13:59:56 +0000 (UTC)
Received: from EX19D027EUC002.ant.amazon.com (10.252.61.165) by EX19D018EUA004.ant.amazon.com (10.252.50.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Thu, 3 Aug 2023 13:59:56 +0000
Received: from EX19D027EUC001.ant.amazon.com (10.252.61.221) by EX19D027EUC002.ant.amazon.com (10.252.61.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Thu, 3 Aug 2023 13:59:55 +0000
Received: from EX19D027EUC001.ant.amazon.com ([fe80::bb51:11a0:d28b:f79e]) by EX19D027EUC001.ant.amazon.com ([fe80::bb51:11a0:d28b:f79e%3]) with mapi id 15.02.1118.030; Thu, 3 Aug 2023 13:59:55 +0000
From: "Mularczyk, Marta" <mulmarta@amazon.ch>
To: "sframe@ietf.org" <sframe@ietf.org>
Thread-Topic: Question about the use of HKDF-Extract
Thread-Index: AQHZxg5TFipYs3yhU0C7kW0iPME2bQ==
Date: Thu, 03 Aug 2023 13:59:55 +0000
Message-ID: <4dfb9a54701e4682bf131f2f92f84699@amazon.ch>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [10.252.51.153]
Content-Type: multipart/alternative; boundary="_000_4dfb9a54701e4682bf131f2f92f84699amazonch_"
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/sframe/ei3QE9xyA7k9dtnJ6Hk7avLKW9w>
Subject: [Sframe] Question about the use of HKDF-Extract
X-BeenThere: sframe@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: Secure Media Frames <sframe.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/sframe>, <mailto:sframe-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/sframe/>
List-Post: <mailto:sframe@ietf.org>
List-Help: <mailto:sframe-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/sframe>, <mailto:sframe-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 03 Aug 2023 14:00:03 -0000

Hi all!

First of all, I think it's a great protocol, super simple and useful.

Now my actual small question. I noticed that derive_key_salt uses the HKDF in a bit non-standard way. Is there a reason for this, or can we use the "more standard" way I propose below? If people like the idea, I'm happy to draft a PR. In detail, the draft states

   sframe_secret = HKDF-Extract("SFrame 1.0 Secret " + KID, base_key)
   sframe_key = HKDF-Expand(sframe_secret, "key", AEAD.Nk)
   sframe_salt = HKDF-Expand(sframe_secret, "salt", AEAD.Nn)

The way HKDF-Extract is typically used is HKDF-Extract(optional_random_salt, base_key). On the other hand, the "domain separation" achieved by the label "SFrame 1.0 Secret " + KID typically happens in HKDF-Expand. So a more standard way seems to be

   sframe_secret = HKDF-Extract("", base_key)
   sframe_key = HKDF-Expand(sframe_secret, "SFrame 1.0 Secret key " + KID, AEAD.Nk)
   sframe_salt = HKDF-Expand(sframe_secret, "SFrame 1.0 Secret salt " + KID, AEAD.Nn)

This also aligns with MLS, which computes (below the Label is e.g. "joiner")

   ExpandWithLabel(Secret, Label, Context, Length) = KDF.Expand(Secret, {length, "MLS 1.0 " + label, Context}, Length)

FWIW, my explanation (in very loose terms) of the "more standard" derivation would be that the call to HKDF-Extract genertes a uniform key from a possibly non-uniform key provided by the application, while the HKDF-Expand calls generate 2 uniform keys from a uniform key.

Best,
Marta